When compiling for the iPhone simulator with the following command:
./bjam --prefix=/Downloads/boost_install/ toolset=darwin architecture=x86 target-os=iphone macosx-version=iphone-${SDK_VERSION} --with-date_time --with-regex --with-thread link=static install
And the following user-config.jam:
using darwin : 4.2.1~iphone
: /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/llvm-g++-4.2
: <striper>
<compileflags>"-arch armv7"
<compileflags>-mthumb
<compileflags>-D_LITTLE_ENDIAN
: <architecture>arm <target-os>iphone
;
using darwin : 4.2.1~iphonesim
: /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-g++-4.2
: <striper>
<compileflags>"-arch i386"
<compileflags>-D_LITTLE_ENDIAN
: <architecture>x86 <target-os>iphone
;
using darwin : 4.2.1~darwin
: /Developer/usr/bin/gcc
: <striper>
<compileflags>"-arch i386"
<compileflags>"-arch x86_64"
: <architecture>x86 <target-os>darwin
ld: bad codegen, pointer diff in boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<std::runtime_error> >::rethrow() constto global weak symbol vtable for boost::exceptionfor architecture i386
collect2: ld returned 1 exit status
Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/g++-4.2 failed with exit code 1
I've noticed that many people have managed to get around this error by hiding boost's symbols, however, that doesn't seem to be the preferred approach as it requires hiding all of my projects symbols, which will prevent me from being able to handle exceptions according to Apple docs:
> If your symbol uses runtime type identification (RTTI) information,
> exceptions, or dynamic casts for an object that is defined in another
> library, your symbol must be visible if it expects to handle requests
> initiated by the other library. For example, if you define a catch
> handler for a type in the C++ standard library, and you want to catch
> exceptions of that type thrown by the C++ standard library, you must
> make sure that your typeinfo object is visible.
Is there another approach to fixing this linker error?
Thanks,
Mark