Question about CMake and Boost

Get help with programming issues.

Moderator: PPS-Leaders

User avatar
superegg
Human Space Navy Major
Posts: 41
Joined: Mon Oct 08, 2007 2:41 pm

Question about CMake and Boost

Post by superegg » Sun Jan 11, 2009 6:18 am

As I tried to integrate CMake for Mac, the following problem remains unsolved:

I placed Boost Folder to MY_PATH, then added:

SET(Boost_INCLUDE_DIR "MY_PATH/boost_1_33_1")

to CMakeLists.txt

Now although Cmake can find the include (well, it doesnt say anymore that boost was not found), but following errors occur:

CMake Error: Boost thread library was not found.
CMake Error: Boost filesystem library was not found.

But the libraries are in the libs folder under MY_PATH/boost_1_33_1.....

Has somebody else got this problem as well?
Image

User avatar
x3n
Baron Vladimir Harkonnen
Posts: 810
Joined: Mon Oct 30, 2006 5:40 pm
Contact:

Post by x3n » Sun Jan 11, 2009 1:03 pm

Hi superegg, nice to see you again ;)

Boost_INCLUDE_DIR only defines the location to search for header files, not for libraries. You can try to add the following lines:

Code: Select all

SET(
Boost_filesystem_LIBRARY "MY_PATH/boost_1_33_1/boost_filesystem-mgw34-mt-1_34_1.dll")
SET(Boost_thread_LIBRARY "MY_PATH/boost_1_33_1/boost_thread-mgw34-mt-1_34_1.dll")
In your case, the name of the libraries will probably be different, just look for boost_filesystem* and boost_thread*.


The other possibility (which is theoretically the nicer solution) is to add MY_PATH/boost_1_33_1 in trunk/cmake/FindBoost.cmake in the directory-list at line 120:

Code: Select all

109 #
110 # Look for an installation.
111 #
112 FIND_PATH(Boost_INCLUDE_DIR NAMES boost/config.hpp PATH_SUFFIXES ${SUFFIX_FOR_PATH} PATHS
113
114 # Look in other places.
115   ${BOOST_DIR_SEARCH}
116
117 #    ../libs/boost_1_33_1
118     ../libs/boost_1_34_1
119 #    ../libs/boost-1_35_0
120     MY_PATH/boost_1_33_1
121     ${DEPENDENCY_DIR}/boost-1.35.0/include
122
123 # Help the user find it if we cannot.
124   DOC "The ${BOOST_INCLUDE_PATH_DESCRIPTION}"
125 )
This should (again theoretically) solve all your problems, because it allows cmake to find your header files AND your libraries, so you don't have to add SET(var "...") anymore. Maybe you have to do further changes, for example at line 181 in the "List of library suffixes".

I really hope it works on Mac, that would be great. :D
Fabian 'x3n' Landau, Orxonox developer

User avatar
beni
Baron Vladimir Harkonnen
Posts: 949
Joined: Tue Oct 03, 2006 9:15 am
Location: Zurich
Contact:

Post by beni » Sun Jan 11, 2009 5:38 pm

Don't forget to commit the changes, when you are using the second version to solve the problem.
"I'm Commander Shepard and this is my favorite forum on the internet."

User avatar
1337
Baron Vladimir Harkonnen
Posts: 521
Joined: Wed Oct 10, 2007 7:59 am

Post by 1337 » Sun Jan 11, 2009 10:19 pm

Hey Chai, nice to hear you're looking for a Mac build! I'm currently myself a little bit occupied with CMake. Adi has rewritten a lot of code and I'm currently extending some parts.

My focus is implementing the CMake Visual Studio generator and for about fifteen minutes, it's actually working completely including run. It generates everything and even orxonox.ini gets configured with the media path, the plugins folder and the right plugins (debug/release have different names). CMake also checks for each plugin whether it exists.

All that is done in the buildsystem2 branch. I will make about two to four commits (depending on what I can separate) tomorrow. I highly recommend to you to switch to that branch and make a new file in the cmake folder called "ConfigXCode" or "ConfigMac" (if it is not xcode specific). Best thing is if you make a copy of "ConfigMSVC.cmake" or "ConfigMinGW.cmake".

The branch also uses CMake 2.6, so be sure to update cmake.

