Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#322 closed task (invalid)

Is `configure --enable-staticbin` really creating a statically linked binary?

Reported by: Jari Häkkinen Owned by: Jari Häkkinen
Priority: major Milestone:
Component: core Version: trunk
Keywords: Cc:

Description (last modified by Jari Häkkinen)

I am not sure that we actually create an "as static as possible" binary with the configure option. This needs to be examined.

We'll remove libtool support from svndigest, it should not be there. This ticket becomes invalid. A need for creating completely static binaries may be targetet later when that need appears.

Change History (11)

comment:1 Changed 15 years ago by Peter Johansson

I think staticbin and dynamicbin should not be mutually exclusive.

We could add a configure option flag `--disable-sharedbin'.

There are nice examples in the libtool of this kind of features

http://www.gnu.org/software/libtool/manual/libtool.html#Using-Automake

comment:2 Changed 15 years ago by Peter Johansson

We use LDFLAGS=-static to enable build of static binary. Elsewhere I found out that this likely not the right flag to use. From the libtool manual:

-static

If output-file is a program, then do not link it against any uninstalled shared libtool libraries. If output-file is a library, then only create a static library.

-all-static

If output-file is a program, then do not link it against any shared libraries at all. If output-file is a library, then only create a static library.

In other words, if we use -static we will link against shared installed libraries. Not exactly what we intended. The solution seems to be to use flag -all-static instead.

However, when I tried this quickly on svndigest it did not pass through, but complained about something that looked like APR was missing (well no static APR). Will look into that in more detail when I have time.

comment:3 Changed 15 years ago by Jari Häkkinen

I am not sure that going for -all-static is a great idea. The reason for my doubt is that modern systems do not come pre-installed with static-libraries. If -all-static requires static libraries to exist, then most systems will fail creating the binary.

The "as static as possible" refers to make the linker use as many static libraries as possible ... at least the libsvndigest should be statically linked.

comment:4 Changed 15 years ago by Jari Häkkinen

Now, I cannot create a dynamically linked svndigest binary!

comment:5 in reply to:  1 ; Changed 15 years ago by Jari Häkkinen

Status: newassigned

Replying to peter:

I think staticbin and dynamicbin should not be mutually exclusive.

We could add a configure option flag `--disable-sharedbin'.

There are nice examples in the libtool of this kind of features

http://www.gnu.org/software/libtool/manual/libtool.html#Using-Automake

What do you mean? At compile time we can only create one binary. This must be statically or dynamically linked? The default is to create a dynamically linked binary. --enable-staticbin will change this to create a static binary, at least the libsvndigest dependency will go away.

comment:6 in reply to:  5 Changed 15 years ago by Peter Johansson

Replying to jari:

Replying to peter:

I think staticbin and dynamicbin should not be mutually exclusive.

We could add a configure option flag `--disable-sharedbin'.

There are nice examples in the libtool of this kind of features

http://www.gnu.org/software/libtool/manual/libtool.html#Using-Automake

What do you mean? At compile time we can only create one binary. This must be statically or dynamically linked? The default is to create a dynamically linked binary. --enable-staticbin will change this to create a static binary, at least the libsvndigest dependency will go away.

Well in principle you can create as many binaries as you want. Only one named svndigest though. It was just an idea; I don't really care about it. I'm more concerned about waht we mean by staticbin or what we mean by the sentence: A statically linked 'svndigest' binary will be created. in configure. This is misleading. And in README we say: --enable-staticbin will create a static svndigest binary, which also should be clarified.

comment:7 in reply to:  5 ; Changed 15 years ago by Peter Johansson

Replying to jari:

Replying to peter:

The default is to create a dynamically linked binary. --enable-staticbin will change this to create a static binary, at least the libsvndigest dependency will go away.

But is there any libsvndigest dependency? I tried

$ make && (cd lib && make clean) && ./bin/svndigest -h

and it worked perfectly, so what does dependency mean here?

comment:8 in reply to:  7 ; Changed 15 years ago by Peter Johansson

Replying to peter:

Replying to jari:

Replying to peter:

The default is to create a dynamically linked binary. --enable-staticbin will change this to create a static binary, at least the libsvndigest dependency will go away.

But is there any libsvndigest dependency? I tried

$ make && (cd lib && make clean) && ./bin/svndigest -h

and it worked perfectly, so what does dependency mean here?

Hm after [667] that seems to not be true anymore.

comment:9 in reply to:  8 Changed 15 years ago by Jari Häkkinen

Replying to peter:

Replying to peter:

Replying to jari:

Replying to peter:

The default is to create a dynamically linked binary. --enable-staticbin will change this to create a static binary, at least the libsvndigest dependency will go away.

But is there any libsvndigest dependency? I tried

$ make && (cd lib && make clean) && ./bin/svndigest -h

and it worked perfectly, so what does dependency mean here?

Hm after [667] that seems to not be true anymore.

Yes, because changeset:667 actually makes autotools to create a shared library. Before 667 there was no shared library and therefore svndigest was static wrt libsvndigest.

To check library dependencies for a binary use on linux:

ldd progname

on Macosx

otool -L progname

comment:10 Changed 15 years ago by Jari Häkkinen

Description: modified (diff)
Resolution: invalid
Status: assignedclosed

comment:11 Changed 15 years ago by Peter Johansson

Milestone: svndigest 0.x+

Avoid having closed tickets in milestone:"svndigest 0.x+"

Note: See TracTickets for help on using tickets.