jcoppens
jcoppens

Reputation: 5440

libtool: Cannot find the library... Why?

Though I rarely create static libraries, after updating Slackware, I get the following error:

libtool: error: cannot find the library '/usr/lib64/libfontconfig.la' or unhandled argument '/usr/lib64/libfontconfig.la'

The project does not create libraries. Also Slackware removes the .la files.

Q: How can I find out which part of the program is requiring libfontconfig.la? And why?

Q: Should libtool be called at all?

Answers to your suggestions

From the make output, find which directory has the problem.

It's simply the src/ directory in the project root:

/bin/sh ../libtool  --tag=CC   --mode=link gcc -Wall -g -g -O2 -Wl,--export-dynamic  -o farma1 callbacks.o main.o extracts.o import.o my_sql.o paradox.o global.o article.o clients.o orders.o stats.o support.o interface.o sales.o fprint.o access.o mutual.o dialogs.o -lgnomeui-2 -lSM -lICE -lbonoboui-2 -lgnome-2 -lpopt -lbonobo-2 -lbonobo-activation -lORBit-2 -lgnomecanvas-2 -lart_lgpl_2 -lgnomevfs-2 -lgconf-2 -lgthread-2.0 -pthread -lgmodule-2.0 -pthread -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lharfbuzz -lfontconfig -lfreetype -lconfmgr3 -L/usr/lib64/ -lmariadb 
libtool:   error: cannot find the library '/usr/lib64/libfontconfig.la' or unhandled argument '/usr/lib64/libfontconfig.la'
make[1]: *** [Makefile:476: farma1] Error 1
make[1]: Leaving directory '/usr/local/projects/clients/farma/software/farma1a/src'

Examine the Makefile in that directory, and find which variable is assigned the string libfontconfig.la. It might be something like BLAH_LIBS = ${libdir}/libfontconfig.la

libfontconfig.la is never mentioned in that Makefile. It is included in FARMA1_LIBS =, I believe correctly, as -lfontconfig.

I also scanned /usr/lib64/pkgconfig for any file mentioning fontconfig. A few did mention it, but none mentioned a .la file.

To be sure, I also checked /usr/local/lib64/pkgconfig. I also scanned the entire project directory, recurively, and to no avail.

*** EDITED ***

While src/Makefile didn't require itself, it does seem to do so indirectly. I captured the libtool command's output, using: ../libtool --debug --tag=CC --mode=link gcc -Wall -g -g -O2 -Wl,--export-dynamic -o farma1 callbacks.o main.o extracts.o import.o my_sql.o paradox.o global.o article.o clients.o orders.o stats.o support.o interface.o sales.o fprint.o access.o mutual.o ..... -lconfmgr3 -L/usr/lib64/ -lmariadb > log 2>&1 and found, near the end, where the error occured:

...
case $1 in
+ . /usr/lib64//libgnomecanvas-2.la
++ dlname=libgnomecanvas-2.so.0
++ library_names='libgnomecanvas-2.so.0.3000.3 libgnomecanvas-2.so.0 libgnomecanvas-2.so'
++ old_library=libgnomecanvas-2.a
++ inherited_linker_flags=' -pthread'
++ dependency_libs=' -lgailutil -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lart_lgpl_2 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lharfbuzz /usr/lib64/libfontconfig.la -lexpat -lfreetype -lm'
++ weak_library_names=
++ current=3000
++
...

in the line starting with dependency_libs

Upvotes: 0

Views: 1107

Answers (1)

Jaredo Mills
Jaredo Mills

Reputation: 752

For your first question, the smoking gun is unhandled argument '/usr/lib64/libfontconfig.la' - this means that somewhere in your Makefiles, the string /usr/lib64/libfontconfig.la appears. It appears that your project depends directly or indirectly on the fontconfig library. The steps I'd use to trace this are:

  1. From the make output, find which directory has the problem.
  2. Examine the Makefile in that directory, and find which variable is assigned the string libfontconfig.la. It might be something like BLAH_LIBS = ${libdir}/libfontconfig.la
  3. That variable name, BLAH_LIBS is probably generated by pkgconfig, due to a configure.ac statement like PKG_CHECK_MODULES([BLAH], [blah]) which says 'look for the package "blah", and from its blah.pc file, construct the BLAH_LIBS and BLAH_CFLAGS variables by using the prefix BLAH and the suffix _LIBS and _CFLAGS, and substitute them in Makefiles wherever @BLAH_LIBS@ and @BLAH_CFLAGS@ appear'
  4. The file blah.pc, distributed by the blah package likely contains the hardcoded "libfontconfig.la" reference, on the Libs: line.

The bug is in the package blah, specifically the file /lib/pkgconfig/blah.pc or similar. It should be -lfontconfig rather than "libfontconfig.la"

For your second question, I agree that if your program does not create libraries, shared or static, it does not need to use libtools at all.

Upvotes: 1

Related Questions