I have seen that there is a lot of mac specific code in the the CMake doc page:
http://www.cmake.org/cmake/help/cmake-2.6.html
Maybe that can help, just search for "mac" and read on.

Hope that makes things easier (Adi has simplified and generalised A LOT).
http://www.xkcd.com/
A webcomic of romance, sarcasm, math, and language.

User avatar
superegg
Human Space Navy Major
Posts: 41
Joined: Mon Oct 08, 2007 2:41 pm

Post by superegg » Tue Jan 13, 2009 12:25 am

@x3n

I tried by setting the two libs explicitly using SET function, but it still doesnt work. Since boost ist totally interface independent and you dont have to compile it before running, that means, all boost folder should be the same, WHERE do you have these .dll files?

I know that Boost_INCLUDE_DIR only defines the location to search for header files, not for libraries, if I understood FINDboost.cmake correctly, it should look for the libs by using the same PATH and searching for a folder named "lib", I DO have this folder, why it cannot find the libs..... quite confusing. And why it can find all libs only except thread and filesystem?

Anyway, I just wanted to ask you guys whether you also got this problem by cmaking the project. Well if not, I will probably continue randomly trying.....
Image

User avatar
1337
Baron Vladimir Harkonnen
Posts: 521
Joined: Wed Oct 10, 2007 7:59 am

Post by 1337 » Tue Jan 13, 2009 8:29 am

superegg wrote: I tried by setting the two libs explicitly using SET function, but it still doesnt work. Since boost ist totally interface independent and you dont have to compile it before running, that means, all boost folder should be the same, WHERE do you have these .dll files?
What exactly do you mean with "interface independant"? As a matter of fact you have to compile the boost libs first unless you got yourself the binaries, which is actually quite likely.
superegg wrote: I know that Boost_INCLUDE_DIR only defines the location to search for header files, not for libraries, if I understood FINDboost.cmake correctly, it should look for the libs by using the same PATH and searching for a folder named "lib", I DO have this folder, why it cannot find the libs..... quite confusing. And why it can find all libs only except thread and filesystem?
Very good question indeed. FindBoost does look in quite a few directories in the vicinity of the Boost_INCLUDE_DIR.
But as I said, your work might be in vain, because the buildsystem2 branch uses CMake 2.6 which comes with a completely new version of FindBoost. Adi tried to keep as many find script with CMake as possible (Boost, Tcl, Lua, zlib). That means they're not anymore in our cmake folder.
Furthermore it is now forbidden (by principle) to specify your own paths in the find scripts. Simply set the right $ENV{} variables and let the scripts do the work. If that is not possible, you have to set the variables, like ENET_LIBRARY directly (that was necessary with a few libs for MinGW and MSVC).
superegg wrote: Anyway, I just wanted to ask you guys whether you also got this problem by cmaking the project. Well if not, I will probably continue randomly trying.....
CMake is not exactly easy to use. It took me a few week of quite intensive work to get things straight. Nevertheless that work shall not have been in vain: Our new build system is easier to use.

Again, I would like to encourage you to use the buildsytem2 branch because otherwise you most certainly have to do all the work twice. We really swept the whole library finding stuff. It was very hacky before, and that required some work to be done. Fortunately, Adi brought serious knowledge about CMake to Orxonox. And I was able to build a few other things on top of that.
http://www.xkcd.com/
A webcomic of romance, sarcasm, math, and language.

User avatar
beni
Baron Vladimir Harkonnen
Posts: 949
Joined: Tue Oct 03, 2006 9:15 am
Location: Zurich
Contact:

Post by beni » Tue Jan 13, 2009 9:18 am

I may very well be an optimist here, but with the CMake cleanup it might even be more likely, that it'll work with Mac out of the box (or with very little adjustments).
So I suggest to follow 1337's advice and just try that branch, maybe some issues are solved already.
And since that will be our new build system anyway, you better use that branch.
"I'm Commander Shepard and this is my favorite forum on the internet."

User avatar
1337
Baron Vladimir Harkonnen
Posts: 521
Joined: Wed Oct 10, 2007 7:59 am

Post by 1337 » Tue Jan 13, 2009 10:42 am

"out-of-the-box" might really be a little bit too optimistic ^^
The main problem is most likely the Mac bundle thing stuff whatever. I don't know what it is, but it is required anyway. There are lots of extra commands and options for that on the CMake documentation page.

