Libtool link order problem
Hello, I've run across a linking problem with libtool that frankly has me stymied. (I'm using version 1.5.2, on Mac OS X 10.3, if that matters.) The general gist is that when libtool automatically decides what libraries to link in, it can get the link order wrong, which causes dependency problems. Here's the specifics of my problem. This is what gets called by my makefile: /bin/sh ../../libtool --mode=link g++ -g -fomit-frame-pointer -O3 -DNDEBUG -Wall -fno-rtti -pipe -o OUTPUT.la -rpath /usr/local/lib -no-undefined -version-info 5:0:0 -release 0.9 -L/sw/lib -L/usr/X11R6/lib [input .o files] -lXm -lMrm -lUil -lz -lm Which libtool translates into the following link command: g++ -dynamiclib -single_module -o OUTPUT.dylib [input .o files] /usr/X11R6/lib/libX11.dylib /usr/X11R6/lib/libXp.dylib /usr/X11R6/lib/libXext.dylib /usr/X11R6/lib/libICE.dylib /usr/X11R6/lib/libSM.dylib /usr/X11R6/lib/libXt.dylib /usr/X11R6/lib/libXmu.dylib -L/usr/X11R6/lib -L/sw/lib /sw/lib/libXm.dylib /sw/lib/libMrm.dylib /sw/lib/libUil.dylib -lz -lm -install_name /usr/local/lib/libhighgui-0.9.5.dylib -compatibility_version 6 -current_version 6.0 Now, here's the problem -- libXm MUST come before libX11 or libXt on the link line, or link errors happen. (See e.g. http://book.onairweb.net/computer/os/X-window/ X_Window_and_Motif_Programming_Guide/ ) So, how do I force libtool to place libXm before the rest of those hard-coded library paths that libtool has automatically decided are necessary? Thanks, Zach Pincus Department of Biochemistry and Program in Biomedical Informatics Stanford University School of Medicine ___ Libtool mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/libtool
Re: Libtool link order problem
Thanks for your reply, Peter. I do agree that libtool is behaving correctly here. However, the fact remains that this "correct behavior" is causing problems with the motif libraries where libXm does indeed depend on libX11 and so forth, but nevertheless, must be on the link line *before* the other libraries. I don't know exactly why this is, or how it works that way, but the motif guides are pretty clear on this point: As always for Motif programs, you must specify that you will use the Xm, Xt, and X11 libraries, in that order. ( see http://www.cs.cf.ac.uk/Dave/X_lecture/ node5.html#SECTION0055 ) So, does anybody know how in a library's .la file you specify that, yes, a certain library depends on another, but in such a strange fashion that the dependent library must be first on the link line? Given the common case of these motif libraries, libtool should have such a mechanism, right? Or am I failing to apprehend something obvious here? Thanks, Zach Pincus Department of Biochemistry and Program in Biomedical Informatics Stanford University School of Medicine On Jan 28, 2004, at 5:59 AM, Peter O'Gorman wrote: [snip] I don't see what can be done about this. When I look at fink's libXm.la I see most of those libs in dependency_libs, which implies that they need to come on the link line before libXm.dylib. They do. This is not a libtool bug in my opinion libtool is behaving correctly here. Peter - -- Peter O'Gorman - http://www.pogma.com ___ Libtool mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/libtool