help with g++-mp-4.5

Titus von Boxberg titus at v9g.de
Tue Jun 7 09:45:49 PDT 2011


Am Di, 7.06.2011, 11:41 schrieb Ryan Schmidt:
> On Jun 7, 2011, at 01:16, Titus von Boxberg wrote:
>
>> The same problem is given here:
>> http://stackoverflow.com/questions/4697859/mac-os-x-and-static-boost-libs-stdstring-fail
>>
>> But I currently do not understand the problem.
>> And the "solution" given there as far as I get it would mean that
>> macport's c++ libraries are useless in conjunction with mp-g++?
>
> Reading that Stack Overflow post, it says that the reason their program compiled with gcc 4.5 doesn't work
> is that the boost library they're trying to statically link with was built with gcc 4.2. The solution was to
> either build their program with gcc 4.2 too, or to build boost with gcc 4.5 too. It's best to compile all
> parts of your project with the same compiler to avoid these types of problems. The article says the problem
> may also only appear when linking to static libraries, so link to the dynamic library instead. On Mac OS X,
> dynamic linking is preferred to static linking anyway; possibly this problem is one of the reasons for that
> recommendation.
>
> In your case, you're trying to link with cppunit, not boost, but other than that it seems similar. Except
> that the compile command you've shown doesn't seem to be specifically requesting to link with the static
> library. I thought dynamic linking was the default when both are available (which they are for cppunit).
> Maybe you need to explicitly request the dynamic library.
>
> MacPorts does not provide users with a means of specifying what compiler they want to use; instead it's up
> to the port maintainers to choose the correct compiler or provide compiler options. And unless there is a
> good reason why it won't work, most ports will use the default compiler, which on Snow Leopard is Apple's
> build of gcc 4.2. Assuming you require gcc 4.5 and 4.2 is not sufficient, you could try to override it when
> installing cppunit (sudo port install cppunit configure.cc=macports-gcc-4.5) but I don't know whether this
> will work on cppunit, and it's certainly not something we will support. You could also build cppunit
> manually with gcc 4.5.
>

otool -L says (as I would expect from my command line) :
	/opt/local/lib/libcppunit-1.12.1.dylib (compatibility version 2.0.0, current version 2.0.0)
	/opt/local/lib/gcc45/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.14.0)
	/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 625.0.0)
	/opt/local/lib/gcc45/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.10)

I also think that it is very likely it has to do with using two different gccs;
though I was unable to reproduce it with a smaller test case not based upon a macports library.

I doubt that this error is conformant or allowed behaviour,
I'd expect it to be a incompatibility or bug in
(the port of) mp-g++-4.5, that's why I'm asking.

Is anything known what might be the reason behind this error?




More information about the macports-dev mailing list