Rik, Thanks for running the test build in PPA
In log #33794027, stripping -march=x86-64-v3 resolved all 53 embree::sse42::* linker errors, and instantiating BVHN<4> resolved the subdiv builder errors. The only remaining errors were 3 missing symbols: kernels/bvh/bvh.cpp:176: undefined reference to 'embree::BVHNStatistics<4>::BVHNStatistics(embree::BVHN<4>*)' kernels/bvh/bvh.cpp:150: undefined reference to 'embree::BVHNStatistics<4>::str[abi:cxx11]()' These are called from BVHN<4>::postBuild. In kernels/bvh/bvh_statistics.cpp, line 162 had the exact same #if !defined(__AVX__) guard as bvh.cpp, omitting template class BVHNStatistics<4>; under LTO when AVX is enabled. I updated always-instantiate-bvh4.patch to drop this guard in bvh_statistics.cpp as well. Attached updated debdiff: embree_4.4.1+dfsg-2ubuntu1.debdiff. Could you please update PPA 3997 with it? ** Description changed: [ Impact ] - embree fails to build from source on amd64v3 with 59 undefined reference linker errors (embree::sse42::* and embree::BVHN<4>::*). - Because amd64v3 binaries are paired with amd64 in stonking, this FTBFS blocks embree migration and stalls fenics/dolfin/petsc/slepc transitions. + 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. Strip -march=x86-64-v3 from CFLAGS, CXXFLAGS, and LDFLAGS maintainer flags in debian/rules: - export DEB_CFLAGS_MAINT_STRIP = -march=x86-64-v3 - export DEB_CXXFLAGS_MAINT_STRIP = -march=x86-64-v3 - export DEB_LDFLAGS_MAINT_STRIP = -march=x86-64-v3 + 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 compiles separate static libs (libembree_sse42.a, libembree_avx.a, libembree_avx2.a, libembree_avx512.a) and uses runtime CPUID dispatch. - In common/sys/sysinfo.h, namespace selection relies on compiler macros. With global -march=x86-64-v3, __AVX2__ is defined when compiling libembree_sse42.a, placing its symbols into embree::avx2 instead of embree::sse42. Stripping from CFLAGS/CXXFLAGS fixes all 53 embree::sse42::* undefined references. - Stripping from LDFLAGS prevents LTO (lto1) from re-injecting -march=x86-64-v3 during final link code generation. - - 2. In kernels/bvh/bvh.cpp and kernels/bvh/bvh_statistics.cpp, instantiate `template class BVHN<4>;` and `template class BVHNStatistics<4>;` unconditionally. - Previously guarded by `#if !defined(__AVX__)`, which omitted these template instantiations during LTO when `__AVX__` is set, causing undefined references to embree::BVHN<4>::* and embree::BVHNStatistics<4>::* referenced by subdiv builders and postBuild. - - Stripping -march=x86-64-v3 matches packaging practice for multi-ISA - libraries (openblas, simde). Embree's runtime dispatch still runs - AVX2/AVX-512 code on v3 CPUs. + 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. [ Test Plan ] - Build embree with DEB_CXXFLAGS_MAINT_APPEND="-march=x86-64-v3" (or in amd64v3 chroot). - Without fix: fails linking with 59 undefined references. - With fix: builds and links libembree4.so cleanly with 0 errors. + 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. + With fix: builds and links libembree4.so cleanly. [ Where problems could occur ] - Low risk. Only strips -march=x86-64-v3 in debian/rules and ensures BVHN<4> and BVHNStatistics<4> template instantiations in kernels/bvh/. amd64 and arm64 builds do not pass this flag and are unaffected. amd64v3 still gets full AVX2/AVX-512 performance through Embree's runtime CPUID dispatch. + 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. [ Other Info ] Target: Ubuntu Stonking (26.10). Attached debdiff: embree_4.4.1+dfsg-2ubuntu1.debdiff - Test build in PPA: https://launchpad.net/~ci-train-ppa-service/+archive/ubuntu/3997/+sourcepub/18801010/+listing-archive-extra - The link command split in build #33012149 was a log artifact: cmake_link_script buffers 4096 bytes to stdout, and g++/ld stderr output interleaved mid-line. + 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. --- [ 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 ** Patch added: "embree_4.4.1+dfsg-2ubuntu1.debdiff" https://bugs.launchpad.net/ubuntu/+source/embree/+bug/2161642/+attachment/6003092/+files/embree_4.4.1+dfsg-2ubuntu1.debdiff -- 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
