mm2 / Little-CMS

A free, open source, CMM engine. It provides fast transforms between ICC profiles.
https://www.littlecms.com
MIT License
549 stars 174 forks source link

2.15: build fails because missing `sqrt()` detection #369

Closed kloczek closed 8 months ago

kloczek commented 1 year ago
[tkloczko@pers-jacek x86_64-redhat-linux-gnu]$ ninja
[1/4] Linking target utils/samples/roundtrip
FAILED: utils/samples/roundtrip
/usr/bin/gcc  -o utils/samples/roundtrip utils/samples/roundtrip.p/roundtrip.c.o -Wl,--as-needed -Wl,--no-undefined -Wl,--as-needed -Wl,--gc-sections -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -flto=auto -flto-partition=none -fuse-linker-plugin -Wl,--build-id=sha1 -O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none '-Wl,-rpath,$ORIGIN/../../src' -Wl,-rpath-link,/home/tkloczko/rpmbuild/BUILD/Little-CMS-lcms2.15/x86_64-redhat-linux-gnu/src -Wl,--start-group src/liblcms2.so.2.0.15 -Wl,--end-group
/usr/bin/ld: /tmp/cccFX0fz.lto.o: undefined reference to symbol 'sqrt@@GLIBC_2.2.5'
/usr/bin/ld: /usr/lib64/libm.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
[3/4] Linking target utils/samples/wtpt
FAILED: utils/samples/wtpt
/usr/bin/gcc  -o utils/samples/wtpt utils/samples/wtpt.p/wtpt.c.o utils/samples/wtpt.p/.._common_vprf.c.o utils/samples/wtpt.p/.._common_xgetopt.c.o -Wl,--as-needed -Wl,--no-undefined -Wl,--as-needed -Wl,--gc-sections -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -flto=auto -flto-partition=none -fuse-linker-plugin -Wl,--build-id=sha1 -O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none '-Wl,-rpath,$ORIGIN/../../src' -Wl,-rpath-link,/home/tkloczko/rpmbuild/BUILD/Little-CMS-lcms2.15/x86_64-redhat-linux-gnu/src -Wl,--start-group src/liblcms2.so.2.0.15 -Wl,--end-group
/usr/bin/ld: /tmp/ccJqTE6T.lto.o: undefined reference to symbol 'sqrt@@GLIBC_2.2.5'
/usr/bin/ld: /usr/lib64/libm.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

IIRC some parts of the libm on *BSD have been moved to libc so it cannot be just simple libm detection ad add missing -lm on linking. Best would be use something like AC_SEARCH_LIBS() from autoconf however I cannot find something simillar in case of meson.

mm2 commented 1 year ago

Thanks for reporting. I assume this only affects to meson build, which is sort of experimental right now.

kloczek commented 1 year ago

I did not check GNU autotools and yes in this case it is about meson.

eli-schwartz commented 1 year ago

IIRC some parts of the libm on *BSD have been moved to libc so it cannot be just simple libm detection ad add missing -lm on linking.

It literally can be. :)

This was already detected and fixed in #362, by adding m_dep to additional targets that need it (already defined by the meson equivalent of AC_SEARCH_LIBS).

mm2 commented 8 months ago

Cannot reproduce anymore