** 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.
  
  [ Fix ]
- Strip -march=x86-64-v3 from maintainer flags in debian/rules:
- export DEB_CFLAGS_MAINT_STRIP = -march=x86-64-v3
- export DEB_CXXFLAGS_MAINT_STRIP = -march=x86-64-v3
+ 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
  
- 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. Linker then 
fails to find embree::sse42::* in libembree4.so. Also, kernels/bvh/bvh.cpp 
skips instantiating BVHN<4> under #if !defined(__AVX__).
+    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.
  
  [ 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.
  
  [ Where problems could occur ]
- Low risk. Only strips -march=x86-64-v3 in debian/rules. 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.
+ 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.
  
  [ 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.
  
  --- [ 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

Reply via email to