Re: gcc -static on Solaris




Marc <marc@upr41.univ-rennes1.fr> writes:

> Thanks to those who provided me help on my last question (about gcc
> warning...).
> 
> I have another problem with gcc under Solaris.
> 
> Here is the linking part of my Makefile:
> 
> gcc -static my_object_files.o \
> /usr/local/lib/libgtk.a /usr/local/lib/libgdk.a /usr/local/lib/libglib.a
> \
> -L/usr/openwin/lib -lX11 -lXext -lm -lsocket -lnsl -o my_prog_static
> 
> I have no problem with this when compiling under Linux (libc5).
> But here are the error messages I have when compiling under Solaris.
> 
> Undefined                       first referenced
>  symbol                             in file
> dlclose                             /usr/lib/libnsl.a(netdir.o)
> wslen                              
> /usr/openwin/lib/libX11.a(XSunWcTProp.o)
> dgettext                            /usr/lib/libnsl.a(netselect.o)
> dlsym                              
> /usr/openwin/lib/libX11.a(XConnDis.o)
> dlopen                             
> /usr/openwin/lib/libX11.a(XConnDis.o)
> dlerror                             /usr/openwin/lib/libX11.a(XlcWrap.o)
> ld: fatal: Symbol referencing errors. No output written to
> my_prog_static
> 
> Any hints ?

If I recall correctly, you cannot use the dlopen() family
of functions from within a statically linked program under
Solaris. Since GTK+ relies on these functions for module 
loading, you probably will not be able compile GTK+ programs
statically on Solaris.

(The module loading is actually not mandatory - you may
 be able to disable the detection on Solaris by configuring
 GLib as:

  G_MODULE_IMPL=0 ./configure

 I haven't actually tried this though)

However, before giving up, it's possible, that you're just
missing some necessary libraries. You check that you
are including all libraries listed in the output
of gtk-config --libs.

Regards,
                                        Owen



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