[BuildTools] Linking Ipopt on Solaris / Studio

Lou Hafer lou at cs.sfu.ca
Thu Sep 27 22:58:28 EDT 2007


Andreas,

	A longish post to say that I finally figured out why I couldn't
link Ipopt on my office workstation (Solaris 10 / Studio). There were three
interrelated problems. At one level, you can just say I misconfigured my
environment. But the story may be useful for future reference. There are
details we will probably want to remember. Hence the BuildTools posting, an
easy archive service.

	For reasons lost to me in the mists of time, I had the generic Studio
library directory prepended to my LD_LIBRARY_PATH variable.  Never caused me
problems 'til now, but a bad decision on my part, because I really needed to
prepend a couple of architecture-specific directories to do it correctly.  You
can see the correct order in the commands (at end of post):  []/lib/v8plus,
[]/prod/lib/v8plus, []/lib.  I had only []/lib at the front.  To give away the
ending, the net result was that ld was first finding []/lib/libfsu as a
dependency of libsunperf, then, after processing the -L options, finding
[]/lib/v8plus/libfsu.  It would then complain about conflicts and die.  The fix
was to remove []/lib from my LD_LIBRARY_PATH and let Studio find it in the
proper place in the normal default library search path.

	Notice -xlic_lib=sunperf. This is a `special handling' library
parameter which forces inclusion of the referenced library and dependencies
at the point where it's encountered. This is where libfsu first creeps in,
along with a bunch of other libraries. Notice, too, that -xlic_lib is in a
*different* place after libtool reorders the parameters to the link command.
Before fixing my LD_LIBRARY_PATH, I tried some changes in coin.m4 that put
the -xlic_lib parameter after the -L options. No good! Libtool helpfully
concludes it's a generic compiler option and moves it back to the front.

	The current version of Studio CC (5.8) actually deprecates -xlic_lib,
recommending -library instead. This works much better with libtool because a)
as far as libtool is concerned, anything starting with -l is a library and
doesn't get reordered; and b) -library actually tells CC to `do the right
things' to link libsunperf. The -xlic_lib option is apparently not so
bright.  The -library option worked just fine, even with my broken
LD_LIBRARY_PATH and no changes to coin.m4. But ... cc 5.8 doesn't recognise
-library! Really annoying, you'd think that the Sun people would have
synchronised this. Given Ipopt tries to link C++, C, and Fortran executables
for testing, using -library actually got me through the main build, but `make
test' failed.

	That's my story, and I'm sticking to it.

							Lou

Command to libtool:

/bin/bash ../../libtool --tag=CC --mode=link cc  -g  -o hs071_c  hs071_c.o
../src/Interfaces/libipopt.la -lpthread -xlic_lib=sunperf -lm
-R/net/local-rscn/Studio11/SUNWspro/lib/v8plus:/net/local-rscn/Studio11/SUNWspro
/lib:/opt/SUNWspro/lib/v8plus:/opt/SUNWspro/lib
-L/net/local-rscn/Studio11/SUNWspro/lib/v8plus
-L/net/local-rscn/Studio11/SUNWspro/prod/lib/v8plus
-L/net/local-rscn/Studio11/SUNWspro/lib
-L/net/local-rscn/Studio11/SUNWspro/prod/lib -L/usr/ccs/lib -L/lib -L/usr/lib
-lfui -lfai -lfai2 -lfsumai -lfprodai -lfminlai -lfmaxlai -lfminvai -lfmaxvai
-lfsu -lsunmath -lmtsk -lm -lCstd -lCrun 

Link command generated by libtool:

cc -g -o hs071_c hs071_c.o -xlic_lib=sunperf
../src/Interfaces/.libs/libipopt.a -lpthread
-L/net/local-rscn/Studio11/SUNWspro/lib/v8plus
-L/net/local-rscn/Studio11/SUNWspro/prod/lib/v8plus
-L/net/local-rscn/Studio11/SUNWspro/lib
-L/net/local-rscn/Studio11/SUNWspro/prod/lib -L/usr/ccs/lib -L/lib -L/usr/lib
-lfui -lfai -lfai2 -lfsumai -lfprodai -lfminlai -lfmaxlai -lfminvai -lfmaxvai
-lfsu -lsunmath -lmtsk -lm -lCstd -lCrun
-R/net/local-rscn/Studio11/SUNWspro/lib/v8plus:/net/local-rscn/Studio11/SUNWspro
/lib:/opt/SUNWspro/lib/v8plus:/opt/SUNWspro/lib




More information about the BuildTools mailing list