Boost logo

Boost-Build :

Subject: [Boost-build] Build Boost on OSX with GCC 4.7
From: Jójó (familiareal_at_[hidden])
Date: 2012-04-02 16:19:28


Hello, guys.

We're trying to compile Boost on OSX with GCC 4.7. At first we tought
it wouldn't be much different than building it in another system, but
then we found out that there are quite a few differences between the
way GCC builds and the way OSX handles things. A few issues arise.

First thing, we needed Boost Locale, for which we installed the ICL
package. It all seems to be up and running. But then, running b2 after
configuring, the compilation ends with an error. Here is an excerpt
from the config.log:

============================================================
...found 70 targets...
...updating 1 target...
gcc.link build-boost-kitanda/boost/bin.v2/libs/regex/build/gcc-4.7/debug/has_icu
ld: unknown option: -R
collect2: error: ld returned 1 exit status

    "g++-4.7" -L"/usr/local/kitanda//bin" -L"/usr/local/kitanda//lib"
-Wl,-R -Wl,"/usr/local/kitanda//bin" -Wl,-R
-Wl,"/usr/local/kitanda//lib" -Wl,-rpath-link
-Wl,"/usr/local/kitanda//bin" -Wl,-rpath-link
-Wl,"/usr/local/kitanda//lib" -o
"build-boost-kitanda/boost/bin.v2/libs/regex/build/gcc-4.7/debug/has_icu"
-Wl,--start-group
"build-boost-kitanda/boost/bin.v2/libs/regex/build/gcc-4.7/debug/has_icu_test.o"
 -Wl,-Bstatic  -Wl,-Bdynamic -licuuc -licui18n -licudata
-Wl,--end-group -g

...failed gcc.link
build-boost-kitanda/boost/bin.v2/libs/regex/build/gcc-4.7/debug/has_icu...
...failed updating 1 target...
...found 9 targets...
...updating 1 target...
gcc.link build-boost-kitanda/boost/bin.v2/libs/locale/build/gcc-4.7/debug/has_iconv
ld: unknown option: --start-group
collect2: error: ld returned 1 exit status

    "g++-4.7"    -o
"build-boost-kitanda/boost/bin.v2/libs/locale/build/gcc-4.7/debug/has_iconv"
-Wl,--start-group
"build-boost-kitanda/boost/bin.v2/libs/locale/build/gcc-4.7/debug/has_iconv_libc_obj.o"
 -Wl,-Bstatic  -Wl,-Bdynamic  -Wl,--end-group -g

...failed gcc.link
build-boost-kitanda/boost/bin.v2/libs/locale/build/gcc-4.7/debug/has_iconv...
...failed updating 1 target...
...found 2 targets...
...updating 1 target...
gcc.link build-boost-kitanda/boost/bin.v2/libs/locale/build/gcc-4.7/debug/has_external_iconv
ld: unknown option: --start-group
collect2: error: ld returned 1 exit status

    "g++-4.7"    -o
"build-boost-kitanda/boost/bin.v2/libs/locale/build/gcc-4.7/debug/has_external_iconv"
-Wl,--start-group
"build-boost-kitanda/boost/bin.v2/libs/locale/build/gcc-4.7/debug/has_iconv_libc_ext.o"
 -Wl,-Bstatic  -Wl,-Bdynamic -liconv -Wl,--end-group -g

...failed gcc.link
build-boost-kitanda/boost/bin.v2/libs/locale/build/gcc-4.7/debug/has_external_iconv...
...failed updating 1 target...
...found 5 targets...
...updating 1 target...
gcc.link build-boost-kitanda/boost/bin.v2/libs/locale/build/gcc-4.7/debug/has_icu
ld: unknown option: -R
collect2: error: ld returned 1 exit status

    "g++-4.7" -L"/usr/local/kitanda/lib" -Wl,-R
-Wl,"/usr/local/kitanda/bin" -Wl,-R -Wl,"/usr/local/kitanda/lib"
-Wl,-rpath-link -Wl,"/usr/local/kitanda/lib" -o
"build-boost-kitanda/boost/bin.v2/libs/locale/build/gcc-4.7/debug/has_icu"
-Wl,--start-group
"build-boost-kitanda/boost/bin.v2/libs/locale/build/gcc-4.7/debug/has_icu_obj.o"
 -Wl,-Bstatic  -Wl,-Bdynamic -licuuc -licui18n -licudata
-Wl,--end-group -g

...failed gcc.link
build-boost-kitanda/boost/bin.v2/libs/locale/build/gcc-4.7/debug/has_icu...
...failed updating 1 target...
...found 2 targets...
...updating 1 target...
gcc.link build-boost-kitanda/boost/bin.v2/libs/locale/build/gcc-4.7/debug/has_icu64
ld: warning: directory not found for option '-L/usr/local/kitanda/lib64'
ld: unknown option: -R
collect2: error: ld returned 1 exit status

    "g++-4.7" -L"/usr/local/kitanda/lib64" -Wl,-R
-Wl,"/usr/local/kitanda/bin64" -Wl,-R -Wl,"/usr/local/kitanda/lib64"
-Wl,-rpath-link -Wl,"/usr/local/kitanda/lib64" -o
"build-boost-kitanda/boost/bin.v2/libs/locale/build/gcc-4.7/debug/has_icu64"
-Wl,--start-group
"build-boost-kitanda/boost/bin.v2/libs/locale/build/gcc-4.7/debug/has_icu64_obj.o"
 -Wl,-Bstatic  -Wl,-Bdynamic -licuuc -licui18n -licudata
-Wl,--end-group -g

...failed gcc.link
build-boost-kitanda/boost/bin.v2/libs/locale/build/gcc-4.7/debug/has_icu64...
...failed updating 1 target...
...found 7 targets...
...found 47 targets...

============================================================

What we THINK this may is is that the linker we're passing the objects
to after the compilation made by gcc-4.7 can't recognize an option,
because even though we specify the toolset as "toolset=gcc-4.7", it
may not be picking up on the fact that it's building in an OSX system
at some point, thus the '-R' option not being recognized. We build gcc
4.7 from source, but it's in a Darwin system. Could it be that it's
using a linker that is not appropriate for the task with this
compiler? How should we go about this if we want to compile Boost with
GCC 4.7?

Has anyone managed to compile Boost with a GCC 4.7 compiled from source?

Best regards,

João Santos

---
http://www.google.pt/reader/shared/familiareal
Jójó
E depois de termos visto bem as coisas, afinal não há salvação do
mundo que não passe pelo Michael Jackson.

Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk