c - Undefined Symbol when compiled with -O2 only on Mac -
I am working on a library that should be compiled on Linux and Mac OS X. Until now, I had no problem, the compilation "-G" worked well under both OS.
I tried to compile with some customization ("-o2") and it works well under Linux but when I try to link the program to Mac OS X With my library under
Do anyone have any clue what I should see?
nm mylib.a | It does the same thing for Grep _the_symbol 154: 00000018C _the_symbol 377: U _the_symbol
< P> Library for the program using the library is the compiled line: / usr / bin / gcc -std = c99 CMakeFiles / prod-cons.dir /prod-cons.co- O prod-cons -rdynamic -L / home / claferri / dev / build / src ../src/libckaapi.a-lpthread-Wl, -rpath, / home / claferri / dev / build / src
and under Mac:
/ usr / bin / gcc -std = c99 -wl, -search_paths_first -headerpad_max_install_names -fPIC CMakeFiles / prod-cons .dir / prod-cons .co -o prod-cons-L / volume / data / claferri / work / build / src ../src/libckaapi.a/usr/ Lib / libpthread.dylib
Here's an estimate: -fno-common Try creating a library with the flag If you have several definitions of this variable, then you have to add "extern", but for one.
Comments
Post a Comment