This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils 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]

Re: Calling shared libs from static libs


Andreas Schwab wrote:
Russell Shaw <rjshaw@iprimus.com.au> writes:

Is this a bug, or should -static apply globally?

It's not a bug. Use -Bstatic/-Bdynamic for selective static linking.


Andreas.

"man ld" lists them together:


  -Bstatic
  -dn
  -non_shared
  -static
      Do not link against shared libraries. This is...


However, i confirmed -Bstatic works. A doc bug should be filed.



I found another bug. This works:


  gcc -o shapegen main.o gui.o xmalloc.o object.o menu.o dialog.o
      -Wl,/usr/lib/libgtk-x11-2.0.a -Bstatic
      -lgdk-x11-2.0  -latk-1.0 -lgdk_pixbuf-2.0 -lpangoxft-1.0 -lpangox-1.0
      -lpango-1.0 -lgmodule-2.0 -lglib-2.0 -lgobject-2.0
      -Bdynamic -ldl -L /usr/X11R6/lib -lXinerama -lXi -lm -lc


This should do the same as above, but it gives tons of linker errors:


  gcc -o shapegen main.o gui.o xmalloc.o object.o menu.o dialog.o
      -Wl,-Bstatic -lgtk-x11-2.0
      -lgdk-x11-2.0  -latk-1.0 -lgdk_pixbuf-2.0 -lpangoxft-1.0 -lpangox-1.0
      -lpango-1.0 -lgmodule-2.0 -lglib-2.0 -lgobject-2.0
      -Bdynamic -ldl -L /usr/X11R6/lib -lXinerama -lXi -lm -lc


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