1

I've just installed trilinos 11.0.3 and now I'm trying to compile my first application using cmake.

The file I'm trying to compile is here http://code.google.com/p/trilinos/wiki/EpetraSimpleVector

The first command cmake seems to work although I get the following warnings (just in case its relevant) for each trilinos package:

    CMake Warning (dev) at /home/giorgos/Documents/TRILINOS/lib/cmake/Trilinos/
    TrilinosTargets.cmake:208 (ADD_LIBRARY):        
    ADD_LIBRARY called with SHARED option but the target platform does not
    support dynamic linking.  Building a STATIC library instead.  This may lead
    to problems.

Other than that it seems that the location of trilinos includes and libraries have been found correctly

However the make command produce a list of similar errors such as :

    /home/giorgos/Documents/mpi_tests/trilinos_test/test1/src/teuchos_test.cpp:11:
    undefined reference to `Epetra_SerialComm::Epetra_SerialComm()'

    /home/giorgos/Documents/mpi_tests/trilinos_test/test1/src/teuchos_test.cpp:16: 
    undefined reference to `Epetra_Map::Epetra_Map(int, int, Epetra_Comm const&)'

    /home/giorgos/Documents/mpi_tests/trilinos_test/test1/src/teuchos_test.cpp:19: 
    undefined reference to `Epetra_Vector::Epetra_Vector(Epetra_BlockMap const&, bool)'

    /home/giorgos/Documents/mpi_tests/trilinos_test/test1/src/teuchos_test.cpp:20: 
    undefined reference to `Epetra_Vector::Epetra_Vector(Epetra_BlockMap const&, bool)'

Any idea what's going on here?

(I named the source file teuchos_test.cpp because first I tried to compile some code from the teuchos package, However I was receiving similar errors as above)

Thank you

Giorgos

F14
  • 67
  • 2
  • 6
giorgk
  • 109
  • 1
  • 11

2 Answers2

0

You can use cmake or make to build your program with Trilinos. I refer you to the official tutorial website here, which provides detailed explanations for both methods.

F14
  • 67
  • 2
  • 6
-1

I haven't been able to compile the trilinos examples with cmake but I was able to do so by linking everything my self. For the example that gives me the above errors I did the following

  g++ -o teuchos_test teuchos_test.cpp \ 
  -I/home/giorgos/Documents/TRILINOS/include \
  -L/home/giorgos/Documents/TRILINOS/lib -lepetra

since it depends on the epetra package only (I still have to change the name :))

However if anyone knows how to compile trilinos with cmake I'd appreciate the input here

giorgk
  • 109
  • 1
  • 11
  • Did you use [this example](http://code.google.com/p/trilinos/wiki/CMakeFindPackageTrilinosExample)? – Fraser Mar 07 '13 at 23:16
  • Thanks for the finding! I used a similar one from Trilinos but without so many explanatory comments. I'll give it a try – giorgk Mar 08 '13 at 23:51
  • This is how I do it: Copy the content of http://trilinos.sandia.gov/Export_Makefile_example.txt to an empty Makefile. In the first command, which starts with the word include you have to give the path of the "Makefile.export.Trilinos" file of your installation. Next change the names of the library and source files with the correct ones and execute make "MyApp.exe" where "MyApp.exe" is the name you use to replace the "MyApp.exe" in the Makefile. I hope this will help. – giorgk Jun 27 '13 at 19:44