arved
arved

Reputation: 4576

libtool automake: LIBADD broken with static linking?

I have a program aa that depends on libbb which depends on libcc.

In libb's Makefile.am I have added

libbb_la_LIBADD = -lcc

In aa's Makefile I have added

aa_LDADD = -lbb

This works wonderful in the default case.

But I needed static linking, so I ran all the configures with --disable-shared.
Unfortunately when compiling aa I got:

libb_source.c: undefined reference to libcc_symbol

Any ideas what is missing?

Update: Don't think of specifying dependencies like this if you are crosscompiling and using a stagingdir.

Upvotes: 3

Views: 3570

Answers (1)

Jack Kelly
Jack Kelly

Reputation: 18657

Don't pass the link flag. Give it the name of the libtool archive and let automake work it out:

aa_LDADD = bb/libbb.la

In case you ever want to build Windows DLLs, you might also want to put -no-undefined in libbb_la_LDFLAGS.

Upvotes: 1

Related Questions