Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when building PaGMO #90

Closed
mvandenbroeck opened this issue Nov 16, 2016 · 19 comments
Closed

Error when building PaGMO #90

mvandenbroeck opened this issue Nov 16, 2016 · 19 comments

Comments

@mvandenbroeck
Copy link
Member

After I did a 'Build->Clean All' in Qt Creator, I'm getting the following two errors when rebuilding the TudatBundle:

"Unable to locate a c++11 compatible compiler pagmo/CMakeLists.txt:35 (INCLUDE)
C:\tudatBundle_mvdb\pagmo\cmake_scripts\set_compiler_flags.cmake"

and

"[cmake_check_build_system] Error 1"

The error is present even when option(USE_PAGMO ... ) is set to 'OFF' in TudatBundle\CMakeLists.txt.
I heard that it can be caused by a difference in the boost library version between tudat and pagmo. Is there an easy fix to this?

Thanks,

Michael

@DominicDirkx
Copy link
Member

Hi Michael,

For now, comment out the Pagmo includes in the top-level CMakeLists, and continue compiling. I'll get back to you on fixing this,

Dominic

@mvandenbroeck
Copy link
Member Author

mvandenbroeck commented Nov 21, 2016

Hi Dominic,

I'm trying to build and run the main.cpp file in tudatExampleApplications/libraryExamples/PaGMOEx but I get a few thousands of 'undefined reference to ... boost ...' errors at Linking CXX executables .../pagmo/bin/main.exe
According to this https://github.com/esa/pagmo/issues/69 issue, it has to do with the order of linking. I changed the order around a little bit, but it wouldn't work.

I'm using BoostVersion 1.53.0.
Do you have any ideas that could help me resolve this problem?

Thanks,

Michael

@DominicDirkx
Copy link
Member

Hi Michael,

How exactly did you change the linking order in the CMakeLists? Could you show a 'before' and 'after'?

Another issues might be that your pagmo-boost is compiled differently from your tudat boost. Can you have CMake print the location of the boost libraries (in the pagmo cmake list) and check if it is the same as the Tudat one?

Dominic

@mvandenbroeck
Copy link
Member Author

mvandenbroeck commented Nov 22, 2016

Hi Dominic,

In tudatExampleApplications/PaGMOEx/CMakeLists.txt I changed the following last 4 lines from:

add_executable(example_library_pagmo "${SRCROOT}/main.cpp") setup_executable_target(example_library_pagmo "${SRCROOT}") target_link_libraries( example_library_pagmo pthread pagmo my_pagmo_problems tudat_basic_astrodynamics tudat_mission_segments ${Boost_LIBRARIES} )

into

