Statistics | We have 1675 registered users The newest registered user is dejo123
Our users have posted a total of 30851 messages in 1411 subjects
|
Who is online? | In total there are 38 users online :: 0 Registered, 0 Hidden and 38 Guests None Most users ever online was 443 on Sun Mar 17, 2013 5:41 pm |
Latest topics | » THIS FORUM IS NOW OBSOLETE by NickTheNick Sat Sep 26, 2015 10:26 pm
» To all the people who come here looking for thrive. by NickTheNick Sat Sep 26, 2015 10:22 pm
» Build Error Code::Blocks / CMake by crovea Tue Jul 28, 2015 5:28 pm
» Hello! I can translate in japanese by tjwhale Thu Jul 02, 2015 7:23 pm
» On Leave (Offline thread) by NickTheNick Wed Jul 01, 2015 12:20 am
» Devblog #14: A Brave New Forum by NickTheNick Mon Jun 29, 2015 4:49 am
» Application for Programmer by crovea Fri Jun 26, 2015 11:14 am
» Re-Reapplication by The Creator Thu Jun 25, 2015 10:57 pm
» Application (programming) by crovea Tue Jun 23, 2015 8:00 am
» Achieving Sapience by MitochondriaBox Sun Jun 21, 2015 7:03 pm
» Microbe Stage GDD by tjwhale Sat Jun 20, 2015 3:44 pm
» Application for Programmer/ Theorist by tjwhale Wed Jun 17, 2015 9:56 am
» Application for a 3D Modeler. by Kaiju4u Wed Jun 10, 2015 11:16 am
» Presentation by Othithu Tue Jun 02, 2015 10:38 am
» Application of Sorts by crovea Sun May 31, 2015 5:06 pm
» want to contribute by Renzope Sun May 31, 2015 12:58 pm
» Music List Thread (Post New Themes Here) by Oliveriver Thu May 28, 2015 1:06 pm
» Application: English-Spanish translator by Renzope Tue May 26, 2015 1:53 pm
» Want to be promoter or project manager by TheBudderBros Sun May 24, 2015 9:00 pm
» A new round of Forum Revamps! by Oliveriver Wed May 20, 2015 11:32 am
|
|
| CmakeLists is not linking to boost_system correctly | |
| | Author | Message |
---|
liminal18 Newcomer
Posts : 20 Reputation : 1 Join date : 2012-10-25
| Subject: CmakeLists is not linking to boost_system correctly Sun Aug 25, 2013 12:06 am | |
| Hey Folks,
Just thought I'd give this a shot there... not sure if I should post in support or programming, but programming seems better. I am trying to compile an example program in ogre 3d. here is the cmakelist:
cmake_minimum_required(VERSION 2.6)
SET(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "C:/Boost") SET(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "C:/Boost/lib") SET(EXTERNAL_DEPS $(EXTERNAL_DEPS) "C:/Users/Andrew/Downloads/OgreSDK_MinGW_v1-8-1/bin/release") FIND_PACKAGE(Boost) SET (BOOST_LIBRARY_PATH ${BOOST_LIBRARIES} "C:/Boost/lib") SET (CMAKE_LIBRARY_PATH ${boost_system} "C:/Boost/") IF (Boost_FOUND) INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIR}) ADD_DEFINITIONS( "-DHAS_BOOST" ) set (BLIBS $(BLIBS) $(Boost_LIBRARIES)) find_package(Boost REQUIRED)
# Set up referencing of Boost include_directories(${Boost_INCLUDE_DIR}) add_definitions(-DBOOST_ALL_NO_LIB) set(OGRE_LIBRARIES ${OGRE_LIBRARIES} ${Boost_LIBRARIES}) ENDIF() function(add_sources) get_property(is_defined GLOBAL PROPERTY SRCS_LIST DEFINED) if(NOT is_defined) define_property(GLOBAL PROPERTY SRCS_LIST BRIEF_DOCS "List of source files" FULL_DOCS "List of source files to be compiled in one library") endif() # make absolute paths set(SRCS) foreach(s IN LISTS ARGN) if(NOT IS_ABSOLUTE "${s}") get_filename_component(s "${s}" ABSOLUTE) endif() list(APPEND SRCS "${s}") endforeach() # append to global list set_property(GLOBAL APPEND PROPERTY SRCS_LIST "${SRCS}") endfunction(add_sources)
PROJECT(ogre3dtut) if (WIN32) set(EXECUTABLE_OUTPUT_PATH bin/${CMAKE_BUILD_TYPE}) FILE(GLOB SRCS *.cpp) FILE(GLOB HDRS *.h) ADD_EXECUTABLE(ogre3dtut ${SRCS} ${HDRS} ) INCLUDE_DIRECTORIES( C:/Users/Andrew/Downloads/OgreSDK_MinGW_v1-8-1/include C:/Users/Andrew/Downloads/OgreSDK_MinGW_v1-8-1/include/OGRE C:/Users/Andrew/Downloads/OgreSDK_MinGW_v1-8-1/boost/boost C:/Users/Andrew/Downloads/OgreSDK_MinGW_v1-8-1/bin/release C:/Users/Andrew/Downloads/OgreSDK_MinGW_v1-8-1/bin/debug ) LINK_DIRECTORIES( C:/Boost C:/Boost/lib C:/Users/Andrew/Downloads/OgreSDK_MinGW_v1-8-1/lib/debug C:/Users/Andrew/Downloads/OgreSDK_MinGW_v1-8-1/lib/Release C:/Users/Andrew/Downloads/OgreSDK_MinGW_v1-8-1/bin/release C:/Users/Andrew/Downloads/OgreSDK_MinGW_v1-8-1/bin/debug ) TARGET_LINK_LIBRARIES( ogre3dtut general opengl32.lib debug C:/Users/Andrew/Downloads/00_SimplestBeginning/src/00_SimplestBeginning/OgreMain_d.dll debug C:/Users/Andrew/Downloads/00_SimplestBeginning/src/00_SimplestBeginning/OIS_d.dll optimized C:/Users/Andrew/Downloads/00_SimplestBeginning/src/00_SimplestBeginning/OgreMain.dll optimized C:/Users/Andrew/Downloads/00_SimplestBeginning/src/00_SimplestBeginning/OIS.dll boost_system ${BOOST_LIBRARIES} ) else (WIN32)
# this was reported to work on linux set(CMAKE_MODULE_PATH /usr/local/lib/OGRE/cmake ) FIND_PACKAGE(OpenGL) FIND_PACKAGE(OGRE) FIND_PACKAGE(OIS) INCLUDE_DIRECTORIES( ${OpenGL_INCLUDE_DIR} ${OGRE_INCLUDE_DIRS} ${OIS_INCLUDE_DIRS} ${PROJECT_SOURCE_DIR}/include ) FILE(GLOB SRCS *.cpp) FILE(GLOB HDRS *.h) ADD_EXECUTABLE(ogre3dtut ${SRCS} ${HDRS} ) SET (OIS_LIBRARY_PATH ${OIS_LIBRARIES}"C:/Users/Andrew/Downloads/00_SimplestBeginning/src/00_SimplestBeginning/bin") SET (OGRE_LIBRARY_PATH ${OGRE_LIBRARIES}"C:/Users/Andrew/Downloads/00_SimplestBeginning/src/00_SimplestBeginning/bin") TARGET_LINK_LIBRARIES(ogre3dtut ${OpenGL_LIBRARIES} ${OIS_LIBRARIES} ${OGRE_LIBRARIES} ) endif ()
it configures and generates just fine in cmake-gui and even shows that i have boost 1.5.2 installed however mingw32-make gives this error:
Linking CXX executable bin\ogre3dtut.exe c:/mingw/bin/../lib/gcc/mingw32/4.7.2/../../../../mingw32/bin/ld.exe: cannot fin d -lboost_system collect2.exe: エラー: ld はステータス 1 で終了しました CMakeFiles\ogre3dtut.dir\build.make:91: recipe for target 'bin/ogre3dtut.exe' fa iled mingw32-make[2]: *** [bin/ogre3dtut.exe] Error 1 CMakeFiles\Makefile2:62: recipe for target 'CMakeFiles/ogre3dtut.dir/all' failed
mingw32-make[1]: *** [CMakeFiles/ogre3dtut.dir/all] Error 2 Makefile:74: recipe for target 'all' failed mingw32-make: *** [all] Error 2
has anyone in windows successfully managed to link to boost_system? Was going to try install in cmakelists and possibly adding another path variable, but thought I would ask here first. | |
| | | liminal18 Newcomer
Posts : 20 Reputation : 1 Join date : 2012-10-25
| Subject: Re: CmakeLists is not linking to boost_system correctly Sun Aug 25, 2013 1:29 am | |
| tried adding a path variable with the name boost_system and that didn't work. adding the boost directory to mingw's dir also hasn't worked so far. man ld in windows... ok well work continues. | |
| | | Seregon Regular
Posts : 263 Reputation : 37 Join date : 2011-08-10 Location : UK
| Subject: Re: CmakeLists is not linking to boost_system correctly Sun Aug 25, 2013 1:52 pm | |
| I remember having all sorts of issues linking to boost when I tried this last year. I can't remember exactly what I did, but in the end I think I resorted to printing where CMake expected boost to be (Boost_INCLUDE_DIR) from inside the script, then moving all the built boost files there, as it didn't seem to listen to any environment variables I set. Incase it helps, here's my Find Boost section (somewhat modified from the ogre tuts): - Spoiler:
- Code:
-
set(Boost_Dir $ENV{BOOST_ROOT}) if (NOT OGRE_BUILD_PLATFORM_IPHONE) if (WIN32 OR APPLE) set(Boost_USE_STATIC_LIBS TRUE) else () # Statically linking boost to a dynamic Ogre build doesn't work on Linux 64bit set(Boost_USE_STATIC_LIBS ${OGRE_STATIC}) endif () if (MINGW) # this is probably a bug in CMake: the boost find module tries to look for # boost libraries with name libboost_*, but CMake already prefixes library # search names with "lib". This is the workaround. set(CMAKE_FIND_LIBRARY_PREFIXES ${CMAKE_FIND_LIBRARY_PREFIXES} "") endif ()
set(Boost_ADDITIONAL_VERSIONS "1.44" "1.44.0" "1.42" "1.42.0" "1.41.0" "1.41" "1.40.0" "1.40" "1.39.0" "1.39" "1.38.0" "1.38" "1.37.0" "1.37" ) # Components that need linking (NB does not include header-only components like bind) set(OGRE_BOOST_COMPONENTS thread date_time system) find_package(Boost 1.51 COMPONENTS ${OGRE_BOOST_COMPONENTS} REQUIRED)
if (NOT Boost_FOUND) # Try again with the other type of libs set(Boost_USE_STATIC_LIBS NOT ${Boost_USE_STATIC_LIBS}) find_package(Boost COMPONENTS ${OGRE_BOOST_COMPONENTS} REQUIRED) message("${Boost_FOUND}, ${Boost_DIR}")
endif() find_package(Boost REQUIRED)
# Set up referencing of Boost include_directories(${Boost_INCLUDE_DIR}) add_definitions(-DBOOST_ALL_NO_LIB) set(OGRE_LIBRARIES ${OGRE_LIBRARIES} ${Boost_LIBRARIES}) endif()
and a FindBoost.cmake module I found somewhere... I'm really not sure if I used this or not in the end (warning - very long spoiler): pastebin link as this was too long for the forum Sorry I can't help more, it's been far too long since I've looked at this to know exactly what I did. Nimbal set up an automated build system for us which seems far more effective than what I'd done, so he may be able to help (or check out his/thrives git repo). | |
| | | Nimbal Programming Team lead
Posts : 258 Reputation : 24 Join date : 2013-03-17 Age : 40 Location : Ratingen, Germany
| Subject: Re: CmakeLists is not linking to boost_system correctly Mon Aug 26, 2013 3:21 am | |
| There are several issues that could cause the linking error. First, this link command looks suspicious: - Code:
-
TARGET_LINK_LIBRARIES( [...] boost_system ${BOOST_LIBRARIES} )
Usually, you wouldn't add boost_system manually, it should be contained in BOOST_LIBRARIES already. Second, have you tried printing out BOOST_LIBRARIES to check whether it contains anything at all? I'd bet that it's empty, because the FindBoost module sets the variable Boost_LIBRARIES and CMake is case-sensitive for variable names. Third, try invoking find_package like this: - Code:
-
find_package(Boost COMPONENTS system REQUIRED)
Lastly, if FindBoost actually finds something, it should print something like this during configuration: - Code:
-
-- Boost version: 1.52.0 -- Found the following Boost libraries: -- chrono -- date_time -- filesystem -- thread -- system
Oh, and one last question, just to be safe: You have compiled Boost, right? | |
| | | liminal18 Newcomer
Posts : 20 Reputation : 1 Join date : 2012-10-25
| Subject: Re: CmakeLists is not linking to boost_system correctly Mon Aug 26, 2013 8:00 am | |
| First thank you for both of the responses, I am about to try Nimbal's idea right now. Sergeon I actually have your old cmakelists file and copied a few things from it.
TARGET_LINK_LIBRARIES( [...] boost_system ${BOOST_LIBRARIES} )
this was actually added after getting the error to see if setting a variable named boost_system might do something. I will remove it.
Lastly, if FindBoost actually finds something, it should print something like this during configuration:
Code:
-- Boost version: 1.52.0
Mine only prints out that first line, I am not seeing the other components, will check again in a second though. | |
| | | liminal18 Newcomer
Posts : 20 Reputation : 1 Join date : 2012-10-25
| Subject: Re: CmakeLists is not linking to boost_system correctly Mon Aug 26, 2013 8:04 am | |
| and the new error is:
Boost version: 1.52.0 CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly. Missing variable is: CMAKE_FIND_LIBRARY_PREFIXES CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly. Missing variable is: CMAKE_FIND_LIBRARY_SUFFIXES CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly. Missing variable is: CMAKE_FIND_LIBRARY_PREFIXES CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly. Missing variable is: CMAKE_FIND_LIBRARY_SUFFIXES CMake Error at C:/Program Files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:1192 (message): Unable to find the requested Boost libraries.
Boost version: 1.52.0
Boost include path: C:/Boost
The following Boost libraries could not be found:
boost_system
No Boost libraries were found. You may need to set BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT to the location of Boost. Call Stack (most recent call first): CMakeLists.txt:13 (find_package)
Configuring incomplete, errors occurred! | |
| | | liminal18 Newcomer
Posts : 20 Reputation : 1 Join date : 2012-10-25
| Subject: Re: CmakeLists is not linking to boost_system correctly Mon Aug 26, 2013 8:12 am | |
| I really need to go through a tutorial on cmakelists before asking any more questions, I believe I set the variables using:
SET (BOOST_LIBRARYDIR ${BOOST_LIBRARYDIR} "C:/Boost/lib")
but the ${foo} variable is a cache variable or something? | |
| | | liminal18 Newcomer
Posts : 20 Reputation : 1 Join date : 2012-10-25
| Subject: Re: CmakeLists is not linking to boost_system correctly Mon Aug 26, 2013 8:31 am | |
| ok solved part of it, you can not call find_package() before project()
so now getting:
Boost version: 1.52.0 CMake Error at C:/Program Files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:878 (file): file FILE([TO_CMAKE_PATH|TO_NATIVE_PATH] path result) must be called with exactly three arguments. Call Stack (most recent call first): CMakeLists.txt:18 (find_package)
Boost version: 1.52.0 Found the following Boost libraries: system Configuring incomplete, errors occurred!
BTW yes I believe I compiled Boost, i remember bjam.bat and my boost directory is 1 gig, however it might have compiled incorrectly.
Last edited by liminal18 on Mon Aug 26, 2013 8:35 am; edited 1 time in total | |
| | | Nimbal Programming Team lead
Posts : 258 Reputation : 24 Join date : 2013-03-17 Age : 40 Location : Ratingen, Germany
| Subject: Re: CmakeLists is not linking to boost_system correctly Mon Aug 26, 2013 8:34 am | |
| Is this line - Code:
-
SET (BOOST_LIBRARYDIR ${BOOST_LIBRARYDIR} "C:/Boost/lib")
still in your CMakeLists.txt? If yes, this could be the cause of the error, because FindBoost expects BOOST_LIBRARYDIR to be a single value, not a list of values. | |
| | | liminal18 Newcomer
Posts : 20 Reputation : 1 Join date : 2012-10-25
| Subject: Re: CmakeLists is not linking to boost_system correctly Mon Aug 26, 2013 8:37 am | |
| - Nimbal wrote:
- Is this line
- Code:
-
SET (BOOST_LIBRARYDIR ${BOOST_LIBRARYDIR} "C:/Boost/lib")
still in your CMakeLists.txt? If yes, this could be the cause of the error, because FindBoost expects BOOST_LIBRARYDIR to be a single value, not a list of values. LOL! You solved it. I am really sorry, I need to learn a little more about the problems firsts. anyways, about to generate we'll see. | |
| | | liminal18 Newcomer
Posts : 20 Reputation : 1 Join date : 2012-10-25
| Subject: Re: CmakeLists is not linking to boost_system correctly Mon Aug 26, 2013 8:39 am | |
| and i am getting this:
C:\Users\Andrew\Downloads\00_SimplestBeginning\src\00_SimplestBeginning\bin>ming w32-make Linking CXX executable bin\ogre3dtut.exe CMakeFiles\ogre3dtut.dir/objects.a(main.cpp.obj):main.cpp:(.text+0xad0): undefin ed reference to `boost::system::generic_category()' CMakeFiles\ogre3dtut.dir/objects.a(main.cpp.obj):main.cpp:(.text+0xada): undefin ed reference to `boost::system::generic_category()' CMakeFiles\ogre3dtut.dir/objects.a(main.cpp.obj):main.cpp:(.text+0xae4): undefin ed reference to `boost::system::system_category()' c:/mingw/bin/../lib/gcc/mingw32/4.7.2/../../../../mingw32/bin/ld.exe: CMakeFiles \ogre3dtut.dir/objects.a(main.cpp.obj): bad reloc address 0xe in section `.text$ _ZN5boost6system14error_categoryD1Ev[__ZN5boost6system14error_categoryD1Ev]' collect2.exe: エラー: ld はステータス 1 で終了しました CMakeFiles\ogre3dtut.dir\build.make:91: recipe for target 'bin/ogre3dtut.exe' fa iled mingw32-make[2]: *** [bin/ogre3dtut.exe] Error 1 CMakeFiles\Makefile2:62: recipe for target 'CMakeFiles/ogre3dtut.dir/all' failed
mingw32-make[1]: *** [CMakeFiles/ogre3dtut.dir/all] Error 2 Makefile:74: recipe for target 'all' failed mingw32-make: *** [all] Error 2
but the boost_system error is gone. will google these errors etc in a little. my boost compile might be bad. BTW is it possibly because I have boost 1.5.2 and the tutorial was written for an older boost?
hmm according to stack overflow I need to link in boost_system... | |
| | | liminal18 Newcomer
Posts : 20 Reputation : 1 Join date : 2012-10-25
| Subject: Re: CmakeLists is not linking to boost_system correctly Mon Aug 26, 2013 8:53 am | |
| ok well my other ogre tutorial, the updated clean ogre cmake project just made it through make with no errors. I just to replace the included find_package with the one you gave me, but it threw an error during mingw32-make install it can't find a .DLL so i will try to find it and copy it where it wants it.
and OgreApp.exe compiled! it gives an error though that OIS.dll is not installed on my computer? so many problems with OIS
and it kinda sorta works. open to a window that asks if i want to use Directx or OpenGL neither one though when it goes fullscreen actually displays the ogre head, it does show the fps and such.
THANK YOU! BTW for the help tonight. It was really amazing to actually compile a c++ project on my own pc. | |
| | | Sponsored content
| Subject: Re: CmakeLists is not linking to boost_system correctly | |
| |
| | | | CmakeLists is not linking to boost_system correctly | |
|
| Permissions in this forum: | You cannot reply to topics in this forum
| |
| |
| |