Project

General

Profile

Actions

Bug #4129

closed

Linking errors with Boost on Mac

Added by Gustaf Borgström almost 9 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Normal
Target version:
Start date:
06/01/2015
Due date:
% Done:

0%

Estimated time:

Description

Hello,

I have problems when linking the library libwt.dylib when building Wt on Mac. I am building using MacPorts GCC compiler (v 4.8) together with Macports Boost v 1.58.

After creating the directory "build" and entered it, the CMake command is:

cmake ../ -DCMAKE_C_COMPILER=gcc-mp-4.8 -DCMAKE_CXX_COMPILER=gcc-mp-4.8 -DWT_CPP_11_MODE=-std=c++0x -DSSL_INCLUDE_DIRS=/opt/local/include -DSSL_LIB=/opt/local/lib/libssl.dylib -DZLIB_LIB=/opt/local/lib/libz.dylib -DCMAKE_INSTALL_PREFIX=/opt/local -DBOOST_PREFIX=/opt/local -DWT_WRASTERIMAGE_IMPLEMENTATION=GraphicsMagick -DGM_PREFIX=/opt/local

When running make, compilation goes fine, until trying to link libwt.dylib. Then, a (very long) error output is printed before termination. For ease, the output is given as a text file instead of inline. The output is initiated by:

Linking CXX shared library libwt.dylib
Undefined symbols for architecture x86_64:

Any ideas what may be wrong?


Files

compilation_error_ouput.txt (295 KB) compilation_error_ouput.txt Gustaf Borgström, 06/01/2015 10:17 AM
Actions #1

Updated by Wim Dumon almost 9 years ago

  • Status changed from New to Feedback

Hi,

This looks like your C compiler has a problem. It doesn't seem to find any symbol that is supposed to be present in the standard C library. I don't know how you got into this situation... Can your compiler correctly compile even a small C program?

On OSX, I use apple's xcode compilers to compile Wt and boost, I haven't used macports gcc for a while.

Best regards,

Wim.

Actions #2

Updated by Gustaf Borgström almost 9 years ago

Yes, my compiler has had no problem compiling other things. In particular, a simple "Hello world" program is no problem. However, I tried to switch to clang/clang which worked like a charm. Conclusion: don't use Macports compiler (at least not the current version) when linking Wt.

Actions #3

Updated by Wim Dumon almost 9 years ago

  • Status changed from Feedback to Resolved

Without wanting to start a religious discussion, what's the advantage of using gcc on OS X these days?

I just spotted something in your cmake command.. could the problem be related to this:

-DCMAKE_CXX_COMPILER=gcc-mp-4.8

Shouldn't that be g-mp-4.8?

And you'd definitely need to link to a boost library (and other dependencies) that is also compiled with gcc... I believe macports itself also uses clang/clang these days, so it seems to me that this is is a complex setup, not recommended unless you really know what you're doing ;-)

BR,

Wim.

Actions #4

Updated by Gustaf Borgström almost 9 years ago

As I recall: OpenMP is currently not supported in Apple clang/clang, but it is with gcc. That's at least why I installed it in the first place. On the other hand, there's a known bug (a critical one, if you ask me) in Macports' gcc: it doesn't support AVX instructions; e.g., -march=native won't compile in general.

You're absolutely right about the flag. I retried with the corrected setting, but it didn't work. It's therefore still probably something regarding the compiler or the glibc library from Macports.

Thanks for your help!

Actions #5

Updated by Koen Deforche over 8 years ago

  • Status changed from Resolved to Closed
Actions #6

Updated by Koen Deforche over 8 years ago

  • Target version changed from 3.3.4 to 3.3.5
Actions

Also available in: Atom PDF