-fvsibility not being passed to the compiler in Xcode 3.2.4?
-fvsibility not being passed to the compiler in Xcode 3.2.4?
- Subject: -fvsibility not being passed to the compiler in Xcode 3.2.4?
- From: Juan Manuel Palacios <email@hidden>
- Date: Mon, 27 Sep 2010 18:53:11 -0430
Good evening all! I'm new here so please excuse me if my problem has already been addressed, but I've been searching the list archives and Googling all afternoon and still can't find an answer. I'm compiling a personal project with Xcode 3.2.4 on a 10.6.4 SL system, and I'm fearing the -fvisibility flag is not being passed to the compiler. Here's a detailed description of the problem:
1) The project consists of two targets, one compiling a dynamic library and a second one creating the end-user app, dependent on the library;
2) the compiler is set to clang 1.5, but the problem rears its head just the same with GCC 4.2 selected;
3) for all build configurations, the dynamic library target, "libssfm", has the "Symbols Hidden by Default" option selected;
4) my library's header file has the Apple recommended #define EXPORT __attribute__((visibility("default"))) macro declared;
5) symbols I want exported are marked as the following example: EXPORT int ssfm_init(void);
6) symbols I *don't* want exported are *not* marked EXPORT, such as: void some_private_symbol(void);
7) the resulting library file ends up exporting the hidden symbols, which according to my understanding should *not* happen:
-> nm -gm build/Debug/libssfm.0.dylib | grep private
0000000000000d0f (__TEXT,__text) external _some_private_symbol
Here are the compile lines that create my shared library (which at the moment is comprised of a single source module):
CompileC "build/NLSE Solver.build/Debug/libssfm.build/Objects-normal/x86_64/ssfm.o" ssfm/ssfm.c normal x86_64 c com.apple.compilers.llvm.clang.1_0.compiler
cd "/Users/jmpp/Documents/Universidad/Tesis/Software/NLSE Solver"
setenv LANG en_US.US-ASCII
/Developer/usr/bin/clang -x c -arch x86_64 -fmessage-length=0 -pipe -fdiagnostics-print-source-range-info -std=gnu99 -Wno-trigraphs -fpascal-strings -O0 -Wmissing-field-initializers -Wmissing-prototypes -Wreturn-type -Wmissing-braces -Wparentheses -Wswitch -Wunused-parameter -Wunused-variable -Wunused-value -pedantic -Wshadow -Wsign-compare -Wnewline-eof -Wshorten-64-to-32 -isysroot /Developer/SDKs/MacOSX10.6.sdk -fasm-blocks -mfix-and-continue -mmacosx-version-min=10.5 -gdwarf-2 -msse3 -mssse3 -msse4.1 -msse4.2 -iquote "/Users/jmpp/Documents/Universidad/Tesis/Software/NLSE Solver/build/NLSE Solver.build/Debug/libssfm.build/libssfm.0-generated-files.hmap" "-I/Users/jmpp/Documents/Universidad/Tesis/Software/NLSE Solver/build/NLSE Solver.build/Debug/libssfm.build/libssfm.0-own-target-headers.hmap" "-I/Users/jmpp/Documents/Universidad/Tesis/Software/NLSE Solver/build/NLSE Solver.build/Debug/libssfm.build/libssfm.0-all-target-headers.hmap" -iquote "/Users/jmpp/Documents/Universidad/Tesis/Software/NLSE Solver/build/NLSE Solver.build/Debug/libssfm.build/libssfm.0-project-headers.hmap" "-F/Users/jmpp/Documents/Universidad/Tesis/Software/NLSE Solver/build/Debug" "-I/Users/jmpp/Documents/Universidad/Tesis/Software/NLSE Solver/build/Debug/include" "-I/Users/jmpp/Documents/Universidad/Tesis/Software/NLSE Solver/build/NLSE Solver.build/Debug/libssfm.build/DerivedSources/x86_64" "-I/Users/jmpp/Documents/Universidad/Tesis/Software/NLSE Solver/build/NLSE Solver.build/Debug/libssfm.build/DerivedSources" -c "/Users/jmpp/Documents/Universidad/Tesis/Software/NLSE Solver/ssfm/ssfm.c" -o "/Users/jmpp/Documents/Universidad/Tesis/Software/NLSE Solver/build/NLSE Solver.build/Debug/libssfm.build/Objects-normal/x86_64/ssfm.o"
Ld build/Debug/libssfm.0.dylib normal x86_64
cd "/Users/jmpp/Documents/Universidad/Tesis/Software/NLSE Solver"
setenv MACOSX_DEPLOYMENT_TARGET 10.5
/Developer/usr/bin/clang -arch x86_64 -dynamiclib -isysroot /Developer/SDKs/MacOSX10.6.sdk "-L/Users/jmpp/Documents/Universidad/Tesis/Software/NLSE Solver/build/Debug" "-F/Users/jmpp/Documents/Universidad/Tesis/Software/NLSE Solver/build/Debug" -filelist "/Users/jmpp/Documents/Universidad/Tesis/Software/NLSE Solver/build/NLSE Solver.build/Debug/libssfm.build/Objects-normal/x86_64/libssfm.0.LinkFileList" -install_name @executable_path/../Libraries/libssfm.0.dylib -mmacosx-version-min=10.5 -framework GLUT -framework OpenGL -single_module -compatibility_version 1.0 -current_version 1.0 -o "/Users/jmpp/Documents/Universidad/Tesis/Software/NLSE Solver/build/Debug/libssfm.0.dylib"
Other than that, the project is set to the 10.6 SDK and 10.5 deployment target, and no "Exported Symbols File" is being used for the libssfm dynamic library target.
All of this leads me to believe that Xcode is failing to pass the -fvisibility flag to the compiler (which I can't see anywhere in the compiler calls), unless I'm just missing something incredibly obvious to actually get it there...
Here's how the compilation and nm analysis look when using GCC 4.2 (with "Symbols Hidden by Default" obviously still selected, and intermediary "Clean All" runs as necessary to start afresh):
CompileC "build/NLSE Solver.build/Debug/libssfm.build/Objects-normal/x86_64/ssfm.o" ssfm/ssfm.c normal x86_64 c com.apple.compilers.gcc.4_2
cd "/Users/jmpp/Documents/Universidad/Tesis/Software/NLSE Solver"
setenv LANG en_US.US-ASCII
/Developer/usr/bin/gcc-4.2 -x c -arch x86_64 -fmessage-length=0 -pipe -std=gnu99 -Wno-trigraphs -fpascal-strings -fasm-blocks -O0 -Wmissing-field-initializers -Wmissing-prototypes -Wreturn-type -Wmissing-braces -Wparentheses -Wswitch -Wunused-parameter -Wunused-variable -Wunused-value -pedantic -Wshadow -Wsign-compare -Wnewline-eof -Wshorten-64-to-32 -Wglobal-constructors -isysroot /Developer/SDKs/MacOSX10.6.sdk -mfix-and-continue -msse3 -mssse3 -msse4.1 -msse4.2 -mmacosx-version-min=10.5 -gdwarf-2 -iquote "/Users/jmpp/Documents/Universidad/Tesis/Software/NLSE Solver/build/NLSE Solver.build/Debug/libssfm.build/libssfm.0-generated-files.hmap" "-I/Users/jmpp/Documents/Universidad/Tesis/Software/NLSE Solver/build/NLSE Solver.build/Debug/libssfm.build/libssfm.0-own-target-headers.hmap" "-I/Users/jmpp/Documents/Universidad/Tesis/Software/NLSE Solver/build/NLSE Solver.build/Debug/libssfm.build/libssfm.0-all-target-headers.hmap" -iquote "/Users/jmpp/Documents/Universidad/Tesis/Software/NLSE Solver/build/NLSE Solver.build/Debug/libssfm.build/libssfm.0-project-headers.hmap" "-F/Users/jmpp/Documents/Universidad/Tesis/Software/NLSE Solver/build/Debug" "-I/Users/jmpp/Documents/Universidad/Tesis/Software/NLSE Solver/build/Debug/include" "-I/Users/jmpp/Documents/Universidad/Tesis/Software/NLSE Solver/build/NLSE Solver.build/Debug/libssfm.build/DerivedSources/x86_64" "-I/Users/jmpp/Documents/Universidad/Tesis/Software/NLSE Solver/build/NLSE Solver.build/Debug/libssfm.build/DerivedSources" -c "/Users/jmpp/Documents/Universidad/Tesis/Software/NLSE Solver/ssfm/ssfm.c" -o "/Users/jmpp/Documents/Universidad/Tesis/Software/NLSE Solver/build/NLSE Solver.build/Debug/libssfm.build/Objects-normal/x86_64/ssfm.o"
Ld build/Debug/libssfm.0.dylib normal x86_64
cd "/Users/jmpp/Documents/Universidad/Tesis/Software/NLSE Solver"
setenv MACOSX_DEPLOYMENT_TARGET 10.5
/Developer/usr/bin/gcc-4.2 -arch x86_64 -dynamiclib -isysroot /Developer/SDKs/MacOSX10.6.sdk "-L/Users/jmpp/Documents/Universidad/Tesis/Software/NLSE Solver/build/Debug" "-F/Users/jmpp/Documents/Universidad/Tesis/Software/NLSE Solver/build/Debug" -filelist "/Users/jmpp/Documents/Universidad/Tesis/Software/NLSE Solver/build/NLSE Solver.build/Debug/libssfm.build/Objects-normal/x86_64/libssfm.0.LinkFileList" -install_name @executable_path/../Libraries/libssfm.0.dylib -mmacosx-version-min=10.5 -framework GLUT -framework OpenGL -single_module -compatibility_version 1.0 -current_version 1.0 -o "/Users/jmpp/Documents/Universidad/Tesis/Software/NLSE Solver/build/Debug/libssfm.0.dylib"
-> nm -gm build/Debug/libssfm.0.dylib | grep private
0000000000000d0f (__TEXT,__text) external _some_private_symbol
So, any pointers as to what I am doing wrong to get the compiler to stop exporting unrequested symbols? Any other information I could provide to help debug the issue...? Thanks in advance!
- jmpp
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden