SDL2 installs own cmake configuration to /usr/lib/cmake/SDL2/sdl2-config.cmake There is an instruction to specify libSDL2.so library directly by path, rather then by -lSDL2. add_library(SDL2::SDL2 SHARED IMPORTED) set_target_properties(SDL2::SDL2 PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${prefix}/include/SDL2" IMPORTED_LINK_INTERFACE_LANGUAGES "C" IMPORTED_LOCATION "/usr/lib/libSDL2.so" INTERFACE_LINK_LIBRARIES "${SDL2_EXTRA_LINK_FLAGS}") Because of that, depended multilib builds will fail with /usr/lib/libSDL2.so: error adding symbols: file in wrong format For example faudio: [100%] Linking C shared library libFAudio.so /usr/bin/cmake -E cmake_link_script CMakeFiles/FAudio.dir/link.txt --verbose=1 /usr/bin/x86_64-pc-linux-gnu-gcc -fPIC -O2 -march=native -pipe -ftree-vectorize -flto -fuse-linker-plugin -mfpmath=sse -Wl,-O1 -Wl,--sort-common -flto -fuse-linker-plugin -shared -Wl,-soname,libFAudio.so.0 -o libFAudio.so.0.20.09 CMakeFiles/FAudio.dir/src/F3DAudio.c.o CMakeFiles/FAudio.dir/src/FACT3D.c.o CMakeFiles/FAudio.dir/src/FACT.c.o CMakeFiles/FAudio.dir/src/FACT_internal.c.o CMakeFiles/FAudio.dir/src/FAPOBase.c.o CMakeFiles/FAudio.dir/src/FAPOFX.c.o CMakeFiles/FAudio.dir/src/FAPOFX_echo.c.o CMakeFiles/FAudio.dir/src/FAPOFX_eq.c.o CMakeFiles/FAudio.dir/src/FAPOFX_masteringlimiter.c.o CMakeFiles/FAudio.dir/src/FAPOFX_reverb.c.o CMakeFiles/FAudio.dir/src/FAudio.c.o CMakeFiles/FAudio.dir/src/FAudioFX_reverb.c.o CMakeFiles/FAudio.dir/src/FAudioFX_volumemeter.c.o CMakeFiles/FAudio.dir/src/FAudio_internal.c.o CMakeFiles/FAudio.dir/src/FAudio_internal_simd.c.o CMakeFiles/FAudio.dir/src/FAudio_operationset.c.o CMakeFiles/FAudio.dir/src/FAudio_platform_sdl2.c.o CMakeFiles/FAudio.dir/src/XNA_Song.c.o CMakeFiles/FAudio.dir/src/FAudio_gstreamer.c.o /usr/lib/libSDL2.so -lgstaudio-1.0 -lgstapp-1.0 -lgstbase-1.0 -lgstreamer-1.0 -lgobject-2.0 -lglib-2.0 /usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib/libSDL2.so: error adding symbols: file in wrong format collect2: error: ld returned 1 exit status To fix the situation it's enough to patch this file with ${CMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX} like this: set_target_properties(SDL2::SDL2 PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${prefix}/include/SDL2" IMPORTED_LINK_INTERFACE_LANGUAGES "C" IMPORTED_LOCATION "/usr/lib${CMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX}/libSDL2.so" INTERFACE_LINK_LIBRARIES "${SDL2_EXTRA_LINK_FLAGS}") Reproducible: Always
Created attachment 670661 [details] Patched sdl2-config-version.cmake which works for me
Please convince me this is no duplicate of bug 644538.
/usr/lib/cmake /usr/lib/cmake/SDL2 /usr/lib/cmake/SDL2/sdl2-config-version.cmake /usr/lib/cmake/SDL2/sdl2-config.cmake /usr/lib64/cmake /usr/lib64/cmake/SDL2 /usr/lib64/cmake/SDL2/sdl2-config-version.cmake /usr/lib64/cmake/SDL2/sdl2-config.cmake If /usr/lib/ is hardcoded in /usr/lib/, and /usr/lib64/ is hardcoded in /usr/lib64/ that's fine, and only the (known) one-time breakage through the profile change exists and is fixed by rebuild of the package.
Well, I had rebuild SDL2 before I created this bug. Or you mean some other package? I really have these files: qlist media-libs/libsdl2 | grep cmake /usr/share/doc/libsdl2-2.0.12-r2/README-cmake.md.bz2 /usr/lib/cmake/SDL2/sdl2-config.cmake /usr/lib/cmake/SDL2/sdl2-config-version.cmake /usr/lib64/cmake/SDL2/sdl2-config.cmake /usr/lib64/cmake/SDL2/sdl2-config-version.cmake Still, there was an issue at least with faudio.
Created attachment 670733 [details] faudio-20.09: build.log
Created attachment 670736 [details] faudio-20.09: CMackeCache.txt
Created attachment 670739 [details] faudio-20.09: build.make
Well, according to --debug-find cmake tries defs from /usr/lib/cmake, not from /usr/lib64/cmake.
Created attachment 670802 [details] cmake --debug-find output cmake --debug-find -C /tmp/portage/app-emulation/faudio-20.09/work/FAudio-20.09-abi_x86_64.amd64/gentoo_common_config.cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_BINDIR=bin -DCMAKE_INSTALL_INCLUDEDIR=include/FAudio -DCMAKE_INSTALL_LIBDIR=lib64 -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DFORCE_ENABLE_DEBUGCONFIGURATION=OFF -DBUILD_TESTS=OFF -DBUILD_UTILS=OFF -DDUMP_VOICES=ON -DGSTREAMER=ON -DXNASONG=OFF -DCMAKE_BUILD_TYPE=Gentoo -DCMAKE_TOOLCHAIN_FILE=/tmp/portage/app-emulation/faudio-20.09/work/FAudio-20.09-abi_x86_64.amd64/gentoo_toolchain.cmake /tmp/portage/app-emulation/faudio-20.09/work/FAudio-20.09 2>log.txt.2 1>log.txt.1
Please make sure your /usr/lib is no symlink to /usr/lib64. (In reply to Alexey Shevchuck from comment #0) > SDL2 installs own cmake configuration to > /usr/lib/cmake/SDL2/sdl2-config.cmake > > There is an instruction to specify libSDL2.so library directly by path, > rather then by -lSDL2. > > add_library(SDL2::SDL2 SHARED IMPORTED) > set_target_properties(SDL2::SDL2 PROPERTIES > INTERFACE_INCLUDE_DIRECTORIES "${prefix}/include/SDL2" > IMPORTED_LINK_INTERFACE_LANGUAGES "C" > IMPORTED_LOCATION "/usr/lib/libSDL2.so" > INTERFACE_LINK_LIBRARIES "${SDL2_EXTRA_LINK_FLAGS}") Again, coming back to your initial description, this is completely fine and what you should have been looking at ever only was the cmake files below /usr/lib64. If you meddled with cmake and -configs as described here and in other bugs I can only assume you broke your system.
Ok. What can be broken and how to check that?
Well, this is certainly not an faudio issue. I unpacked fresh gentoo profile, and yes, it's fine there. The problem is my cmake for some strange reason starts to find packages (and everything) from /usr/lib, not /usr/lib64.