Compiling Trilino

157 Views Asked by At

I'm trying to compile a simple test program using the Trilino package but something is wrong. The install of Trilino have went fine as far as I know but there must be something wrong with the linking or something. Below is my makefile:

include /home/jacob/Trilinos/trilinos-build/Makefile.export.Trilinos
CXX=$(Trilinos_CXX_COMPILER)
CC=$(Trilinos_C_COMPILER)
FORT=/usr/bin/gfortran

CXX_FLAGS=$(Trilinos_CXX_COMPILER_FLAGS) $(USER_CXX_FLAGS)
C_FLAGS=$(Trilinos_C_COMPILER_FLAGS) $(USERC_FLAGS)
FORT_FLAGS=$(Trilinos_Fortran_COMPILER_FLAGS) $(USER_FORT_FLAGS)

INCLUDE_DIRS=$(Trilinos_INCLUDE_DIRS) $(Trilinos_TPL_INCLUDE_DIRS)
LIBRARY_DIRS=$(Trilinos_LIBRARY_DIRS) $(Trilinos_TPL_LIBRARY_DIRS)
LIBRARIES=$(Trilinos_LIBRARIES) $(Trilinos_TPL_LIBRARIES)

LINK_FLAGS=$(Trilinos_EXTRA_LD_FLAGS)
DEFINES=-DMYAPP_EPETRA

default: print_info vector.x 

vector.x: libmyappLib.a
      $(CXX) $(CXX_FLAGS) libMyappLib.a -o vector.x $(LINK_FLAGS) $(INCLUDE_DIRS) $(DEFINES) $(LIBRARY_DIRS) $(LIBRARIES)

libmyappLib.a: es.o
      $(Trilinos_AR) cr libMyappLib.a es.o

es.o:
      $(CXX) -c $(CXX_FLAGS) $(INCLUDE_DIRS) $(DEFINES) es.cpp

And here is the program:

#include "Epetra_SerialComm.h"
#include "Epetra_Map.h"
#include "Epetra_Vector.h"
#include "Epetra_Version.h"

int main(int argc, char *argv[])
{

std::cout << Epetra_Version() << std::endl << std::endl;
Epetra_SerialComm Comm;
int NumElements = 1000;
Epetra_Map Map(NumElements, 0, Comm);
Epetra_Vector x(Map);
Epetra_Vector b(Map);
b.Random();
x.Update(2.0, b, 0.0); // x = 2*b
double bnorm, xnorm;
x.Norm2(&xnorm);
b.Norm2(&bnorm); 
std::cout << "2 norm of x = " << xnorm << std::endl
          << "2 norm of b = " << bnorm << std::endl;

return 0;
}

However, when running make it just gives back:

es.cpp:(.text.startup+0x91): undefined reference to Epetra_SerialComm::Epetra_SerialComm()
es.cpp:(.text.startup+0xa7): undefined reference to           `Epetra_Map::Epetra_Map(int,int, Epetra_Comm const&)'
es.cpp:(.text.startup+0xbb): undefined reference to `Epetra_Vector::Epetra_Vector(Epetra_BlockMap const&, bool)'
.
.
.
collect2: error: ld returned 1 exit status
make: *** [vector.x] Fel 1

For every piece of code inside main, so it seems like it cannot find the Epetra package even though itś not complaining about the includes. Does anyone have a clue of what might be the problem? I'm fairly new to C++/C and handling the Trilino package is rather complicated so any tip is highly appreciated.

0

There are 0 best solutions below