This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

-llibrary's position in ld cause with -static


Hello, 
  I'm not quite sure whether this is a bug in ld or gcc or just wrong
  usage. I tried following command on a FreeBSD 4.8 with gcc3.2:
  g++ -static  -o src/maxent src/maxent.o src/maxent_cmdline.o -Lsrc
  -lgnugetopt  -lg2c -lmaxent
  where libmaxent is a C++ lib (with some fortran module linked in it)
  and g2c is a C lib comes with g77 lbfgs.os is a fortran module in 
  libmaxent.a.
  g++ fails to find some function entries in libg2c:
  src/libmaxent.a(lbfgs.os): In function `lbfgs_':
  lbfgs.os(.text+0x76): undefined reference to `s_wsfe'
  lbfgs.os(.text+0x7b): undefined reference to `e_wsfe'
  lbfgs.os(.text+0x6c7): undefined reference to `s_wsfe'
  lbfgs.os(.text+0x6db): undefined reference to `do_fio'
  ...

  But when I switched the positions of -lg2c and -lmaxent:
  g++ -static  -o src/maxent src/maxent.o src/maxent_cmdline.o -Lsrc
  -lgnugetopt  -lmaxent -lg2c 
  It works.

  I also observed when linking without -static, both version work fine.

  Could you give me a explanation of this behavior? Or I just find a
  bug?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]