Skip to content

Commit

Permalink
Fix linking with internal libraries.
Browse files Browse the repository at this point in the history
When building fflas-ffpack with slibtool it fails.

ld: cannot find -lfflas
ld: cannot find -lffpack

This reveals several issues.

* Internal libraries should never link with linker flags and
  should use the libtool archive (.la) files instead.
* These should be added to LIBADD for libraries or LDADD for
  programs and never to LDFLAGS which is only for other linker
  flags.
* The _DEPENDENCIES do not need to be set manually since they
  the defaults will be correct if the LIBADD/LDADD variables
  are set correctly.
* This issue is masked if fflas-ffpack is already installed
  where -lfflas and -lffpack are found installed on the system
  and not in the build directory.

Making these changes allows both slibtool and GNU libtool to
build correctly, the latter is far more permissive and silently
hides this issue.
  • Loading branch information
orbea committed May 3, 2021
1 parent 681b45a commit fb59404
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions fflas-ffpack/interfaces/libs/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -60,27 +60,24 @@ libfflas_la_LDFLAGS= $(LDADD) -version-info 1:0:0 \

libffpack_la_SOURCES= ffpack_inst.C \
ffpack_inst_implem.inl
libffpack_la_LIBADD= libfflas.la
libffpack_la_LDFLAGS= $(LDADD) -version-info 1:0:0 \
-no-undefined $(top_builddir)/fflas-ffpack/interfaces/libs/libfflas.la

EXTRA_libffpack_la_DEPENDENCIES= libfflas.la
-no-undefined

libfflas_c_la_SOURCES=fflas_lvl1.C \
fflas_lvl2.C \
fflas_lvl3.C \
fflas_sparse.C
#libfflas_c_la_CPPFLAGS=$(AM_CPPFLAGS) -DFFLAS_COMPILED -DFFPACK_COMPILED
libfflas_c_la_LIBADD= libfflas.la
libfflas_c_la_LDFLAGS= $(LDADD) -version-info 1:0:0 \
-no-undefined $(top_builddir)/fflas-ffpack/interfaces/libs/libfflas.la

EXTRA_libfflas_c_la_DEPENDENCIES=libfflas.la
-no-undefined

libffpack_c_la_SOURCES=ffpack.C
#libffpack_c_la_CPPFLAGS=$(AM_CPPFLAGS) -DFFLAS_COMPILED -DFFPACK_COMPILED
libffpack_c_la_LIBADD= libfflas.la libffpack.la
libffpack_c_la_LDFLAGS= $(LDADD) -version-info 1:0:0 \
-no-undefined -lfflas -lffpack
EXTRA_libffpack_c_la_DEPENDENCIES=libffpack.la

-no-undefined

EXTRA_DIST=c_libs.doxy

Expand Down

0 comments on commit fb59404

Please sign in to comment.