Emerging media-gfx/freecad-0.19_pre20201231 fails with the following error: FAILED: bin/FreeCAD : && /usr/bin/x86_64-pc-linux-gnu-g++ -Wall -Wextra -Wno-write-strings -O2 -pipe -march=znver2 -mtune=native -Wl,-O1 -Wl,--as-needed -Wl,--defsym=__gentoo_check_ldflags__=0 src/Main/CMakeFiles/FreeCADMain.dir/MainGui.cpp.o -o bin/FreeCAD -Wl,-rpath,/var/tmp/portage/media-gfx/freecad-0.19_pre20201231/work/freecad-0.19_pre20201231_build/lib: -lmpi_cxx -lmpi lib/libFreeCADGui.so lib/libFreeCADApp.so lib/libFreeCADBase.so -lmpi_cxx -lmpi /usr/lib64/libxerces-c.so -lz /usr/lib64/libpython3.8.so -lutil -ldl /usr/lib64/libQt5Xml.so.5.15.2 /usr/lib64/libCoin.so /usr/lib64/libboost_filesystem-mt.so /usr/lib64/libboost_program_options-mt.so /usr/lib64/libboost_regex-mt.so /usr/lib64/libboost_system-mt.so /usr/lib64/libboost_thread-mt.so /usr/lib64/libboost_chrono-mt.so /usr/lib64/libboost_date_time-mt.so /usr/lib64/libboost_atomic-mt.so -lpthread /usr/lib64/libQt5OpenGL.so.5.15.2 /usr/lib64/libQt5PrintSupport.so.5.15.2 /usr/lib64/libQt5Svg.so.5.15.2 /usr/lib64/libQt5UiTools.a /usr/lib64/libQt5Widgets.so.5.15.2 /usr/lib64/libQt5Gui.so.5.15.2 /usr/lib64//libQt5Widgets.so /usr/lib64//libQt5Gui.so /usr/lib64//libQt5Core.so /usr/lib64//libQt5Widgets.so /usr/lib64//libQt5Gui.so /usr/lib64//libQt5Core.so /usr/lib64/libGL.so -lpthread /usr/lib64/libspnav.so /usr/lib64/libpyside2-python3.8.so.5.15.1 /usr/lib64/libshiboken2-python3.8.so.5.15.1 /usr/lib64/libQt5Network.so.5.15.2 /usr/lib64/libQt5Core.so.5.15.2 && : /usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libsimage.so.20: undefined reference to `sf_open' /usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libsimage.so.20: undefined reference to `sf_seek' /usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libsimage.so.20: undefined reference to `sf_close' /usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libsimage.so.20: undefined reference to `sf_read_double' /usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libsimage.so.20: undefined reference to `sf_command' collect2: error: ld returned 1 exit status Updating media-libs/simage from 1.8.0 to 1.8.1 fixed the problem. Reproducible: Always
Looks like a bug in =simage-1.8.0-r1 rather than freecad. sf_open and the like are from libsndfile which should, in theory, only be used with simage[sndfile]. However, despite USE=-sndfile, if =simage-1.8.0-r1 is built while libsndfile was available on the system it still references symbols from it (without linking): $ gcc -o test test.c `pkg-config --cflags --libs simage` -lm /usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../lib64/libsimage.so: undefined reference to `sf_open' So anything using it will fail, not just freecad. No problems if I rebuild simage without libsndfile on the system.
Changing summary given it's 1.8.0-r1 that's affected and 1.8.1 fixes the issue. Then again I'd argue it should instead read as: "media-libs/simage-1.8.1 stabilization"
The issue has been know for <simage-1.8.1 for some time, see for example https://github.com/waebbl/waebbl-gentoo/issues/274 for discussion on that topic and https://github.com/coin3d/simage/issues/46 for fixes in 1.8.1 of this issue. We could either stabilize 1.8.1, IMO it's been around long enough, or explicitly depend freecad on >=media-libs/simage-1.8.1.
*** This bug has been marked as a duplicate of bug 708894 ***