Linking with dynamic libraries in /usr/lib?
Linking with dynamic libraries in /usr/lib?
- Subject: Linking with dynamic libraries in /usr/lib?
- From: email@hidden
- Date: Sat, 27 Aug 2005 17:40:40 +0200
Hello
I'm using Xcode 2.1 running on MacOS X 10.4.2.
I've changed a C++ carbon application (with the deployment target set to 10.3)
that I'm working on to use log4cxx which I've built from source as a static
(.a) library. In order to resolve symbols used in liblog4cxx.a I need to link
with libiconv.dylib and libxml2.dylib, both of which are found in /usr/lib
I've stumbled accross a couple of problems one related to getting Xcode to link
with libraries in /usr/lib and the other with related to linking with the
libraries themselvs once I've added them (by manually editing the project
file).
1) The "add to project" file dialog in Xcode won't allow me to enter /usr/lib so
I can't add /usr/lib/libiconv.dylib and /usr/lib/libxml2.dylib using the GUI.
The only way I'm found to get around this is to add 2 other dynamic libraries
to the project, exit Xcode, edit the project file manually to change the
filenames and restart Xocde. There must be a better way than this, please would
someone clue me in.
2) Even with the libraries added I get warnings from Xcode during the link phase
saying "warning: skipping file '/usr/lib/libiconv.2.dylib' (unexpected file type
'compiled.mach-o' in Frameworks & Libraries build phase)" [for both libraries],
as shown in LISTING1 (below) from the build results window. However if I copy
the link command line from the build transcript, add "-lxml2 -liconv" and
execute the command (see LISTING2 below) in a Terminal window then everything
links correctly. What's going on here? How come Xcode is rejecting the
libraries but using them from the command line works?
Any help would be much appreciated. I've looked in the Xode help, searched
devloper.apple.com and searched using google but have not found anything that
helps.
thanks
Dave
******* LISTING1 *********
Building target composer (1 error, 2 warnings)
warning: skipping file '/usr/lib/libiconv.2.dylib' (unexpected file type
'compiled.mach-o' in Frameworks & Libraries build phase) warning: skipping file
'/usr/lib/libxml2.dylib' (unexpected file type 'compiled.mach-o' in Frameworks &
Libraries build phase) mkdir
/Volumes/local/localcache/projects/method-music/build/macosx-ppc/composer.build/Debug/composer.app/Contents/MacOS
cd
/Volumes/local/localcache/projects/method-music/src/applications/aqua/composer
setenv MACOSX_DEPLOYMENT_TARGET 10.3
/usr/bin/g++-4.0 -o
/Volumes/local/localcache/projects/method-music/build/macosx-ppc/composer.build/Debug/composer.app/Contents/MacOS/composer
-L/Volumes/local/localcache/projects/method-music/build/macosx-ppc/composer.build/Debug
-L/Volumes/local/localcache/projects/method-music/src/applications/aqua/composer/../../../../external/macosx-ppc/lib
-L/Volumes/local/localcache/projects/method-music/src/applications/aqua/composer/../../../../build/macosx-ppc
-F/Volumes/local/localcache/projects/method-music/build/macosx-ppc/composer.build/Debug
-filelist
/Volumes/local/localcache/projects/method-music/build/macosx-ppc/composer.build/composer.build/Debug/composer.build/Objects-normal/ppc/composer.LinkFileList
-framework Carbon -framework CoreServices -framework ApplicationServices
-lmethodmusic-core -lexpatpp -lexpat -ljdkmidi -lapr-1 -laprutil-1 -llog4cxx
-arch ppc
/usr/bin/ld: Undefined symbols:
_libiconv
_libiconv_close
_libiconv_open
_xmlDocGetRootElement
_xmlFreeDoc
_xmlGetProp
_xmlParseFile
collect2: ld returned 1 exit status
/usr/bin/ld: Undefined symbols:
_libiconv
_libiconv_close
_libiconv_open
_xmlDocGetRootElement
_xmlFreeDoc
_xmlGetProp
_xmlParseFile
collect2: ld returned 1 exit status
Build failed for target "composer" (1 error, 2 warnings)
*******
******* LISTING2 ********
setenv MACOSX_DEPLOYMENT_TARGET 10.3
/usr/bin/g++-4.0 -o
/Volumes/local/localcache/projects/method-music/build/macosx-ppc/composer.build/Debug/composer.app/Contents/MacOS/composer
-L/Volumes/local/localcache/projects/method-music/build/macosx-ppc/composer.build/Debug
-L/Volumes/local/localcache/projects/method-music/src/applications/aqua/composer/../../../../external/macosx-ppc/lib
-L/Volumes/local/localcache/projects/method-music/src/applications/aqua/composer/../../../../build/macosx-ppc
-F/Volumes/local/localcache/projects/method-music/build/macosx-ppc/composer.build/Debug
-filelist
/Volumes/local/localcache/projects/method-music/build/macosx-ppc/composer.build/composer.build/Debug/composer.build/Objects-normal/ppc/composer.LinkFileList
-framework Carbon -framework CoreServices -framework ApplicationServices
-lmethodmusic-core -lexpatpp -lexpat -ljdkmidi -lapr-1 -laprutil-1 -llog4cxx
-liconv -lxml2 -arch ppc
_______________________________________________
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