[LLVMdev] using llvm-ld with existing libraries

Devang Patel dpatel at apple.com
Wed Jan 2 09:41:37 PST 2008


On Dec 30, 2007, at 12:21 PM, Jack Howarth wrote:

>   I am running into some problems when trying to use
> llvm-ld to link object files, created by llvm-gcc-4.2
> at -O4, with the stock libraries available on
> powerpc-apple-darwin9. In particular, I am finding that
> the link command...
>
> llvm-ld -O4 -native -o molscript molscript.tab.o global.o lex.o  
> col.o select.o state.o graphics.o segment.o coord.o xform.o  
> postscript.o raster3d.o vrml.o regex.o opengl.o image.o eps_img.o  
> sgi_img.o jpeg_img.o png_img.o clib/clib.a /sw/lib/libfreeglut. 
> 3.8.0.dylib /usr/X11R6/lib/libGLU.1.3.dylib /usr/X11R6/lib/libGL. 
> 1.2.dylib /System/Library/Frameworks/OpenGL.framework/Libraries/ 
> libGL.dylib /usr/X11R6/lib/libX11.6.2.0.dylib /usr/X11R6/lib/libXi. 
> 6.0.0.dylib /usr/X11R6/lib/libXmu.6.2.0.dylib /sw/lib/libjpeg. 
> 62.0.0.dylib /sw/lib/libpng.3.18.0.dylib /usr/lib/libz.1.2.3.dylib / 
> usr/lib/libSystem.B.dylib
>
> ...produces the warnings...
>
> llvm-ld: warning: Ignoring file '/sw/lib/libfreeglut.3.8.0.dylib'  
> because does not contain bitcode.
> llvm-ld: warning: Ignoring file '/sw/lib/libjpeg.62.0.0.dylib'  
> because does not contain bitcode.
> llvm-ld: warning: Ignoring file '/sw/lib/libpng.3.18.0.dylib'  
> because does not contain bitcode.

As expected, /sw/lib/libjpeg.62.0.0.dylib is not llvm bitcode and llvm- 
ld only accepts bitcode files as input. What you want to do is


> $ llvm-ld -O4 -native molscript.tab.o global.o lex.o col.o select.o  
> state.o graphics.o segment.o coord.o xform.o postscript.o raster3d.o  
> vrml.o regex.o opengl.o image.o eps_img.o sgi_img.o jpeg_img.o  
> png_img.o -o my_big.o

> $ <my_compiler_or_linker_driver> my_big.o -o molscript clib/clib.a / 
> sw/lib/libfreeglut.3.8.0.dylib /usr/X11R6/lib/libGLU.1.3.dylib /usr/ 
> X11R6/lib/libGL.1.2.dylib /System/Library/Frameworks/ 
> OpenGL.framework/Libraries/libGL.dylib /usr/X11R6/lib/ 
> libX11.6.2.0.dylib /usr/X11R6/lib/libXi.6.0.0.dylib /usr/X11R6/lib/ 
> libXmu.6.2.0.dylib /sw/lib/libjpeg.62.0.0.dylib /sw/lib/libpng. 
> 3.18.0.dylib /usr/lib/libz.1.2.3.dylib /usr/lib/libSystem.B.dylib

> ...etc. Does this work on any other platform (eg linux)? Also, I  
> find that
> when I invoke the llvm-ld linker with '-L' and '-l' to link in  
> shared libraries
> that the libraries don't seem to be found. I have to explicitly add  
> the libraries
> with their full path in order for them to be found.

Are you using -L=<blah> and -l=<blah> syntax ? See llvm-ld --help.


-
Devang






More information about the llvm-dev mailing list