Ticket #2129 (new defect)

Opened 15 years ago

Last modified 11 years ago

--enable-static has no effect

Reported by: slyfox Owned by:
Priority: major Milestone: Future Releases
Component: mc-core Version: 4.7.1
Keywords: Cc: metux
Blocked By: Blocking: #2148
Branch state: no branch Votes for changeset:

Description (last modified by slyfox) (diff)

Static builds seems to be broken:

$ _mc-bin/bin/mc --version
GNU Midnight Commander 4.7.1-118-g9b41d62
$ LDFLAGS=-all-static ./configure --prefix=$(pwd)/_mc-bin \
                --with-samba \
                --with-mcfs \
                --enable-charset \
                --enable-extcharset \
                --enable-maintainer-mode \
                --with-glib-static \
                --enable-mcserver
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether to enable maintainer-specific portions of Makefiles... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking for style of include used by make... GNU
checking for gcc... gcc
checking for C compiler default output file name... 
configure: error: in `/home/slyfox/dev/git/mc-build.all-static':
configure: error: C compiler cannot create executables
See `config.log' for more details.

LDFLAGS=-static does not have any effect, Libtool seems to skip it on executable binaries.

It can easily be my misunderstanding on how to use it.

Change History

comment:1 Changed 15 years ago by andrew_b

  • Blocking 2148 added

comment:2 follow-up: ↓ 3 Changed 15 years ago by and

Hi slyfox,
with --enable-static you build a static mc library (lib/.libs/libmc.a).
That is not what you want. You want a static binary.
please try:

# make clean && make LDFLAGS=-all-static

compile result should be:

# ldd src/mc
        not a dynamic executable

comment:3 in reply to: ↑ 2 ; follow-up: ↓ 4 Changed 15 years ago by slyfox

  • Description modified (diff)

Replying to and:

Hi slyfox,
with --enable-static you build a static mc library (lib/.libs/libmc.a).
That is not what you want. You want a static binary.
please try:

# make clean && make LDFLAGS=-all-static

compile result should be:

# ldd src/mc
        not a dynamic executable

I tried this one, but I (quite narurally) use ./configure --enable-maintainer-mode, which is smart enough to rerun configure when I pass LDFLAGS to make. It results in reconfigure breakage.

AFAIU LDFLAGS=-all-static ./configure --enable-maintainer-mode ${other_opts} should work, I'll change bug description.

comment:4 in reply to: ↑ 3 Changed 14 years ago by metux

  • Cc metux added

See branch:2129_static_build

BUT: unfortunately that doesn't work as g_module_open() crashes while trying to load libX11.

That's one of the classic cases, why I always strongly advise people
*NOT* to use runtime library loading, unless you know *EXACTLY*
what you're doing. Those things won't work with static executables.
(well, in theory it _could_ work, but requires a lot of linker magic ;-o)

Last edited 13 years ago by angel_il (previous) (diff)

comment:5 Changed 14 years ago by andrew_b

Where is the branch?

comment:7 Changed 13 years ago by andrew_b

  • Branch state set to no branch
  • Milestone changed from 4.7 to Future Releases

comment:8 Changed 11 years ago by andrew_b

Ticket #3127 has been marked as a duplicate of this ticket.

Note: See TracTickets for help on using tickets.