Odd linking behavior (RH 5.1)

Jeffrey A Law law@cygnus.com
Tue Sep 8 20:53:00 GMT 1998


  In message < 199809082209.QAA04470@helicon.physics.colostate.edu >you write:
  > 
  > Hi Folks,
  > 
  >    I thought this was odd: I just upgraded to egcs 1.1b, and a linking
  >    stage command that used to work now does not:
  > 
  > c++ -ansi -Wall  -o eigen eigen.o -llapack -lblas -lf2c
  > /usr/lib/libf2c.so: undefined reference to `MAIN__'
  > 
  > 
  >    Which seems to indicate it's trying to link in libf2c.so instead of
  >    libf2c.a. Indeed, when I give the f2c library name explicitly:
  > 
  > c++ -ansi -Wall  -o eigen eigen.o -llapack -lblas /usr/lib/libf2c.a
  > 
  >    It also works if I use the static switch, a la:
  > 
  > c++ -ansi -Wall -static -o eigen eigen.o -llapack -lblas -f2c.a
  > 
  >    everything's fine. Anybody know why it's trying to pick up the
  >    shared library by default?
Most linkers will always select a shared library over a static one.

jeff



More information about the Gcc-bugs mailing list