[Boost-users] Build boost on OSX 10.9 with GCC 4.8

117 views
Skip to first unread message

Jürgen Simon

unread,
Apr 15, 2014, 4:10:16 PM4/15/14
to Boost...@lists.boost.org
Hello,

I have a somewhat specific problem. I need to build Boost 1.55 with the GCC 4.8 compiler on the mac. I have installed gcc-4.8 using homebrew. Using the GCC compiler instead of clang is non-negotiable in my case, because I require OpenMP which is not implemented in clang yet. Given that, I tried to build boost this way:

export CC=/usr/local/Cellar/gcc48/4.8.2/bin/gcc-4.8
export CXX=/usr/local/Cellar/gcc48/4.8.2/bin/g++-4.8
export LD=/usr/local/Cellar/gcc48/4.8.2/bin/g++-4.8

./bootstrap.sh —with-toolset=gcc-4.8

gives an error:

Building Boost.Build engine with toolset gcc-4.8... 
Failed to build Boost.Build build engine
Consult 'bootstrap.log' for more details

apparently it does not recognize the gcc-4.8 toolkit. Using gcc instead does create the b2 script, but running the script as is also created trouble:

./bootstrap.sh —with-toolset=gcc
./b2

common.mkdir bin.v2/libs/atomic/build/gcc-4.2.1
common.mkdir bin.v2/libs/atomic/build/gcc-4.2.1/release
common.mkdir bin.v2/libs/atomic/build/gcc-4.2.1/release/threading-multi
gcc.compile.c++ bin.v2/libs/atomic/build/gcc-4.2.1/release/threading-multi/lockpool.o
In file included from libs/atomic/src/lockpool.cpp:3:
In file included from ./boost/atomic.hpp:12:
In file included from ./boost/atomic/atomic.hpp:17:
In file included from ./boost/atomic/detail/platform.hpp:22:
./boost/atomic/detail/gcc-atomic.hpp:961:64: error: no matching constructor for initialization of 'storage_type' (aka 'boost::atomics::detail::storage128_type')
    explicit base_atomic(value_type const& v) BOOST_NOEXCEPT : v_(0)

specifying the toolkit gcc-4.8 here does actually do something: 

./bootstrap.sh —with-toolset=gcc
./b2 -d 2 toolset=gcc-4.8

but it results in linker errors, like the following two examples:

"g++-4.8"  -Wl,-R -Wl,"/System/Library/Frameworks/Python.framework/Versions/2.7/lib" -Wl,-R -Wl,"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config"  -o "stage/lib/libboost_iostreams.dylib" -Wl,-h -Wl,libboost_iostreams.dylib -shared -Wl,--start-group "bin.v2/libs/iostreams/build/gcc-4.8/release/threading-multi/file_descriptor.o" "bin.v2/libs/iostreams/build/gcc-4.8/release/threading-multi/mapped_file.o" "bin.v2/libs/iostreams/build/gcc-4.8/release/threading-multi/bzip2.o"  -Wl,-Bstatic  -Wl,-Bdynamic -lbz2 -Wl,--end-group  

ld: unknown option: -R

"g++-4.8"    -o "bin.v2/libs/atomic/build/gcc-4.8/release/threading-multi/libboost_atomic.dylib" -Wl,-h -Wl,libboost_atomic.dylib -shared -Wl,--start-group "bin.v2/libs/atomic/build/gcc-4.8/release/threading-multi/lockpool.o"  -Wl,-Bstatic  -Wl,-Bdynamic  -Wl,--end-group  

ld: unknown option: -h

I tried for two days without success to get GCC-4.8 and Boost to play ball together on the Mac. What am I missing?

Kind Regards,
Jürgen



Nat Goodspeed

unread,
Apr 15, 2014, 7:33:57 PM4/15/14
to boost...@lists.boost.org
On Tue, Apr 15, 2014 at 4:10 PM, Jürgen Simon <si...@webtecc.com> wrote:

> I have a somewhat specific problem. I need to build Boost 1.55 with the GCC
> 4.8 compiler on the mac. I have installed gcc-4.8 using homebrew.

I have a somewhat comparable situation. I'm running OS X 10.7.5 and
have installed gcc 4.7 from MacPorts.

I appended this line to my ~/user-config.jam:

using darwin : 4.7 : /opt/local/bin/c++-mp-4.7 : <compileflags>-std=c++11 ;

and I invoke b2 with toolset=darwin-4.7.

I found that 'darwin' seems to work better than 'gcc' because it
better understands the linker flags for this platform.
_______________________________________________
Boost-users mailing list
Boost...@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users

Jürgen Simon

unread,
Apr 16, 2014, 5:32:31 PM4/16/14
to boost...@lists.boost.org

Thanks a lot, Nat. That did the trick.
Reply all
Reply to author
Forward
0 new messages