castano / nvidia-texture-tools

Texture processing tools with support for Direct3D 10 and 11 formats.
https://github.com/castano/nvidia-texture-tools/wiki
Other
578 stars 214 forks source link

undefined reference to symbol '_ZN2nv3Fit37computePrincipalComponent_EigenSolverEiPKNS_7Vector4E' #265

Closed Mailaender closed 6 years ago

Mailaender commented 7 years ago

Version 2.1.0 on @openSUSE Tumbleweed:

[   23s] [ 99%] Linking CXX executable nvtestsuite
[   23s] cd /home/abuild/rpmbuild/BUILD/nvidia-texture-tools-2.1.0/build/src/nvtt/tests && /usr/bin/cmake -E cmake_link_script CMakeFiles/nvtestsuite.dir/link.txt --verbose=1
[   23s] /usr/bin/c++  -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -g -fPIC -DNDEBUG -march=athlon64 -fPIC -fopenmp -O2 -g -DNDEBUG  -Wl,--as-needed -Wl,--no-undefined -Wl,-z,now -rdynamic CMakeFiles/nvtestsuite.dir/testsuite.cpp.o  -o nvtestsuite ../libnvtt.so ../../nvimage/libnvimage.so ../../nvmath/libnvmath.so ../../../extern/poshlib/libposh.a ../../bc7/libbc7.a ../../bc6h/libbc6h.a ../../nvthread/libnvthread.so ../../nvcore/libnvcore.so -ldl ../squish/libsquish.a 
[   23s] [100%] Linking CXX executable nvhdrtest
[   23s] cd /home/abuild/rpmbuild/BUILD/nvidia-texture-tools-2.1.0/build/src/nvtt/tests && /usr/bin/cmake -E cmake_link_script CMakeFiles/nvhdrtest.dir/link.txt --verbose=1
[   23s] /usr/bin/c++  -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -g -fPIC -DNDEBUG -march=athlon64 -fPIC -fopenmp -O2 -g -DNDEBUG  -Wl,--as-needed -Wl,--no-undefined -Wl,-z,now -rdynamic CMakeFiles/nvhdrtest.dir/hdrtest.cpp.o  -o nvhdrtest ../libnvtt.so ../../bc6h/libbc6h.a ../../nvimage/libnvimage.so ../../../extern/poshlib/libposh.a ../../bc6h/libbc6h.a ../../nvmath/libnvmath.so ../../bc7/libbc7.a ../../nvthread/libnvthread.so ../../nvcore/libnvcore.so -ldl ../squish/libsquish.a 
[   23s] /usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld: ../../bc7/libbc7.a(avpcl_mode6.cpp.o): undefined reference to symbol '_ZN2nv3Fit37computePrincipalComponent_EigenSolverEiPKNS_7Vector4E'
[   23s] ../../nvmath/libnvmath.so: error adding symbols: DSO missing from command line
[   23s] collect2: error: ld returned 1 exit status
[   23s] make[2]: *** [src/nvtt/tests/CMakeFiles/nvtestsuite.dir/build.make:107: src/nvtt/tests/nvtestsuite] Error 1
[   23s] make[2]: Leaving directory '/home/abuild/rpmbuild/BUILD/nvidia-texture-tools-2.1.0/build'
[   23s] make[1]: *** [CMakeFiles/Makefile2:1111: src/nvtt/tests/CMakeFiles/nvtestsuite.dir/all] Error 2
[   23s] make[2]: Leaving directory '/home/abuild/rpmbuild/BUILD/nvidia-texture-tools-2.1.0/build'
[   23s] [100%] Built target nvhdrtest
[   23s] make[1]: Leaving directory '/home/abuild/rpmbuild/BUILD/nvidia-texture-tools-2.1.0/build'
[   23s] make: *** [Makefile:166: all] Error 2

Looks like a linker problem, but I don't know how to solve this on my own. https://github.com/castano/nvidia-texture-tools/commit/f9a4787c062f0a2dcb9bab289e125569d1438875 did not help.

castano commented 7 years ago

It looks like dependencies between bc7 and nvmath are not setup correctly. Usually you don't need to resolve dependencies when creating static libraries, only when linking, so I'm not sure what that is failing.

Can you try updating the CMakeList file as follows?

ADD_LIBRARY(bc7 STATIC ${BC7_SRCS} nvmath ncore)

castano commented 7 years ago

Correction, try adding the following line after ADD_LIBRARY: TARGET_LINK_LIBRARIES(bc7 nvcore nvmath)

Mailaender commented 6 years ago

Which CMakeList file exactly? None of them contains the line ADD_LIBRARY: TARGET_LINK_LIBRARIES(bc7 nvcore nvmath) according to a source code search.

StefanBruens commented 6 years ago

Fixed by the second patch from #274

@Mailaender: see https://build.opensuse.org/package/show/home:StefanBruens:branches:graphics/nvidia-texture-tools