Re: Question about

On Tue, 16 Nov 1999 15:03:49 -0800 (PST), Derek Simkowiak wrote:
>      Is there an argument to GNU's ./ or ./configure script
> to have it compile a statically linked binary executable?


>      I've used Glade to build a U.I., now I want to link the GTK+ libs
> statically into my program.  I'm used to just going into the Makefile and
> adding "--static" to the CFLAGS variable, but that doesn't seem to work
> here (adding --static to the GTK_CFLAGS variable in the Makefile didn't
> work).

No, because it should be in the linker flags, not in the compiler flags.
It is also possible that it just doesn't work on your platform. Yes,
-static works on Linux, but it fails miserably on IRIX.

>      I also didn't see anything in config.h that looked like it
> applied.
>      Any suggestions?  

Assumed that you use Linux (you didn't tell us), you can use:

  gcc -o foo foo.o bar.o gnu.o gnats.o -Wl,-B,static -lgtk -lgdk -lglib \
    -Wl,-B,dynamic -lXext -lX11 -lm

This switches back and forth between static (gtk, gdk, and glib) and
dynamic linking (all other libraries).


J.A.K. (Erik) Mouw, Information and Communication Theory Group, Department
of Electrical Engineering, Faculty of Information Technology and Systems,
Delft University of Technology, PO BOX 5031,  2600 GA Delft, The Netherlands
Phone: +31-15-2785859  Fax: +31-15-2781843  Email

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]