Question

I've been working for a while with the gtest unit testing library for a while. Recently I set up a new development machine and upgraded to Mac OS X 10.9. I installed

brew tap homebrew/versions
brew install [flags] gcc48

I built gtest locally with

cmake .
make

and it produced libgtest.a.

The second dependency of my project is the logging library log4cxx. I got it as usual with:

brew install log4cxx

All that looks fine. But when I try to compile now, I get this massive linker error about undefined symbols which I cannot interpret. Any ideas?

Was it helpful?

Solution

This issue relates to the use of -stdlib= when compiling. I cannot tell you which value (libstdc++ or libc++) is the correct one to use, but it has to match the one used by the libraries when they were compiled.

I guess you'll need to dig through the homebrew logs to find out.

OTHER TIPS

The other trick to look at is to make sure that everything you are compiling is using the same -mmacosx-version-min value for all of your executable units that you are linking together. If you don't define one, Mavericks will use 10.9 and it appears to link with libc++ by default, while if you use -mmacosx-version-min=10.8 or lower it will link with libstdc++ by default.

This will give you a mismatch where some of your symbols are std::__1::foo and some are std::foo when you run them through c++filt.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top