![]() |
Boost Libraries on OS X?
1 Attachment(s)
I really have problems installing Boost libraries on OS X. Seems like it has no support at all!
Here's what I did. I downloaded the source for 1.34.1 and I tried compiling it like this: -I opened the terminal and typed "cd /Users/soulstorm/Desktop/boost_1_34_1/" -I typed "./configure" -A makefile was created. -I typed "make install" -I waited for a long time, since the terminal was compiling the project -I got this result: :
...failed updating 1 target...I am attaching the full terminal output below. Why is that? Seems I am a newbie at this... Can anyone who has successfully compiled the damn thing tell me what should I see as a result and what should I do with it? Has anyone managed to compile boost on OS X? |
looks to me like it's having a hard time getting to /usr/local/include/boost-1_34_1
|
Try "sudo make install".
|
Thanks titaniumdecoy, that worked.
That created an include folder inside usr/local and a lib folder in the same location. But now, how do I load those dynamic libraries in Xcode? Do I need to do some special configuration? I tried typing "#include <boost/regex.hpp>" but I got an error of a missing file, while the file is there, in usr/local/include/boost_1_34_1/boost/regex.hpp ! Any help? |
So far I have only been able to get the headers that do not require compilation to work in Xcode (which do not include boost/regex.hpp).
I don't have time to go into detail at the moment, but suffice to say, I had to move the boost_1_34_1 folder (which you ran "./configure" and "make install" inside of) to /usr/local. Then, use the command :
g++ filename.cpp -I /usr/local/boost_1_34_1 -o filename |
Quote:
:
$ ls /usr/lib | grep boost:
g++ -I/usr/include/boost_whatever_version -lboost_regex file.cpp -o file |
Thank you, Jessekh! You have saved me many hours of tinkering. :)
@Soulstorm: I will post more detailed instructions as soon as I have the time. |
So:
The easiest way to move the boost_1_34_1 folder from your desktop to /usr/local (aside from the mv command) is to select "Go To Folder..." from the Go menu in the Finder (or type Cmd-Shift-G) and enter "/usr/local" (no quotes). Drag the boost_1_34_1 folder into this folder; enter your password at the prompt. To compile source files from the Terminal, cd into the appropriate folder, then use the g++ command as described in previous posts in this thread. For a list of compiled headers you can include with the -l flag, type "ls /usr/local/lib | grep boost". I have, with much difficulty, created an Xcode template that I have linked to at the bottom of this post. (Documentation on creating an Xcode template does not seem to exist.) Regardless, unzip the file and drag the resulting folder to "/Library/Application Support/Apple/Developer Tools/Project Templates/Command Line Utility". Start up Xcode, create a new project and select "C++ Tool with Boost Libraries" from the "Command Line Utility" selection. You will see that the project includes a Makefile, inside of which you will find the g++ command to which you can add "-l boost_regex" or whatever else. If it doesn't work, please let me know and I will do my best to get it working for you. :) Download Boost Template for Xcode (Requires Mac OS X 10.4) |
Thanks for taking the time to answer, and for trying to figure out what's going on with boost on OS X. Unfortunately, the guys there at Boost do not have a clue as to how to write a decent documentation. They say that Boost was tested on Apple's Xcode... but they don't mention how they managed to install it. I posted my question into other forums as well, no one seems to know the answer.
Actually, the files are already in the correct position. But Unfortunately the template did not work for me. All I did was to make a project using the template, then try the following code: :
#include <iostream>:
all: *.cppDo I need to set any command line variable, or what? And, thanks again for helping me. |
I don't know about using the Xcode project template, but boost certainly works with Xcode. It works fine with our CMake generated Xcode projects which use Boost. Xcode, like most IDEs, just wraps up the compiler command line in a pretty interface. If you know how to use the compiler from the command line this will all make more sense to you.
For gcc the "-I/some/location/with/headers" tells the compiler where it can find headers. The "-L/some/location/with/libraries" tells the compiler where it can find libraries. The following example works on my current Mac OS X system: :
:
BOOST_ROOT=/opt/local # You have to change this |
| All times are GMT -5. The time now is 3:12 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC