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
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.
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
Related
Im trying to link with a game library that has already been compiled using mingw, called Raylib. However; whenever I use MSYS's gcc 10.2 it gives me the following undefined reference error:
gcc main.c -Iraylib-3.7.0_win64_mingw-w64/include -Lraylib-3.7.0_win64_mingw-w64/lib -lraylib -lopengl32 -lgdi32 -lwinmm
/usr/lib/gcc/x86_64-pc-msys/10.2.0/../../../../x86_64-pc-msys/bin/ld: raylib-3.7.0_win64_mingw-w64/lib/libraylib.a(core.o):core.c:(.text+0x1f6e): undefined reference to '_assert'
It seems that I maybe missing a library? This is just one of many similar errors. The majority of these undefined references are for assert like the one listed above. Some deal with GLFW and other libraries. Has anyone experienced something like this on MSYS?
Looks like I needed to be directly in MSYS2 mingw64 environment (cmd prompt). I was using the regular MSYS2 MSYS environment.
I am a novice to cmake and boost so this question might be missing something obvious:
I am building a project with cmake on linux (ubuntu) and I am trying to use boost logging in that project. Here is what I do to generate the Makefile:
rm CMakeCache.txt
cmake ../ -DCMAKE_EXE_LINKER_FLAGS="-lboost_log -lboost_log_setup -lpthread -std=c++11" -DCMAKE_SHARED_LINKER_FLAGS="-lboost_log_setup -lboost_log -lpthread" -DCMAKE_MODULE_LINKER_FLAGS="-lboost_log_setup -lboost_log -lpthread" -DCMAKE_CXX_FLAGS="-DBOOST_LOG_DYN_LINK -std=c++11"
Compile goes through fine. (Some of these flags may be overkill -- I should only need the CMAKE_EXE_LINKER_FLAGS).
When I run the executable, I get the following unresolved reference:
-- ImportError: /home/mranga/gr-msod-sensor/gr-msod_sensor/build/lib/libgnuradio-msod_sensor.so: undefined symbol: _ZN5boost3log11v2_mt_posix3aux25unhandled_exception_countEv
What flags am I missing? My boost library is set up and LD_LIBRARY_PATH points to the right location.
When I manually built a test program using the same linker flags, it compiles and runs fine so boost is installed correctly. I hope I have not missed the obvious.
(Moved question from the GNU Radio mailing list -- sorry if you are reading this post for a second time).
I believe the order of libraries in the linker command line in -DCMAKE_EXE_LINKER_FLAGS is incorrect. boost_log_setup depends on boost_log, so boost_log_setup should go first.
You seem to be linking against the non-multithreaded version:
-lboost_log
but the run-time linker seems to explicitely look for the multithreaded variant (the Boost doc site on that):
_ZN5boost3log11v2_mt_posix3aux25unhandled_exception_countEv
^^
My guess hence is that you should try linking with
-lboost_log_mt
but the question whether that is right or not depends too much on your individual project to make it possible for me to clearly answer this.
I import j2objc to my project, but I still get error like Undefined symbols for architecture x86_64: "_OBJC_CLASS_$_Test (public class Test in java source). I found something about wrong linking static library to project (libjre_emul.a). I found possible official solution add to Other Linker Flags flag "-l jre_emul".
Problem is I get error ld: library not found for -l jre_emul what does it mean? How can I fix this?
I tried extended command:
"-l jre_emul -ObjC -force_load ${PROJECT_DIR}/lib/libjre_emul.a"
Error library not found still remains. Any idea?
Thanks.
I think you have a spelling error in your other linker flags. Try to use something like:
-l"jre_emul"
The -force_load flag is no longer necessary. The issue is that the linker can't find the library because the path to it is not defined in your project (it's probably not in ${PROJECT_DIR}/lib, unless you explicitly put it there). The Update the Build Settings wiki section describes how to add the J2ObjC distribution path to your project's Library Search Paths build setting.
OK, so I have been following this tutorial.
I set up everything as told (double checked everything), only thing I changed is (step 10), from
${OGRE_HOME}\boost_1_44
to
${OGRE_HOME}\boost
since in my Ogre SDK version (1.81), there is no boost_1_44 folder, only boost folder.
Anyhow, as I said, when I try to compile my program, I get this three errors :
undefined reference to boost::system::generic_category()
undefined reference to boost::system::generic_category()
undefined reference to boost::system::system_category()
I have tried adding this : -lboost_system to my Project. I went to Properties > C/C++ Build > Settings > GCC C++ Compiler > Miscellaneous and added it to the existing flags, but no luck.
I googled, and apparently that is the only solution possible. So, I ask you, if someone could explain me (as simple as possible please, step by step) how to fix this compiler errors.
EDIT : I'm using MinGW as a compiler (I use it with MSYS).
I have had similar problems compiling in linux using CMake and clang. I fixed it by adding the flag
-DBOOST_SYSTEM_NO_DEPRECATED
This "comments" out the lines causing the problem. I don't know if this will fix your errors but it did fix mine.
(If you use ./configure also add CPPFLAGS='-DBOOST_SYSTEM_NO_DEPRECATED' as a parameter).
I have 2 shared object libs and one executable.
1 of the libs that I compile has linkage error: Undefined _cxa_pure_virtual.
Why?
Usually we do not need to implement it. Any Ideas?
If I implement it both the libs compile and link OK, but the application that links to both has same linkage issue?
The lib in question is a C++ library and the __cxa_pure_virtual is needed by the C++ runtime. Suggest that you try first linking with g++ command instead of gcc.
Read more under this question: What is the purpose of cxa pure virtual