But yes, I agree that library finding and configuration stuff should be easier. It took my probably about half the time to implement real visual studio support than with the build system from the trunk.
http://www.xkcd.com/
A webcomic of romance, sarcasm, math, and language.

User avatar
x3n
Baron Vladimir Harkonnen
Posts: 810
Joined: Mon Oct 30, 2006 5:40 pm
Contact:

Post by x3n » Tue Jan 13, 2009 12:47 pm

@superegg:

To check out the buildsystem2 branch, use

Code: Select all

svn co https://svn.orxonox.net/orxonox/branches/buildsystem2
If you still want to get the trunk running, please tell us the exact name and the relative path of your thread and filesystem libraries, maybe boost uses different names on mac or whatever. CMake isn't that clever, in fact it just searches some predefined paths for some predefined filenames. If there is no exact match, the whole system doesn't work, although the name of the right library may be only one version number apart or it is located in an additional subfolder.
Fabian 'x3n' Landau, Orxonox developer

User avatar
superegg
Human Space Navy Major
Posts: 41
Joined: Mon Oct 08, 2007 2:41 pm

Post by superegg » Tue Jan 13, 2009 1:56 pm

What exactly do you mean with "interface independant"? As a matter of fact you have to compile the boost libs first unless you got yourself the binaries, which is actually quite likely.
I wanted to say "platform independent".

I read this on the boost website, thats why I thought there is nothing to build:
The first thing many people want to know is, “how do I build Boost?” The good news is that often, there's nothing to build.
Anyway, I missed the following sentense:
The only Boost libraries that must be built separately are: Filesystem, Thread, blabla.....
Thats why only filesystem and thread were not found.

Well, I will try the branche this evening then.

Thx for answers
Image

User avatar
superegg
Human Space Navy Major
Posts: 41
Joined: Mon Oct 08, 2007 2:41 pm

Post by superegg » Wed Jan 14, 2009 12:05 am

The new version cannot find /etc/hostname. I think this warning (or error) should appear on all computers except tardis. right?

Anyway, which CMakeList says: Configuring incomplete, errors eccored! ?
Image

User avatar
greenman
Baron Vladimir Harkonnen
Posts: 360
Joined: Wed Oct 03, 2007 2:53 pm
Contact:

Post by greenman » Wed Jan 14, 2009 8:27 am

i don't get this error

/etc/hostname exists probably on all linux distributions, but as it seems like not on mac (which is a unix). so the easiest way for you is to just create this file and make sure there is nothing like "tardis" in it.

we will have to replace IF(UNIX) ... in cmake/ConfigTardis.cmake to make sure mac doesn't get affected by it ... what is the easiest way to identify your system as a mac and seperate it from other unixes ?
There are only 10 types of people in the world: Those who understand binary, and those who don't.

User avatar
beni
Baron Vladimir Harkonnen
Posts: 949
Joined: Tue Oct 03, 2006 9:15 am
Location: Zurich
Contact:

Post by beni » Wed Jan 14, 2009 8:33 am

Well, I guess the easiest way is to do

Code: Select all

$ uname -m
> Power Macintosh
or

Code: Select all

$ uname -s
> Darwin
I tried this on my Power PC at work.

There is no command or file /etc/hostname, but I think I also don't have this on my Ubuntu, but I can be wrong.
"I'm Commander Shepard and this is my favorite forum on the internet."

User avatar
greenman
Baron Vladimir Harkonnen
Posts: 360
Joined: Wed Oct 03, 2007 2:53 pm
Contact:

Post by greenman » Wed Jan 14, 2009 8:36 am

i just had a look at the cmake documentation and as it seems like we can just use APPLE to identify mac os x.
so we would have to change this to IF(UNIX AND NOT APPLE)
please correct me if i'm wrong

try it out and if it works please post or commit ;)

edit: maybe you have to repeat this step on other locations too... but i would first replace the occurence in ConfigTardis.cmake and then see if it works
There are only 10 types of people in the world: Those who understand binary, and those who don't.

User avatar
1337
Baron Vladimir Harkonnen
Posts: 521
Joined: Wed Oct 10, 2007 7:59 am

Post by 1337 » Wed Jan 14, 2009 9:00 am

There is a section about system detection on the CMake documentation:
http://www.cmake.org/cmake/help/cmake-2 ... e%20System
http://www.xkcd.com/
A webcomic of romance, sarcasm, math, and language.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest