Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Embree compilation fails when specifying -march=x86-64-v3 version #91217

Open
xana43 opened this issue Apr 26, 2024 · 2 comments · May be fixed by #95158
Open

Embree compilation fails when specifying -march=x86-64-v3 version #91217

xana43 opened this issue Apr 26, 2024 · 2 comments · May be fixed by #95158

Comments

@xana43
Copy link

xana43 commented Apr 26, 2024

Tested versions

found in Godot v4.2.3.rc (c8356fb) (when I pulled version 4.2.2 there was a commit that changed it's version to 4.2.3 but nothing else was changed)

System information

Godot v4.2.3.rc (c8356fb) - Fedora Linux 40 (KDE Plasma) - Wayland - Vulkan (Forward+) - dedicated AMD Radeon RX 7900 XT (RADV NAVI31) () - AMD Ryzen 9 7950X 16-Core Processor (32 Threads)

Issue description

When compiling the godot editor with the option -march=x86-64-v3 it errors out giving this error NOTE: using -march=x86-64-v2 or -march=x86-64 does not error out

/usr/bin/ld: /tmp/cc7rcj2R.ltrans15.ltrans.o: in function `embree::BVH4Factory::BVH4Triangle4i(embree::Scene*, embree::BVHFactory::BuildVariant, embree::BVHFactory::IntersectVariant)':
<artificial>:(.text+0x6486): undefined reference to `embree::BVHN<4>::BVHN(embree::PrimitiveType const&, embree::Scene*)'
/usr/bin/ld: /tmp/cc7rcj2R.ltrans15.ltrans.o: in function `embree::BVH4Factory::BVH4QuantizedTriangle4i(embree::Scene*)':
<artificial>:(.text+0x6f77): undefined reference to `embree::BVHN<4>::BVHN(embree::PrimitiveType const&, embree::Scene*)'
/usr/bin/ld: /tmp/cc7rcj2R.ltrans15.ltrans.o: in function `embree::avx2::BVHNBuilderSAH<4, embree::TriangleM<4> >::build()':
<artificial>:(.text+0x3dfc6): undefined reference to `embree::BVHN<4>::preBuild(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/usr/bin/ld: <artificial>:(.text+0x3e89d): undefined reference to `embree::BVHN<4>::set(embree::NodeRefPtr<4>, embree::LBBox<embree::Vec3fa> const&, unsigned long)'
/usr/bin/ld: <artificial>:(.text+0x3e8d3): undefined reference to `embree::BVHN<4>::layoutLargeNodes(unsigned long)'
/usr/bin/ld: /tmp/cc7rcj2R.ltrans15.ltrans.o: in function `embree::avx2::BVHNBuilderSAHQuantized<4, embree::TriangleMi<4> >::build()':
<artificial>:(.text+0x44a48): undefined reference to `embree::BVHN<4>::preBuild(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/usr/bin/ld: <artificial>:(.text+0x44e64): undefined reference to `embree::BVHN<4>::set(embree::NodeRefPtr<4>, embree::LBBox<embree::Vec3fa> const&, unsigned long)'
/usr/bin/ld: /tmp/cc7rcj2R.ltrans15.ltrans.o: in function `embree::avx2::BVHNBuilderSAH<4, embree::TriangleMi<4> >::build()':
<artificial>:(.text+0x45a86): undefined reference to `embree::BVHN<4>::preBuild(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/usr/bin/ld: <artificial>:(.text+0x4635d): undefined reference to `embree::BVHN<4>::set(embree::NodeRefPtr<4>, embree::LBBox<embree::Vec3fa> const&, unsigned long)'
/usr/bin/ld: <artificial>:(.text+0x46393): undefined reference to `embree::BVHN<4>::layoutLargeNodes(unsigned long)'
/usr/bin/ld: /tmp/cc7rcj2R.ltrans15.ltrans.o: in function `embree::avx2::BVHNBuilderSAH<4, embree::TriangleMv<4> >::build()':
<artificial>:(.text+0x46d26): undefined reference to `embree::BVHN<4>::preBuild(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/usr/bin/ld: <artificial>:(.text+0x475fd): undefined reference to `embree::BVHN<4>::set(embree::NodeRefPtr<4>, embree::LBBox<embree::Vec3fa> const&, unsigned long)'
/usr/bin/ld: <artificial>:(.text+0x47633): undefined reference to `embree::BVHN<4>::layoutLargeNodes(unsigned long)'
/usr/bin/ld: /tmp/cc7rcj2R.ltrans15.ltrans.o: in function `embree::avx2::BVHNBuilderFastSpatialSAH<4, embree::TriangleMesh, embree::TriangleMi<4>, embree::avx2::TriangleSplitterFactory>::build()':
<artificial>:(.text+0x4ab8c): undefined reference to `embree::BVHN<4>::preBuild(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/usr/bin/ld: <artificial>:(.text+0x4b08b): undefined reference to `embree::BVHN<4>::set(embree::NodeRefPtr<4>, embree::LBBox<embree::Vec3fa> const&, unsigned long)'
/usr/bin/ld: <artificial>:(.text+0x4b0cc): undefined reference to `embree::BVHN<4>::layoutLargeNodes(unsigned long)'
/usr/bin/ld: <artificial>:(.text+0x4b192): undefined reference to `embree::BVHN<4>::postBuild(double)'
/usr/bin/ld: /tmp/cc7rcj2R.ltrans15.ltrans.o: in function `embree::avx2::BVHNBuilderFastSpatialSAH<4, embree::TriangleMesh, embree::TriangleMv<4>, embree::avx2::TriangleSplitterFactory>::build()':
<artificial>:(.text+0x4c16c): undefined reference to `embree::BVHN<4>::preBuild(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/usr/bin/ld: <artificial>:(.text+0x4c66b): undefined reference to `embree::BVHN<4>::set(embree::NodeRefPtr<4>, embree::LBBox<embree::Vec3fa> const&, unsigned long)'
/usr/bin/ld: <artificial>:(.text+0x4c6ac): undefined reference to `embree::BVHN<4>::layoutLargeNodes(unsigned long)'
/usr/bin/ld: <artificial>:(.text+0x4c772): undefined reference to `embree::BVHN<4>::postBuild(double)'
/usr/bin/ld: /tmp/cc7rcj2R.ltrans15.ltrans.o: in function `embree::avx2::BVHNBuilderFastSpatialSAH<4, embree::TriangleMesh, embree::TriangleM<4>, embree::avx2::TriangleSplitterFactory>::build()':
<artificial>:(.text+0x4d74c): undefined reference to `embree::BVHN<4>::preBuild(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/usr/bin/ld: <artificial>:(.text+0x4dc4b): undefined reference to `embree::BVHN<4>::set(embree::NodeRefPtr<4>, embree::LBBox<embree::Vec3fa> const&, unsigned long)'
/usr/bin/ld: <artificial>:(.text+0x4dc8c): undefined reference to `embree::BVHN<4>::layoutLargeNodes(unsigned long)'
/usr/bin/ld: <artificial>:(.text+0x4dd52): undefined reference to `embree::BVHN<4>::postBuild(double)'
/usr/bin/ld: /tmp/cc7rcj2R.ltrans15.ltrans.o: in function `RaycastOcclusionCull::Scenario::update() [clone .part.0]':
<artificial>:(.text+0x52f81): undefined reference to `embree::avx2::BVH4Triangle4Intersector8HybridMoeller()'
/usr/bin/ld: <artificial>:(.text+0x52f88): undefined reference to `embree::avx2::BVH4Triangle4Intersector8HybridMoellerNoFilter()'
/usr/bin/ld: <artificial>:(.text+0x52f8f): undefined reference to `embree::avx2::BVH4Triangle4iIntersector8HybridMoeller()'
/usr/bin/ld: <artificial>:(.text+0x52f96): undefined reference to `embree::avx2::BVH4Triangle4vIntersector8HybridPluecker()'
/usr/bin/ld: <artificial>:(.text+0x52f9d): undefined reference to `embree::avx2::BVH4Triangle4iIntersector8HybridPluecker()'
/usr/bin/ld: <artificial>:(.text+0x52fa4): undefined reference to `embree::avx2::BVH4Triangle4vMBIntersector8HybridMoeller()'
/usr/bin/ld: <artificial>:(.text+0x52fab): undefined reference to `embree::avx2::BVH4Triangle4iMBIntersector8HybridMoeller()'
/usr/bin/ld: <artificial>:(.text+0x52fb2): undefined reference to `embree::avx2::BVH4Triangle4vMBIntersector8HybridPluecker()'
/usr/bin/ld: <artificial>:(.text+0x52fb9): undefined reference to `embree::avx2::BVH4Triangle4iMBIntersector8HybridPluecker()'
/usr/bin/ld: <artificial>:(.text+0x5313e): undefined reference to `embree::avx2::BVH8Triangle4iIntersector8HybridMoeller()'
/usr/bin/ld: <artificial>:(.text+0x53146): undefined reference to `embree::avx2::BVH8Triangle4Intersector8HybridMoeller()'
/usr/bin/ld: <artificial>:(.text+0x5314e): undefined reference to `embree::avx2::BVH8Triangle4iMBIntersector8HybridMoeller()'
/usr/bin/ld: <artificial>:(.text+0x53156): undefined reference to `embree::avx2::BVH8Triangle4iIntersector8HybridPluecker()'
/usr/bin/ld: <artificial>:(.text+0x5315e): undefined reference to `embree::avx2::BVH8Triangle4iIntersector4HybridMoeller()'
/usr/bin/ld: <artificial>:(.text+0x53165): undefined reference to `embree::avx2::BVH8Triangle4vIntersector1Woop()'
/usr/bin/ld: <artificial>:(.text+0x5316c): undefined reference to `embree::avx2::BVH8Triangle4iMBIntersector4HybridPluecker()'
/usr/bin/ld: <artificial>:(.text+0x53173): undefined reference to `embree::avx2::BVH8Triangle4iMBIntersector8HybridPluecker()'
/usr/bin/ld: <artificial>:(.text+0x5317c): undefined reference to `embree::avx2::BVH8Triangle4vIntersector8HybridPluecker()'
/usr/bin/ld: <artificial>:(.text+0x53185): undefined reference to `embree::avx2::BVH8Triangle4Intersector4HybridMoeller()'
/usr/bin/ld: <artificial>:(.text+0x53192): undefined reference to `embree::avx2::BVH8Triangle4Intersector8HybridMoellerNoFilter()'
/usr/bin/ld: <artificial>:(.text+0x5319c): undefined reference to `embree::avx2::BVH8Triangle4vMBIntersector8HybridPluecker()'
/usr/bin/ld: <artificial>:(.text+0x531a5): undefined reference to `embree::avx2::BVH8Triangle4iMBIntersector4HybridMoeller()'
/usr/bin/ld: <artificial>:(.text+0x531ad): undefined reference to `embree::avx2::BVH8Triangle4iIntersector4HybridPluecker()'
/usr/bin/ld: <artificial>:(.text+0x531bc): undefined reference to `embree::avx2::BVH8Triangle4vMBIntersector8HybridMoeller()'
/usr/bin/ld: <artificial>:(.text+0x531c6): undefined reference to `embree::avx2::BVH8Triangle4Intersector4HybridMoellerNoFilter()'
/usr/bin/ld: <artificial>:(.text+0x531d0): undefined reference to `embree::avx2::BVH8Triangle4vMBIntersector4HybridPluecker()'
/usr/bin/ld: <artificial>:(.text+0x531e0): undefined reference to `embree::avx2::BVH8Triangle4vIntersector4HybridPluecker()'
/usr/bin/ld: <artificial>:(.text+0x531e9): undefined reference to `embree::avx2::QBVH8Triangle4iIntersector1Pluecker()'
/usr/bin/ld: <artificial>:(.text+0x531f2): undefined reference to `embree::avx2::QBVH8Triangle4Intersector1Moeller()'
/usr/bin/ld: <artificial>:(.text+0x53202): undefined reference to `embree::avx2::BVH8Triangle4vMBIntersector4HybridMoeller()'
/usr/bin/ld: <artificial>:(.text+0x5320b): undefined reference to `embree::avx2::BVH8Triangle4Intersector1Moeller()'
/usr/bin/ld: <artificial>:(.text+0x53219): undefined reference to `embree::avx2::BVH8Triangle4vIntersector1Pluecker()'
/usr/bin/ld: <artificial>:(.text+0x53222): undefined reference to `embree::avx2::BVH8Triangle4iIntersector1Pluecker()'
/usr/bin/ld: <artificial>:(.text+0x5322c): undefined reference to `embree::avx2::BVH8Triangle4iIntersector1Moeller()'
/usr/bin/ld: <artificial>:(.text+0x5323b): undefined reference to `embree::avx2::BVH8Triangle4vMBIntersector1Pluecker()'
/usr/bin/ld: <artificial>:(.text+0x53244): undefined reference to `embree::avx2::BVH8Triangle4iMBIntersector1Pluecker()'
/usr/bin/ld: <artificial>:(.text+0x53252): undefined reference to `embree::avx2::BVH8Triangle4vMBIntersector1Moeller()'
/usr/bin/ld: <artificial>:(.text+0x5325b): undefined reference to `embree::avx2::BVH8Triangle4iMBIntersector1Moeller()'
/usr/bin/ld: <artificial>:(.text+0x5326e): undefined reference to `embree::avx2::BVH8IntersectorStreamPacketFallback()'
/usr/bin/ld: <artificial>:(.text+0x53275): undefined reference to `embree::avx2::BVH8Triangle4IntersectorStreamMoeller()'
/usr/bin/ld: <artificial>:(.text+0x5327c): undefined reference to `embree::avx2::BVH8Triangle4IntersectorStreamMoellerNoFilter()'
/usr/bin/ld: <artificial>:(.text+0x53283): undefined reference to `embree::avx2::BVH8Triangle4iIntersectorStreamMoeller()'
/usr/bin/ld: <artificial>:(.text+0x5328a): undefined reference to `embree::avx2::BVH8Triangle4vIntersectorStreamPluecker()'
/usr/bin/ld: <artificial>:(.text+0x53291): undefined reference to `embree::avx2::BVH8Triangle4iIntersectorStreamPluecker()'
/usr/bin/ld: /tmp/cc7rcj2R.ltrans15.ltrans.o: in function `embree::Scene::commit_task() [clone .part.0]':
<artificial>:(.text+0x59087): undefined reference to `embree::BVHN<4>::BVHN(embree::PrimitiveType const&, embree::Scene*)'
/usr/bin/ld: /tmp/cc7rcj2R.ltrans15.ltrans.o: in function `embree::avx2::BVHNBuilderSAH<4, embree::TriangleM<4> >::build()':
<artificial>:(.text+0x3ea28): undefined reference to `embree::BVHN<4>::postBuild(double)'
/usr/bin/ld: /tmp/cc7rcj2R.ltrans15.ltrans.o: in function `embree::avx2::BVHNBuilderSAHQuantized<4, embree::TriangleMi<4> >::build()':
<artificial>:(.text+0x44fa8): undefined reference to `embree::BVHN<4>::postBuild(double)'
/usr/bin/ld: /tmp/cc7rcj2R.ltrans15.ltrans.o: in function `embree::avx2::BVHNBuilderSAH<4, embree::TriangleMi<4> >::build()':
<artificial>:(.text+0x464e8): undefined reference to `embree::BVHN<4>::postBuild(double)'
/usr/bin/ld: /tmp/cc7rcj2R.ltrans15.ltrans.o: in function `embree::avx2::BVHNBuilderSAH<4, embree::TriangleMv<4> >::build()':
<artificial>:(.text+0x47788): undefined reference to `embree::BVHN<4>::postBuild(double)'
/usr/bin/ld: /tmp/cc7rcj2R.ltrans16.ltrans.o: in function `embree::avx2::BVHNBuilderMBlurSAH<4, embree::TriangleMesh, embree::TriangleMvMB<4> >::build()':
<artificial>:(.text+0x58f05): undefined reference to `embree::BVHN<4>::preBuild(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/usr/bin/ld: <artificial>:(.text+0x593b4): undefined reference to `embree::BVHN<4>::set(embree::NodeRefPtr<4>, embree::LBBox<embree::Vec3fa> const&, unsigned long)'
/usr/bin/ld: /tmp/cc7rcj2R.ltrans16.ltrans.o: in function `embree::avx2::BVHNBuilderMBlurSAH<4, embree::TriangleMesh, embree::TriangleMi<4> >::build()':
<artificial>:(.text+0x59b55): undefined reference to `embree::BVHN<4>::preBuild(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/usr/bin/ld: <artificial>:(.text+0x5a004): undefined reference to `embree::BVHN<4>::set(embree::NodeRefPtr<4>, embree::LBBox<embree::Vec3fa> const&, unsigned long)'
/usr/bin/ld: /tmp/cc7rcj2R.ltrans16.ltrans.o: in function `embree::avx2::BVHNBuilderTwoLevel<4, embree::TriangleMesh, embree::TriangleMi<4> >::build()':
<artificial>:(.text+0x5ee76): undefined reference to `embree::BVHN<4>::preBuild(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/usr/bin/ld: <artificial>:(.text+0x5f7cd): undefined reference to `embree::BVHN<4>::set(embree::NodeRefPtr<4>, embree::LBBox<embree::Vec3fa> const&, unsigned long)'
/usr/bin/ld: <artificial>:(.text+0x5f9e8): undefined reference to `embree::BVHN<4>::set(embree::NodeRefPtr<4>, embree::LBBox<embree::Vec3fa> const&, unsigned long)'
/usr/bin/ld: <artificial>:(.text+0x5fb87): undefined reference to `embree::BVHN<4>::set(embree::NodeRefPtr<4>, embree::LBBox<embree::Vec3fa> const&, unsigned long)'
/usr/bin/ld: <artificial>:(.text+0x601f6): undefined reference to `embree::BVHN<4>::set(embree::NodeRefPtr<4>, embree::LBBox<embree::Vec3fa> const&, unsigned long)'
/usr/bin/ld: /tmp/cc7rcj2R.ltrans16.ltrans.o: in function `embree::avx2::BVHNBuilderTwoLevel<4, embree::TriangleMesh, embree::TriangleMv<4> >::build()':
<artificial>:(.text+0x605f6): undefined reference to `embree::BVHN<4>::preBuild(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/usr/bin/ld: <artificial>:(.text+0x60f4d): undefined reference to `embree::BVHN<4>::set(embree::NodeRefPtr<4>, embree::LBBox<embree::Vec3fa> const&, unsigned long)'
/usr/bin/ld: <artificial>:(.text+0x61168): undefined reference to `embree::BVHN<4>::set(embree::NodeRefPtr<4>, embree::LBBox<embree::Vec3fa> const&, unsigned long)'
/usr/bin/ld: <artificial>:(.text+0x61307): undefined reference to `embree::BVHN<4>::set(embree::NodeRefPtr<4>, embree::LBBox<embree::Vec3fa> const&, unsigned long)'
/usr/bin/ld: <artificial>:(.text+0x61976): undefined reference to `embree::BVHN<4>::set(embree::NodeRefPtr<4>, embree::LBBox<embree::Vec3fa> const&, unsigned long)'
/usr/bin/ld: /tmp/cc7rcj2R.ltrans16.ltrans.o: in function `embree::avx2::BVHNBuilderTwoLevel<4, embree::TriangleMesh, embree::TriangleM<4> >::build()':
<artificial>:(.text+0x61d76): undefined reference to `embree::BVHN<4>::preBuild(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/usr/bin/ld: <artificial>:(.text+0x626cd): undefined reference to `embree::BVHN<4>::set(embree::NodeRefPtr<4>, embree::LBBox<embree::Vec3fa> const&, unsigned long)'
/usr/bin/ld: <artificial>:(.text+0x628e8): undefined reference to `embree::BVHN<4>::set(embree::NodeRefPtr<4>, embree::LBBox<embree::Vec3fa> const&, unsigned long)'
/usr/bin/ld: <artificial>:(.text+0x62a87): undefined reference to `embree::BVHN<4>::set(embree::NodeRefPtr<4>, embree::LBBox<embree::Vec3fa> const&, unsigned long)'
/usr/bin/ld: <artificial>:(.text+0x630f6): undefined reference to `embree::BVHN<4>::set(embree::NodeRefPtr<4>, embree::LBBox<embree::Vec3fa> const&, unsigned long)'
/usr/bin/ld: /tmp/cc7rcj2R.ltrans16.ltrans.o: in function `embree::avx2::BVHNBuilderMBlurSAH<4, embree::TriangleMesh, embree::TriangleMvMB<4> >::build()':
<artificial>:(.text+0x5950a): undefined reference to `embree::BVHN<4>::postBuild(double)'
/usr/bin/ld: /tmp/cc7rcj2R.ltrans16.ltrans.o: in function `embree::avx2::BVHNBuilderMBlurSAH<4, embree::TriangleMesh, embree::TriangleMi<4> >::build()':
<artificial>:(.text+0x5a15a): undefined reference to `embree::BVHN<4>::postBuild(double)'
/usr/bin/ld: /tmp/cc7rcj2R.ltrans16.ltrans.o: in function `embree::avx2::BVHNBuilderTwoLevel<4, embree::TriangleMesh, embree::TriangleMi<4> >::build()':
<artificial>:(.text+0x5fc1c): undefined reference to `embree::BVHN<4>::postBuild(double)'
/usr/bin/ld: /tmp/cc7rcj2R.ltrans16.ltrans.o: in function `embree::avx2::BVHNBuilderTwoLevel<4, embree::TriangleMesh, embree::TriangleMv<4> >::build()':
<artificial>:(.text+0x6139c): undefined reference to `embree::BVHN<4>::postBuild(double)'
/usr/bin/ld: /tmp/cc7rcj2R.ltrans16.ltrans.o: in function `embree::avx2::BVHNBuilderTwoLevel<4, embree::TriangleMesh, embree::TriangleM<4> >::build()':
<artificial>:(.text+0x62b1c): undefined reference to `embree::BVHN<4>::postBuild(double)'
/usr/bin/ld: /tmp/cc7rcj2R.ltrans17.ltrans.o: in function `embree::TaskScheduler::ClosureTaskFunction<embree::TaskScheduler::spawn<unsigned long, embree::avx2::BVHNBuilderTwoLevel<4, embree::TriangleMesh, embree::TriangleM<4> >::build()::{lambda(embree::range<unsigned long> const&)#2}>(unsigned long, unsigned long, unsigned long, embree::avx2::BVHNBuilderTwoLevel<4, embree::TriangleMesh, embree::TriangleM<4> >::build()::{lambda(embree::range<unsigned long> const&)#2} const&)::{lambda()#1}>::execute()':
<artificial>:(.text+0x40482): undefined reference to `embree::BVHN<4>::BVHN(embree::PrimitiveType const&, embree::Scene*)'
/usr/bin/ld: /tmp/cc7rcj2R.ltrans17.ltrans.o: in function `embree::TaskScheduler::ClosureTaskFunction<embree::TaskScheduler::spawn<unsigned long, embree::avx2::BVHNBuilderTwoLevel<4, embree::TriangleMesh, embree::TriangleMv<4> >::build()::{lambda(embree::range<unsigned long> const&)#2}>(unsigned long, unsigned long, unsigned long, embree::avx2::BVHNBuilderTwoLevel<4, embree::TriangleMesh, embree::TriangleMv<4> >::build()::{lambda(embree::range<unsigned long> const&)#2} const&)::{lambda()#1}>::execute()':
<artificial>:(.text+0x41712): undefined reference to `embree::BVHN<4>::BVHN(embree::PrimitiveType const&, embree::Scene*)'
/usr/bin/ld: /tmp/cc7rcj2R.ltrans17.ltrans.o: in function `embree::TaskScheduler::ClosureTaskFunction<embree::TaskScheduler::spawn<unsigned long, embree::avx2::BVHNBuilderTwoLevel<4, embree::TriangleMesh, embree::TriangleMi<4> >::build()::{lambda(embree::range<unsigned long> const&)#2}>(unsigned long, unsigned long, unsigned long, embree::avx2::BVHNBuilderTwoLevel<4, embree::TriangleMesh, embree::TriangleMi<4> >::build()::{lambda(embree::range<unsigned long> const&)#2} const&)::{lambda()#1}>::execute()':
<artificial>:(.text+0x429a2): undefined reference to `embree::BVHN<4>::BVHN(embree::PrimitiveType const&, embree::Scene*)'
/usr/bin/ld: /tmp/cc7rcj2R.ltrans18.ltrans.o: in function `embree::avx2::BVHNMeshBuilderMorton<4, embree::TriangleMesh, embree::TriangleMi<4> >::build()':
<artificial>:(.text+0x5225f): undefined reference to `embree::BVHN<4>::set(embree::NodeRefPtr<4>, embree::LBBox<embree::Vec3fa> const&, unsigned long)'
/usr/bin/ld: <artificial>:(.text+0x52279): undefined reference to `embree::BVHN<4>::clearBarrier(embree::NodeRefPtr<4>&)'
/usr/bin/ld: <artificial>:(.text+0x52a1d): undefined reference to `embree::BVHN<4>::set(embree::NodeRefPtr<4>, embree::LBBox<embree::Vec3fa> const&, unsigned long)'
/usr/bin/ld: /tmp/cc7rcj2R.ltrans18.ltrans.o: in function `embree::avx2::BVHNMeshBuilderMorton<4, embree::TriangleMesh, embree::TriangleMv<4> >::build()':
<artificial>:(.text+0x5506f): undefined reference to `embree::BVHN<4>::set(embree::NodeRefPtr<4>, embree::LBBox<embree::Vec3fa> const&, unsigned long)'
/usr/bin/ld: <artificial>:(.text+0x55089): undefined reference to `embree::BVHN<4>::clearBarrier(embree::NodeRefPtr<4>&)'
/usr/bin/ld: <artificial>:(.text+0x5582d): undefined reference to `embree::BVHN<4>::set(embree::NodeRefPtr<4>, embree::LBBox<embree::Vec3fa> const&, unsigned long)'
/usr/bin/ld: /tmp/cc7rcj2R.ltrans18.ltrans.o: in function `embree::avx2::BVHNMeshBuilderMorton<4, embree::TriangleMesh, embree::TriangleM<4> >::build()':
<artificial>:(.text+0x57e7f): undefined reference to `embree::BVHN<4>::set(embree::NodeRefPtr<4>, embree::LBBox<embree::Vec3fa> const&, unsigned long)'
/usr/bin/ld: <artificial>:(.text+0x57e99): undefined reference to `embree::BVHN<4>::clearBarrier(embree::NodeRefPtr<4>&)'
/usr/bin/ld: <artificial>:(.text+0x5863d): undefined reference to `embree::BVHN<4>::set(embree::NodeRefPtr<4>, embree::LBBox<embree::Vec3fa> const&, unsigned long)'
/usr/bin/ld: /tmp/cc7rcj2R.ltrans123.ltrans.o: in function `embree::BVH4Factory::BVH4Triangle4iMB(embree::Scene*, embree::BVHFactory::BuildVariant, embree::BVHFactory::IntersectVariant) [clone .constprop.0]':
<artificial>:(.text+0x14985): undefined reference to `embree::BVHN<4>::BVHN(embree::PrimitiveType const&, embree::Scene*)'
/usr/bin/ld: /tmp/cc7rcj2R.ltrans123.ltrans.o: in function `embree::BVH4Factory::BVH4Triangle4(embree::Scene*, embree::BVHFactory::BuildVariant, embree::BVHFactory::IntersectVariant) [clone .constprop.0]':
<artificial>:(.text+0x15412): undefined reference to `embree::BVHN<4>::BVHN(embree::PrimitiveType const&, embree::Scene*)'
/usr/bin/ld: /tmp/cc7rcj2R.ltrans123.ltrans.o: in function `embree::BVH4Factory::BVH4Triangle4v(embree::Scene*, embree::BVHFactory::BuildVariant, embree::BVHFactory::IntersectVariant) [clone .constprop.0]':
<artificial>:(.text+0x15717): undefined reference to `embree::BVHN<4>::BVHN(embree::PrimitiveType const&, embree::Scene*)'
collect2: error: ld returned 1 exit status
scons: *** [bin/godot.linuxbsd.template_release.x86_64.2D] Error 1
scons: building terminated because of errors.

Steps to reproduce

add -march=x86-64-v3 to CCFLAGS and LINKFLAGS

Minimal reproduction project (MRP)

N/A

@akien-mga akien-mga changed the title Compilation fails when specifying x86 version Embree compilation fails when specifying -march=x86-64-v3 version Apr 26, 2024
@xana43
Copy link
Author

xana43 commented Apr 28, 2024

Upon further testing, it seems like Embree is the only thing causing compilation issues when using -march, when I disable the embree module godot compiles just fine at this x86 version. Every other module works perfectly fine.

@akien-mga akien-mga moved this to Untriaged in Buildsystem Issue Triage May 11, 2024
@akien-mga akien-mga moved this from Untriaged to Up for grabs in Buildsystem Issue Triage May 11, 2024
@MonterraByte
Copy link
Contributor

Embree uses preprocessor defines (such as __AVX2__) to decide what features to use. By passing -march=x86-64-v3, AVX2 support is enabled, which makes the compiler set the corresponding defines, thus changing the behavior of the code.

The undefined reference to 'embree::avx2::... errors are due to Embree's AVX2 code making use of implementation code omitted from Godot's copy of the Embree library (specifically, the kernels/geometry/primitive8.cpp, kernels/bvh/bvh_intersector1_bvh8.cpp, kernels/bvh/bvh_intersector_hybrid4_bvh8.cpp, kernels/bvh/bvh_intersector_hybrid8_bvh4.cpp and kernels/bvh/bvh_intersector_hybrid8_bvh8.cpp files).

The undefined reference to 'embree::BVHN<4>::... errors are due to defining EMBREE_TARGET_SSE2 when SSE2 is not the target being compiled. Specifically, it seems to be due to this bit of code in kernels/bvh/bvh.cpp:

#if !defined(__AVX__) || !defined(EMBREE_TARGET_SSE2) && !defined(EMBREE_TARGET_SSE42) || defined(__aarch64__)
  template class BVHN<4>;
#endif

which causes BVHN<4> to not be defined if the compiler supports AVX and EMBREE_TARGET_SSE2 is defined.


By adding the missing files, and changing the define from EMBREE_TARGET_SSE2 to EMBREE_TARGET_AVX2 (or just EMBREE_TARGET_AVX), Embree will build with -march=x86-64-v3.

While adding the missing files would probably be OK for a regular Godot build (dead code elimination would probably negate the binary size impact of the added code), I'm not sure how we'd go about selecting the right EMBREE_TARGET_* define for the compiler flags used.

The proper solution would probably be to prevent the compiler flags from enabling new instruction sets, using -mno-avx and such. It would fix the issue, although Embree would still only be built with SSE2 support. To have Embree built with AVX/AVX2 support, we'd need to explicitly add it as a build option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment