Re: static linkage...

see my comments/questions/answers between the lines...

On Tue, 16 Dec 2003 01:42:26 -0500 (EST)
Pavel Roskin <proski gnu org> wrote:

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.


autoconf: 2.13
automake 1.7.5
glib: 2.2.3

these are the most up-to-date; gentoo doesn't provide newer versions; I guess they are considered to be 

setting environment variable LDFLAGS to -Wl,-static

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

I didn't know this; where is that documented? I searched the web for about half an hour but didn't find 
details on how to statically link mc.
And doing it that way doesn't change anything. Why is that better?

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

my output is identical!

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.

in the attachment you find the details;
output of configure is in conf.log
output of make is in make.log

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.

the gentoo distribution does not provide the option of static linkage at all;
so I had to download the sources by myself and build it manually without the
package-support of gentoo.

I guess the developer from gentoo who wrote the install script for mc did not knew about the way how to 
compile mc statically. Since there is no configure option for that it is hard to guess...

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.

I don't want to follow this path, since I made manual modifications. Maybe the tread_...
references are contained in glib-2.0, but not in glib ?? Or, more probable, some X-libraries contain thread 
references, since the error does not occur with --without-x

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.

Technically speaking, that is true. But I disagree anyway: If there would be such an option, it is more 
obvious for install script writers (of the distributions) to support this option. I think you could imagine 
thousand more flag settings, but who knows, which are senseful and is going to test them.
Static linkage in contrast isn't that fancy. 

My summary: A configure option --static is more user friendly; it is more likely to be tested and corrected, 
if it doesn't work. 

last question: To who should I send a bug report?
(I think, that if the gentoo distribution decides, that they do not want to support static linkage, then I 
should still be able to link it manually without getting errors. I think that the least thing to expect is, 
that everything that mc needs (to link statically), should be checked by the configure script, and be 
reported by an meaningful error message!)

Pavel Roskin

 -- Andreas

Attachment: config.log
Description: Text Data

Attachment: make.log
Description: Text Data

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