Re: static linkage...



On Mon, 15 Dec 2003, Andreas Boerner wrote:

Problem: I need the mc on a system to be installed, where the (shared)
libraries are (yet) missing; so I need a statically linked mc.

I suggest to to add an option for the ./configure to allow static linkage.

Doing this manually is time consuming and needed several repairs:

Maybe we should make those repairs rather that introduce one more option?

(gentoo linux; system is up to date (Dec, 15th, 2003))

Debian unstable: glib 2.2.3, Autoconf 2.58.  I'm using Automake 1.8
installed in /usr/local.

setting environment variable LDFLAGS to -Wl,-static

It's better to set variable on the command line:
./configure LDFLAGS="-Wl,-static"

compile error: library glib-2.0 not found

Works for me, even if I use the environment:

checking for pkg-config... /usr/bin/pkg-config
checking for glib-2.0... yes
checking GLIB_CFLAGS... -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include
checking GLIB_LIBS... -lglib-2.0

Since the error is on your side, you should post details, not me.  Check
config.log for relevant error messages.

changing within the link command glib-2.0 to glib solved it.

I think you have libglib.a but not libglib-2.0.a.  The problem is either
in the gentoo package or in pkg-config or in glib.m4.  It depends on who
misunderstood whose intentions.  You may want to research this question or
at least file a bug with gentoo.  Even if problem is elsewhere, another
distibution (Debian) made the static library compatible with pkg-config
and glib.m4, and so should gentoo.

gcc -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -g -O2 -Wall
-Wl,-static -o mc achown.o background.o boxes.o chmod.o chown.o cmd.o
color.o command.o complete.o cons.handler.o dialog.o dir.o dlg.o ext.o
file.o filegui.o filenot.o fileopctx.o find.o findme.o fsusage.o help.o
hotlist.o info.o key.o keyxdef.o layout.o learn.o listmode.o main.o
menu.o mountlist.o mouse.o option.o panelize.o popt.o poptconfig.o
popthelp.o poptparse.o profile.o regex.o rxvt.o screen.o setup.o slint.o
subshell.o terms.o text.o textconf.o tree.o treestore.o user.o util.o
utilunix.o view.o widget.o win.o wtools.o ../edit/libedit.a
../vfs/libvfs-mc.a -lglib-2.0 -lgpm -lslang -lext2fs -lcom_err

some thread references were missing...

was solved by specifying ./configure --without-x ??

Actually, the error messages would be more interesting than the command
line.  I have no idea if those messages are related to static linking.

I could not reproduce this problem.

With these modifications I was able to build mc statically by sending
the modified link command isolated to the shell.

I suggest to be able to do:

./configure --static

That would be equivalent to what you did initially:
./configure LDFLAGS="-Wl,-static"

Adding an option doesn't automatically solve any problems with the
functionality it stands for.

-- 
Regards,
Pavel Roskin



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