Re: .la file dependency_libs dropping sole -lm dependency
Bob Friesenhahn <[email protected]> Wed, 31 Jan 2024 13:49:52 -0600 (CST)
| Newsgroups | gmane.comp.gnu.libtool.general |
|---|---|
| Message-ID | <[email protected]> |
> > Well this definitely looks like a bug. I can't imagine any reason that > would be correct. I'm trying to reproduce it now, with GraphicsMagick. > > I filed a bug [1]. Thanks for the detailed report! Thank you very much for volunteering to be a libtool maintainer. You would need latest GraphicsMagick code from Mercurial in order to reproduce. And then configure with something like: configure 'CC=gcc-10' 'CXX=g++-10' 'CFLAGS=-O2 -g -Wall -Winline -W -Wformat-security -Wpointer-arith -Wdisabled-optimization -Wmissing-noreturn -Wno-unknown-pragmas -Wunused-but-set-variable' 'CXXFLAGS=-O -g -Wall -Winline -W -Wextra -Wno-unknown-pragmas' 'LDFLAGS=-L/usr/local/lib -Wl,-rpath,/usr/local/lib' '--enable-maintainer-mode' '--disable-silent-rules' '--with-quantum-depth=16' '--disable-shared' '--enable-static' '--disable-openmp' '--without-threads' '--without-bzlib' '--without-dps' '--without-fpx' '--without-gs' '--without-jbig' '--without-webp' '--without-heif' '--without-jpeg' '--without-jp2' '--without-jxl' '--without-lcms2' '--without-lzma' '--without-png' '--without-tiff' '--without-trio' '--without-ttf' '--without-wmf' '--without-xml' '--without-zlib' '--without-zstd' '--without-x' However, I now know what the problem is. Recently there is a desire to link using the C++ compiler because there are C++ libraries involved and it is said that it is most portable to link using the C++ compiler (so exceptions are assured to work, etc.). After adding --debug to the libtool flags, I can see that there is tremendous effort to reject libraries that the compiler adds by default. The testing is being done with the C++ compiler and it seems like -lm is added by default when using the C++ compiler. It also seems that -lm is not added by default when using the C compiler. The -lm library is omitted due to the C++ compiler, but the utilities/gm program (a tiny bit of C code) is still being linked using the C compiler. If I link it using the C++ compiler, then there is a successful link. If libtool is going to test based on the C++ compiler, then it should also assure that linkage of dependent programs is done using the C++ compiler. I now know how to solve this issue as pertains to GraphicsMagick. It seems that this disparity between C and C++ may cause harm for other software as well. The issue with -lm is well hidden because many libraries depend on -lm and if shared libraries depending on -lm are linked with, then a linkage dependency with -lm is implicitly added, hiding the underlying issue. 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