** Description changed: [ Impact ] embree fails to build on amd64v3 with linker errors (undefined references to embree::sse42::*, embree::BVHN<4>::*, and embree::BVHNStatistics<4>::*). This blocks the package in stonking. [ Fix ] 1. In debian/rules, strip -march=x86-64-v3 from CFLAGS, CXXFLAGS, and LDFLAGS. - Embree builds separate ISA slices (SSE4.2, AVX, AVX2, AVX-512) and dispatches at runtime. With a global -march=x86-64-v3 flag, gcc defines __AVX2__ while compiling libembree_sse42.a, which puts those symbols into the avx2 namespace instead of sse42. Stripping the flag fixes 53 linker errors. Stripping from LDFLAGS stops LTO from re-adding it at link time. + Embree builds separate ISA slices (SSE4.2, AVX, AVX2, AVX-512) and dispatches at runtime. Stripping from LDFLAGS prevents LTO from re-adding -march=x86-64-v3 at link time. - 2. In kernels/bvh/bvh.cpp and kernels/bvh/bvh_statistics.cpp, drop the `#if !defined(__AVX__)` guards around `template class BVHN<4>;` and `template class BVHNStatistics<4>;`. - When AVX is set, these instantiations were omitted, but subdiv builders and postBuild() need them. + 2. In debian/rules, explicitly append -march=x86-64 to CFLAGS and CXXFLAGS on non-arm64 architectures. + On Ubuntu amd64v3 builders, GCC is configured with --with-arch-64=x86-64-v3 by default. When -march=x86-64-v3 is stripped, GCC falls back to this internal default, so compiling libembree_sse42.a with -msse4.2 still leaves __AVX2__=1 enabled. This places SSE4.2 symbols into the avx2 namespace instead of sse42, causing undefined reference errors during linking. Explicitly appending -march=x86-64 resets GCC's baseline architecture. + + 3. In kernels/bvh/bvh.cpp and kernels/bvh/bvh_statistics.cpp, drop the `#if !defined(__AVX__)` guards around `template class BVHN<4>;` and `template class BVHNStatistics<4>;`. + When AVX is set, these template instantiations were omitted, but subdiv builders and postBuild() require them. [ Test Plan ] - Build with DEB_CXXFLAGS_MAINT_APPEND="-march=x86-64-v3" (or in an amd64v3 chroot). - Without fix: fails at link stage with 59 undefined references. + Build with DEB_CXXFLAGS_MAINT_APPEND="-march=x86-64-v3" (or on an amd64v3 builder). + Without fix: fails at link stage with undefined references to embree::sse42 and embree::BVHN symbols. With fix: builds and links libembree4.so cleanly. [ Where problems could occur ] - We strip -march=x86-64-v3, so the baseline object files do not use v3 instructions directly. However, Embree uses internal runtime CPUID dispatch and already selects AVX2/AVX-512 kernels on supported CPUs. amd64 and arm64 builds do not pass this flag and are unaffected. + We explicitly set baseline -march=x86-64 for object compilation. Embree uses internal runtime CPUID dispatch to select AVX2/AVX-512 kernels on supported CPUs, so runtime performance on modern hardware is preserved. arm64 builds do not append -march=x86-64 and are unaffected. [ Other Info ] Target: Ubuntu Stonking (26.10). - Attached debdiff: embree_4.4.1+dfsg-2ubuntu1.debdiff - Test build PPA: https://launchpad.net/~ci-train-ppa-service/+archive/ubuntu/3997/+sourcepub/18801010/+listing-archive-extra - The broken link command in the original build log (#33012149) was just cmake stdout buffering mixed with compiler stderr. + Attached debdiff: embree_4.4.1+dfsg-2ubuntu1.debdiff (Attachment #6003165). + Initial PPA try failed because stripping alone left GCC defaulting to --with-arch-64=x86-64-v3; appending -march=x86-64 ensures generic baseline for sub-target ISA compilation. --- [ Original Report ] Version: 4.4.1+dfsg-2 Release: stonking-proposed Arch: amd64v3 FTBFS build: https://launchpad.net/ubuntu/+source/embree/4.4.1+dfsg-2/+build/33012149 undefined reference in the log on 235 lines before the build ends with inevitable linking failure tail end is: /usr/bin/x86_64-linux-gnu-ld.bfd: /tmp/ccWFWXwu.ltrans67.ltrans.o: in function `embree::avx2::BVHNSubdivPatch1MBlurBuilderSAH<4>::build()': /usr/src/embree-4.4.1+dfsg-2/kernels/bvh/bvh_builder_subdiv.cpp:351:(.text+0x1f016): undefined reference to `embree::BVHN<4>::preBuild(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' /usr/bin/x86_64-linux-gnu-ld.bfd: /usr/src/embree-4.4.1+dfsg-2/kernels/bvh/bvh_builder_subdiv.cpp:335:(.text+0x2019e): undefined reference to `embree::BVHN<4>::set(embree::NodeRefPtr<4>, embree::LBBox<embree::Vec3fa> const&, unsigned long)' /usr/bin/x86_64-linux-gnu-ld.bfd: /usr/src/embree-4.4.1+dfsg-2/kernels/bvh/bvh_builder_subdiv.cpp:379:(.text+0x20366): undefined reference to `embree::BVHN<4>::postBuild(double)' /usr/bin/x86_64-linux-gnu-ld.bfd: /usr/src/embree-4.4.1+dfsg-2/kernels/bvh/bvh_builder_subdiv.cpp:347:(.text+0x20564): undefined reference to `embree::BVHN<4>::set(embree::NodeRefPtr<4>, embree::LBBox<embree::Vec3fa> const&, unsigned long)' /usr/bin/x86_64-linux-gnu-ld.bfd: /usr/src/embree-4.4.1+dfsg-2/kernels/bvh/bvh_builder_subdiv.cpp:363:(.text+0x20799): undefined reference to `embree::BVHN<4>::set(embree::NodeRefPtr<4>, embree::LBBox<embree::Vec3fa> const&, unsigned long)' /usr/bin/x86_64-linux-gnu-ld.bfd: /usr/src/embree-4.4.1+dfsg-2/kernels/bvh/bvh_builder_subdiv.cpp:364:(.text+0x207b1): undefined reference to `embree::BVHN<4>::postBuild(double)' collect2: error: ld returned 1 exit status
-- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/2161642 Title: 4.4.1+dfsg-2 FTBFS in stonking proposed on amd64v3 (command line broken in two lines) To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/embree/+bug/2161642/+subscriptions -- ubuntu-bugs mailing list [email protected] https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
