.la file dependency_libs dropping sole -lm dependency
Bob Friesenhahn <[email protected]> Wed, 31 Jan 2024 09:33:28 -0600 (CST)
| Newsgroups | gmane.comp.gnu.libtool.general |
|---|---|
| Message-ID | <[email protected]> |
I am encountering an issue when building a static build of GraphicsMagick in that although -lm is supplied to libtool while linking the static library, the associated .la file is missing -lm in dependency_libs. If several more libraries are specified (also including -lm) then they all seem to be included in dependency_libs. The linkage is using --tag=CXX because there are some modules compiled with C++. Programs which depend on the library fail to link due to missing the symbols from '-lm'. The libtool used reports itself as % /usr/local/bin/libtool --version libtool (GNU libtool) 2.4.7 Written by Gordon Matzigkeit, 1996 Copyright (C) 2014 Free Software Foundation, Inc. which I think is confusing since the tarball date is 2022-03-17 and the copyright at the top of libtool.m4 is up to 2022 although several lines down where the copyright message comes from, I see "Copyright (C) 2014 Free Software Foundation, Inc.". The OS used is Ubuntu 20.04 LTS. My expectation is that the .la file in the build tree will remember which compiler/language needs to be used for linking, and remember the library dependencies, so that dependent libraries and programs which depend on the library do not need to. In magick/libGraphicsMagick.la, I see: # Libraries that this one depends upon. dependency_libs=' -L/usr/local/lib' rather than this: # Libraries that this one depends upon. dependency_libs=' -L/usr/local/lib' -lm As a result, linking fails when programs which depend on this library attempt to link with it using libtool in the same build. The linking request looks somewhat like (abbreviated for clarity): bin/bash ./libtool --tag=CXX --mode=link g++-10 -no-undefined -export-symbols-regex ".*" -version-info 27:4:24 -L/usr/local/lib -Wl,-rpath,/usr/local/lib -o magick/libGraphicsMagick.la -rpath /usr/local/lib [ list of .lo files ] -lm An I misunderstanding something, or is this a bug in libtool? What am I missing in order for this to work? Bob -- Bob Friesenhahn [email protected], http://www.simplesystems.org/users/bfriesen/ GraphicsMagick Maintainer, http://www.GraphicsMagick.org/ Public Key, http://www.simplesystems.org/users/bfriesen/public-key.txt