add_executable(example_library_pagmo "${SRCROOT}/main.cpp") setup_executable_target(example_library_pagmo "${SRCROOT}") target_link_libraries( example_library_pagmo pthread my_pagmo_problems tudat_basic_astrodynamics tudat_mission_segments pagmo_static ${Boost_LIBRARIES}

and

add_executable(example_library_pagmo "${SRCROOT}/main.cpp") setup_executable_target(example_library_pagmo "${SRCROOT}") target_link_libraries( example_library_pagmo pthread my_pagmo_problems tudat_basic_astrodynamics tudat_mission_segments ${Boost_LIBRARIES} pagmo )

For the location of the boost libraries in pagmo/CMakeLists.txt I got:

optimizedC:/tudatBundle_mvdb/boost/stage/lib/libboost_system-mt.dlldebugC:/tudatBundle_mvdb/boost/stage/lib/libboost_system-mt.aoptimizedC:/tudatBundle_mvdb/boost/stage/lib/libboost_serialization-mt.dlldebugC:/tudatBundle_mvdb/boost/stage/lib/libboost_serialization-mt.aoptimizedC:/tudatBundle_mvdb/boost/stage/lib/libboost_thread-mt.dlldebugC:/tudatBundle_mvdb/boost/stage/lib/libboost_thread-mt.a

For the locatio of the boost libraries in tudatExampleApplications/libraryExamples/PaGMOEx/CMakeLists.txt I got:

C:/tudatBundle_mvdb/boost/stage/lib/libboost_thread-mt.aC:/tudatBundle_mvdb/boost/stage/lib/libboost_date_time-mt.aC:/tudatBundle_mvdb/boost/stage/lib/libboost_system-mt.aC:/tudatBundle_mvdb/boost/stage/lib/libboost_serialization-mt.aC:/tudatBundle_mvdb/boost/stage/lib/libboost_filesystem-mt.aC:/tudatBundle_mvdb/boost/stage/lib/libboost_regex-mt.a

Thanks,

Michael

`

@DominicDirkx
Copy link
Member

Hi Michael,

I think the problem is that you are changing the wrong CMakeLists. Since the issue is in the linking of the .../pagmo/bin/main.exe executable, you need to change the link order of this executable in:

This is the CMakeLists of pagmo itself, so tudatBundle/pagmo/CMakeLists.txt

Way at the end of the file (line 397 for me) it says:

TARGET_LINK_LIBRARIES(main ${MANDATORY_LIBRARIES} pagmo_static)

Change it to

TARGET_LINK_LIBRARIES(main pagmo_static ${MANDATORY_LIBRARIES})

And with any luck this should fix the issue

@mvandenbroeck
Copy link
Member Author

I made the changes you proposed in tudatBundle/pagmo/CMakeLists.txt and also changed the link order in the tudatBundle/pagmo/examples/CMakeLists.txt and tudatBundle/pagmo/tests/CMakeLists.txt. I did a clean rebuild and ran CMake.

Unfortunately it didn't solve the problem, I'm still getting 72k issues of which 1880 are errors of the kind 'undefined reference to ... boost ... '. Apparently the warning suppression didn't work either.
I think I'll pass by your office tomorrow morning again. :-)

I have one more question though. What is the best directory to put the main.cpp file of my personal pagmo optimization? Should I put in tudatBundle/Thesis or tudatBundle/tudatExampleApplications/libraryExamples/PaGMOEx?

Thanks,

Michael

@DominicDirkx
Copy link
Member

Hmmm, could you post some of the full errors in the boost linking?

@mvandenbroeck
Copy link
Member Author

mvandenbroeck commented Nov 22, 2016

Here are some full errors that occur after
[ 80%] Built target pagmo_static
Linking CXX executable C:\tudatBundle_mvdb\pagmo\bin\main.exe

C:/tudatBundle_mvdb/pagmo/lib/libpagmo.a(jde.cpp.obj): In function 'ZN5boost13serialization16void_cast_detail11void_casterC2EPKNS0_18extended_type_infoES5_iPKS2_': C:/tudatBundle_mvdb/boost/boost/serialization/void_cast.hpp:143: undefined reference to '_imp___ZTVN5boost13serialization16void_cast_detail11void_casterE'

C:/tudatBundle_mvdb/pagmo/lib/libpagmo.a(jde.cpp.obj): In function 'ZN5boost7archive6detail19pointer_oserializerINS0_13text_oarchiveEN5pagmo9algorithm3jdeEED1Ev': C:/tudatBundle_mvdb/boost/boost/archive/detail/oserializer.hpp:223: undefined reference to '_imp___ZN5boost7archive6detail25basic_pointer_oserializerD2Ev'

C:/tudatBundle_mvdb/pagmo/lib/libpagmo.a(jde.cpp.obj): In function 'ZN5boost7archive6detail11oserializerINS0_13text_oarchiveEN5pagmo9algorithm4baseEEC1Ev': C:/tudatBundle_mvdb/boost/boost/archive/detail/oserializer.hpp:112: undefined reference to '_imp___ZN5boost7archive6detail17basic_oserializerC2ERKNS_13serialization18extended_type_infoE'

C:/tudatBundle_mvdb/pagmo/lib/libpagmo.a(worst_r_policy.cpp.obj): In function 'ZN5boost7archive6detail19pointer_oserializerINS0_13text_oarchiveEN5pagmo9migration14worst_r_policyEED2Ev': C:/tudatBundle_mvdb/boost/boost/archive/detail/oserializer.hpp:223: undefined reference to '_imp___ZN5boost7archive6detail25basic_pointer_oserializerD2Ev'

The last part of the compile output is:

C:/tudatBundle_mvdb/pagmo/lib/libpagmo.a(ackley.cpp.obj): In function 'ZN5boost7archive6detail21load_non_pointer_typeINS0_13text_iarchiveEE13load_standard6invokeIN5pagmo7problem6ackleyEEEvRS3_RKT_': C:/tudatBundle_mvdb/boost/boost/archive/detail/iserializer.hpp:387: undefined reference to '_imp___ZN5boost7archive6detail14basic_iarchive11load_objectEPvRKNS1_17basic_iserializerE' collect2.exe: error: ld returned 1 exit status mingw32-make[3]: *** [C:/tudatBundle_mvdb/pagmo/bin/main.exe] Error 1 mingw32-make[2]: *** [pagmo/CMakeFiles/main.dir/all] Error 2 mingw32-make[1]: *** [pagmo/CMakeFiles/main.dir/rule] Error 2 mingw32-make: *** [main] Error 2 19:34:19: The process "C:\Qt\Tools\mingw491_32\bin\mingw32-make.exe" exited with code 2. Error while building/deploying project TudatBundle (kit: Desktop Qt 5.4.1 MinGW 32bit) When executing step "Make" 19:34:19: Elapsed time: 02:02.

Here is the entire compile output in case you need it:
Compile Output.txt

Thanks,

Michael

@DominicDirkx
Copy link
Member

Hi Michael,

It seems that all the linking errors are in the serialization library, which is not needed by Tudat, but is used by pagmo. Could you check if this library is in the the boost/stage/lib folder?

If it is not, you will need to run CMake again, making sure that the code in add_boost.cmake is not commented out (I think we commented yours out at some point?). If you're not sure about this, just copy the add_boost.cmake (Tudat/External/CMake) from the Tudat repository into your files. Make sure to save the old one just to make sure

Dominic

@mvandenbroeck
Copy link
Member Author

Hi Dominic,

After implementing your feedback and commenting out the applications of which the filenames are too long for Windows, it finally builds!

Thank you for all your help!

Michael

@DominicDirkx
Copy link
Member

Great!

@jesperspillenaar
Copy link

Hi Dominic,

My problems seems to be similar. I get thousands of build errors whenever I try to build any of the applications in the tudatBundle/pagmo folder. (The applications 'my_pagmo_problems' and 'pagmo_static' do build).

The errors all have some reference to the serialization library as far as I understand. See for the compile output:

https://github.com/jesperspillenaar/tudatBundle/blob/SpacePlane-develop/questionFiles/Compile%20output

However, in my boost/stage/lib folder I do see the following folder: 'libboost_serialization-mt.a'. Furthermore nothing seems to be commented in the the code in add_boost.cmake.

Any idea how to solve this?

Jesper

@DominicDirkx
Copy link
Member

Hi Jesper,

Did you try to apply the changes that seemed to work above for Michael. Changing the order of the pagmo link libraries may resolve the issue. If it doesn't, please attach the location of the boost libraries that are being used in the Pagmo CMakeLists,

Dominic

@jesperspillenaar
Copy link

Hi Dominic,

All changes combined, including swapping the Eigen folder discussed in #99 have eventually fixed all errors. Thanks for the help!

Jesper

@DominicDirkx
Copy link
Member

Great!

@FrankHogervorst
Copy link
Contributor

Hi Dominic,

I've got similar problems. The application in the pagmo folder are working but when I try to build the examples in libraryExamples/PaGMOEx/ i get nearly 1000 errors which all seems to do with serialization.

I already did the following in the PaGMOEx folder:

  • Changed the order of the linking.
  • Changed boost version in all CMakeLists to 1.60 (which I am using)
  • Swapped the Eigen folder.

Boost libraries used by CMake inside the PaGMOEx folder:
C:/tudatBundle/boost/stage/lib/libboost_thread-mt.a
C:/tudatBundle/boost/stage/lib/libboost_date_time-mt.a
C:/tudatBundle/boost/stage/lib/libboost_system-mt.a
C:/tudatBundle/boost/stage/lib/libboost_serialization-mt.a
C:/tudatBundle/boost/stage/lib/libboost_filesystem-mt.a
C:/tudatBundle/boost/stage/lib/libboost_regex-mt.a

Boost libraries used by CMake inside the pagmo folder:
C:/tudatBundle/boost/stage/lib/libboost_system-mt.dll;
C:/tudatBundle/boost/stage/lib/libboost_serialization-mt.dll;
C:/tudatBundle/boost/stage/lib/libboost_thread-mt.dll

The CMakeList file: CMakeLists.txt
Compile output: compileoutput.txt

@DominicDirkx
Copy link
Member

Can you try building the pagmo example? Not the Tudat one, but the main in the Pagmo folder. Does this go correctly?

@FrankHogervorst
Copy link
Contributor

FrankHogervorst commented Apr 26, 2017

That one builts correctly.

However, it does not run.
If I run the exe file it says:
The program can't start because:
libgcc_s_dw2-1.dll
libboost_serialization-mt.dll
libboost_thread-mt.dll
libstdc++-6.dll
are missing from my computer.

@FrankHogervorst
Copy link
Contributor

The same holds for the examples in the pagmo folder, they do build but I can't run them because of missing dll files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants