Bumped into a nasty problem on Tru64. When trying to build cfenfine I got
the following error:

/usr/users/kvo/openpkg/dev/bin/cc -g -O2 -Wreturn-type -Wmissing-prototypes
-Wuninitialized -D_REENTRANT -pthread -O2
-I/usr/users/kvo/openpkg/dev/include   -D_REENTRANT -pthread -O2
-I/usr/users/kvo/openpkg/dev/include -L/usr/users/kvo/openpkg/dev/lib
-L/usr/users/kvo/openpkg/dev/lib  -L/usr/users/kvo/openpkg/dev/lib
-L/usr/users/kvo/openpkg/dev/lib -L/usr/users/kvo/openpkg/dev/lib
-L/usr/users/kvo/openpkg/dev/lib -o cfagent  cfagent.o init.o do.o modules.o
alerts.o wrapper.o report.o client.o ip.o process.o ifconf.o image.o item.o
item-ext.o item-file.o 2Dlist.o globals.o classes.o misc.o parse.o
functions.o edittools.o patches.o install.o link.o tidy.o filedir.o eval.o
modes.o sockaddr.o chflags.o locks.o mount.o macro.o filenames.o varstring.o
wildcard.o cfparse.o comparray.o read.o checksums.o proto.o filters.o copy.o
repository.o rotate.o errors.o cflex.o net.o df.o log.o crypto.o popen.o
popen_def.o sensible.o acl.o dce_acl.o nameinfo.o strategies.o granules.o
methods.o state.o package.o -lfl -lfl -ldb -lcrypto -L../pub -lpub -lpthread
-lm -lfsl
db_create
db_strerror
collect2: ld returned 1 exit status
make[2]: *** [cfagent] Error 1
make[1]: *** [all] Error 2
make: *** [all-recursive] Error 1


This looked like it was using a wrong library to link with.. and sure thing:

$ ls /usr/shlib/libdb*
/usr/shlib/libdb.so
$ nm /usr/shlib/libdb.so|grep "T db_create"

No db_create in the shared system library. Whereas:

$ nm /usr/users/kvo/openpkg/dev/lib/libdb.a|grep "T db_create"
0000000000000000 T db_create


So the Tru64 linker is using the shared library instead of the archive
library. Quick look in the ld [1] man page reveals why:

  When linking a shared object, ld searches all library directories for the
  shared object library (libx.so). If it cannot find the shared object
  library, it again searches all library directories for the archive library
  (libx.a).


Meaning any time the system has a shared library, it will prefer it over the
OpenPKG library. There is a way to exclude shared libraries from the search,
but it's not pretty:

  -noso
      Require -l references to resolve to archive libraries. Note that this
      option is position sensitive and can be used more than once on a com-
      mand line. It affects only those options that follow it, and it is
      turned off by the next occurrence of a -noarchive or -so_archive
      option.

  -so_archive
      Turn off either the -noarchive or -noso options allowing -l references
      to resolve to either shared objects or archive libraries in shared or
      call_shared links. This option is position sensitive.

I've tried this on the cfengine link by using:

        .... -Wl,-noso -ldb -Wl,-so_archive

And this works.. but it's messy to say the least! Any ideas, tips on how to
resolve this in a proper way?!


[1]
http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/V50_HTML/MAN/MAN1/0241
____.HTM
______________________________________________________________________
The OpenPKG Project                                    www.openpkg.org
Developer Communication List                   [EMAIL PROTECTED]

Reply via email to