Repository navigation
Open
Description
I tried to build with the following *FLAGS to optimize the build: -flto=4 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing
Note the -Werror=* flags are used to help detect cases where the compiler tries to optimize by assuming UB cannot exist in the source code -- if it does exist, ordinarily the code would be miscompiled, and this says to make the miscompilation a fatal error.
I got this error:
FAILED: libembree4.so.4.3.1
: && /usr/bin/x86_64-pc-linux-gnu-g++ -fPIC -fstack-protector-all -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-clash-protection -flto=4 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing -Wformat -Werror=format-security -Wall -Wformat -Wformat-security -Wno-class-memaccess -fno-strict-overflow -fno-delete-null-pointer-checks -fwrapv -fsigned-char -fPIE -fPIC -std=c++11 -fvisibility=hidden -fvisibility-inlines-hidden -fno-strict-aliasing -fno-tree-vectorize -D_FORTIFY_SOURCE=2 -g -DNDEBUG -O3 -Wl,-O1 -Wl,--as-needed -flto=4 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing -Wl,--defsym=__gentoo_check_ldflags__=0 -Wl,--no-undefined -z noexecstack -z relro -z now -Wl,--version-script="/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/export.linux.map" -shared -Wl,-soname,libembree4.so.4 -o libembree4.so.4.3.1 kernels/CMakeFiles/embree.dir/common/device.cpp.o kernels/CMakeFiles/embree.dir/common/stat.cpp.o kernels/CMakeFiles/embree.dir/common/acceln.cpp.o kernels/CMakeFiles/embree.dir/common/accelset.cpp.o kernels/CMakeFiles/embree.dir/common/state.cpp.o kernels/CMakeFiles/embree.dir/common/rtcore.cpp.o kernels/CMakeFiles/embree.dir/common/rtcore_builder.cpp.o kernels/CMakeFiles/embree.dir/common/scene.cpp.o kernels/CMakeFiles/embree.dir/common/scene_verify.cpp.o kernels/CMakeFiles/embree.dir/common/alloc.cpp.o kernels/CMakeFiles/embree.dir/common/geometry.cpp.o kernels/CMakeFiles/embree.dir/common/scene_user_geometry.cpp.o kernels/CMakeFiles/embree.dir/common/scene_instance.cpp.o kernels/CMakeFiles/embree.dir/common/scene_instance_array.cpp.o kernels/CMakeFiles/embree.dir/common/scene_triangle_mesh.cpp.o kernels/CMakeFiles/embree.dir/common/scene_quad_mesh.cpp.o kernels/CMakeFiles/embree.dir/common/scene_curves.cpp.o kernels/CMakeFiles/embree.dir/common/scene_line_segments.cpp.o kernels/CMakeFiles/embree.dir/common/scene_grid_mesh.cpp.o kernels/CMakeFiles/embree.dir/common/scene_points.cpp.o kernels/CMakeFiles/embree.dir/common/motion_derivative.cpp.o kernels/CMakeFiles/embree.dir/subdiv/bezier_curve.cpp.o kernels/CMakeFiles/embree.dir/subdiv/bspline_curve.cpp.o kernels/CMakeFiles/embree.dir/subdiv/catmullrom_curve.cpp.o kernels/CMakeFiles/embree.dir/geometry/primitive4.cpp.o kernels/CMakeFiles/embree.dir/geometry/instance_intersector.cpp.o kernels/CMakeFiles/embree.dir/geometry/instance_array_intersector.cpp.o kernels/CMakeFiles/embree.dir/geometry/curve_intersector_virtual_4v.cpp.o kernels/CMakeFiles/embree.dir/geometry/curve_intersector_virtual_4i.cpp.o kernels/CMakeFiles/embree.dir/geometry/curve_intersector_virtual_4i_mb.cpp.o kernels/CMakeFiles/embree.dir/geometry/curve_intersector_virtual_8v.cpp.o kernels/CMakeFiles/embree.dir/geometry/curve_intersector_virtual_8i.cpp.o kernels/CMakeFiles/embree.dir/geometry/curve_intersector_virtual_8i_mb.cpp.o kernels/CMakeFiles/embree.dir/builders/primrefgen.cpp.o kernels/CMakeFiles/embree.dir/bvh/bvh.cpp.o kernels/CMakeFiles/embree.dir/bvh/bvh_statistics.cpp.o kernels/CMakeFiles/embree.dir/bvh/bvh4_factory.cpp.o kernels/CMakeFiles/embree.dir/bvh/bvh8_factory.cpp.o kernels/CMakeFiles/embree.dir/bvh/bvh_collider.cpp.o kernels/CMakeFiles/embree.dir/bvh/bvh_rotate.cpp.o kernels/CMakeFiles/embree.dir/bvh/bvh_refit.cpp.o kernels/CMakeFiles/embree.dir/bvh/bvh_builder.cpp.o kernels/CMakeFiles/embree.dir/bvh/bvh_builder_hair.cpp.o kernels/CMakeFiles/embree.dir/bvh/bvh_builder_hair_mb.cpp.o kernels/CMakeFiles/embree.dir/bvh/bvh_builder_morton.cpp.o kernels/CMakeFiles/embree.dir/bvh/bvh_builder_sah.cpp.o kernels/CMakeFiles/embree.dir/bvh/bvh_builder_sah_spatial.cpp.o kernels/CMakeFiles/embree.dir/bvh/bvh_builder_sah_mb.cpp.o kernels/CMakeFiles/embree.dir/bvh/bvh_builder_twolevel.cpp.o kernels/CMakeFiles/embree.dir/bvh/bvh_intersector1_bvh4.cpp.o kernels/CMakeFiles/embree.dir/common/scene_subdiv_mesh.cpp.o kernels/CMakeFiles/embree.dir/subdiv/tessellation_cache.cpp.o kernels/CMakeFiles/embree.dir/subdiv/subdivpatch1base.cpp.o kernels/CMakeFiles/embree.dir/subdiv/catmullclark_coefficients.cpp.o kernels/CMakeFiles/embree.dir/geometry/grid_soa.cpp.o kernels/CMakeFiles/embree.dir/subdiv/subdivpatch1base_eval.cpp.o kernels/CMakeFiles/embree.dir/bvh/bvh_builder_subdiv.cpp.o kernels/CMakeFiles/embree.dir/bvh/bvh_intersector_hybrid4_bvh4.cpp.o libembree_sse42.a libembree_avx.a libembree_avx2.a libsys.a libmath.a libsimd.a liblexers.a libtasking.a /usr/lib64/libtbb.so.12.9 libsys.a -ldl libmath.a && :
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/common/../../common/sys/../math/../simd/varying.h:12:10: error: type ‘struct vfloat_impl’ violates the C++ One Definition Rule [-Werror=odr]
12 | struct vfloat_impl
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/geometry/../common/../../common/sys/../math/../simd/vfloat8_avx.h:18:10: note: a different type is defined in another translation unit
18 | struct vfloat<8>
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/common/../../common/sys/../math/../simd/varying.h:14:5: note: the first difference of corresponding definitions is field ‘<anonymous>’
14 | union { float f[N]; int i[N]; };
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/geometry/../common/../../common/sys/../math/../simd/vfloat8_avx.h:27:5: note: a field of same name but different type is defined in another translation unit
27 | union { __m256 v; float f[8]; int i[8]; }; // data
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/common/../../common/sys/../math/../simd/varying.h:14:11: note: type name ‘embree::vfloat_impl<8>::{unnamed type#1}’ should match type name ‘embree::vfloat_impl<8>::{unnamed type#2}’
14 | union { float f[N]; int i[N]; };
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/geometry/../common/../../common/sys/../math/../simd/vfloat8_avx.h:27:11: note: the incompatible type is defined here
27 | union { __m256 v; float f[8]; int i[8]; }; // data
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/common/../../common/sys/../math/../simd/varying.h:36:10: error: type ‘struct vuint_impl’ violates the C++ One Definition Rule [-Werror=odr]
36 | struct vuint_impl
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/geometry/../common/../../common/sys/../math/../simd/vuint8_avx.h:18:10: note: a different type is defined in another translation unit
18 | struct vuint<8>
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/common/../../common/sys/../math/../simd/varying.h:38:18: note: the first difference of corresponding definitions is field ‘i’
38 | unsigned int i[N];
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/geometry/../common/../../common/sys/../math/../simd/vuint8_avx.h:27:5: note: a field with different name is defined in another translation unit
27 | union { // data
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/common/../../common/sys/../math/vec3.h:21:14: error: type ‘struct <anon>’ violates the C++ One Definition Rule [-Werror=odr]
21 | struct {
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/geometry/../common/../../common/sys/../math/vec3.h:21:14: note: a different type is defined in another translation unit
21 | struct {
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/common/../../common/sys/../math/vec3.h:22:11: note: the first difference of corresponding definitions is field ‘x’
22 | T x, y, z;
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/geometry/../common/../../common/sys/../math/vec3.h:22:11: note: a field of same name but different type is defined in another translation unit
22 | T x, y, z;
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/common/../../common/sys/../math/../simd/varying.h:12:10: note: type ‘struct vfloat_impl’ itself violates the C++ One Definition Rule
12 | struct vfloat_impl
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/geometry/../common/../../common/sys/../math/../simd/vfloat8_avx.h:18:10: note: the incompatible type is defined here
18 | struct vfloat<8>
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/common/../../common/sys/../math/vec3.h:20:11: error: type ‘union <anon>’ violates the C++ One Definition Rule [-Werror=odr]
20 | union {
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/geometry/../common/../../common/sys/../math/vec3.h:20:11: note: a different type is defined in another translation unit
20 | union {
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/common/../../common/sys/../math/vec3.h:21:7: note: the first difference of corresponding definitions is field ‘<anonymous>’
21 | struct {
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/geometry/../common/../../common/sys/../math/vec3.h:21:7: note: a field of same name but different type is defined in another translation unit
21 | struct {
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/common/../../common/sys/../math/vec3.h:21:14: note: type ‘struct <anon>’ itself violates the C++ One Definition Rule
21 | struct {
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/geometry/../common/../../common/sys/../math/vec3.h:21:14: note: the incompatible type is defined here
21 | struct {
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/common/../../common/sys/../math/vec3.h:16:31: error: type ‘struct Vec3’ violates the C++ One Definition Rule [-Werror=odr]
16 | template<typename T> struct Vec3
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/geometry/../common/../../common/sys/../math/vec3.h:16:31: note: a different type is defined in another translation unit
16 | template<typename T> struct Vec3
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/common/../../common/sys/../math/vec3.h:20:5: note: the first difference of corresponding definitions is field ‘<anonymous>’
20 | union {
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/geometry/../common/../../common/sys/../math/vec3.h:20:5: note: a field of same name but different type is defined in another translation unit
20 | union {
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/common/../../common/sys/../math/vec3.h:20:11: note: type ‘union <anon>’ itself violates the C++ One Definition Rule
20 | union {
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/geometry/../common/../../common/sys/../math/vec3.h:20:11: note: the incompatible type is defined here
20 | union {
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/common/../../common/sys/../math/../simd/varying.h:28:10: error: type ‘struct vint_impl’ violates the C++ One Definition Rule [-Werror=odr]
28 | struct vint_impl
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/geometry/../common/../../common/sys/../math/../simd/vint8_avx.h:18:10: note: a different type is defined in another translation unit
18 | struct vint<8>
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/common/../../common/sys/../math/../simd/varying.h:30:9: note: the first difference of corresponding definitions is field ‘i’
30 | int i[N];
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/geometry/../common/../../common/sys/../math/../simd/vint8_avx.h:27:5: note: a field with different name is defined in another translation unit
27 | union { // data
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/common/ray.h:15:10: error: type ‘struct RayK’ violates the C++ One Definition Rule [-Werror=odr]
15 | struct RayK
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/geometry/../common/ray.h:15:10: note: a different type is defined in another translation unit
15 | struct RayK
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/common/ray.h:56:15: note: the first difference of corresponding definitions is field ‘org’
56 | Vec3vf<K> org; // ray origin
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/geometry/../common/ray.h:56:15: note: a field of same name but different type is defined in another translation unit
56 | Vec3vf<K> org; // ray origin
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/common/ray.h:15:10: note: type ‘struct Vec3vf’ itself violates the C++ One Definition Rule
15 | struct RayK
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/common/ray.h:73:10: error: type ‘struct RayHitK’ violates the C++ One Definition Rule [-Werror=odr]
73 | struct RayHitK : RayK<K>
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/geometry/../common/ray.h:73:10: note: a type with different bases is defined in another translation unit
73 | struct RayHitK : RayK<K>
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/geometry/../common/../../common/sys/../math/../simd/vuint8_avx.h:27:11: error: type ‘union <anon>’ violates the C++ One Definition Rule [-Werror=odr]
27 | union { // data
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/geometry/../common/../../common/sys/../math/../simd/vuint8_avx2.h:27:11: note: a different type is defined in another translation unit
27 | union { // data
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/geometry/../common/../../common/sys/../math/../simd/vuint8_avx.h:29:7: note: the first difference of corresponding definitions is field ‘<anonymous>’
29 | struct { __m128i vl,vh; };
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/geometry/../common/../../common/sys/../math/../simd/vuint8_avx2.h:29:20: note: a field with different name is defined in another translation unit
29 | unsigned int i[8];
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/geometry/../common/../../common/sys/../math/../simd/vint8_avx.h:27:11: error: type ‘union <anon>’ violates the C++ One Definition Rule [-Werror=odr]
27 | union { // data
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/geometry/../common/../../common/sys/../math/../simd/vint8_avx2.h:27:11: note: a different type is defined in another translation unit
27 | union { // data
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/geometry/../common/../../common/sys/../math/../simd/vint8_avx.h:29:7: note: the first difference of corresponding definitions is field ‘<anonymous>’
29 | struct { __m128i vl,vh; };
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/geometry/../common/../../common/sys/../math/../simd/vint8_avx2.h:29:11: note: a field with different name is defined in another translation unit
29 | int i[8];
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/geometry/../common/hit.h:14:12: error: type ‘struct HitK’ violates the C++ One Definition Rule [-Werror=odr]
14 | struct HitK
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/geometry/../common/hit.h:14:12: note: a different type is defined in another translation unit
14 | struct HitK
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/geometry/../common/hit.h:47:14: note: the first difference of corresponding definitions is field ‘primID’
47 | vuint<K> primID; // primitive ID
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/geometry/../common/hit.h:47:14: note: a field of same name but different type is defined in another translation unit
47 | vuint<K> primID; // primitive ID
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/geometry/../common/hit.h:14:12: note: type ‘struct vuint’ itself violates the C++ One Definition Rule
14 | struct HitK
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/geometry/pointi.h:11:10: error: type ‘struct PointMi’ violates the C++ One Definition Rule [-Werror=odr]
11 | struct PointMi
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/geometry/pointi.h:11:10: note: a different type is defined in another translation unit
11 | struct PointMi
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/geometry/pointi.h:224:14: note: the first difference of corresponding definitions is field ‘primIDs’
224 | vuint<M> primIDs; // primitive ID
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/geometry/pointi.h:224:14: note: a field of same name but different type is defined in another translation unit
224 | vuint<M> primIDs; // primitive ID
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/geometry/pointi.h:11:10: note: type ‘struct vuint’ itself violates the C++ One Definition Rule
11 | struct PointMi
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/geometry/linei.h:11:10: error: type ‘struct LineMi’ violates the C++ One Definition Rule [-Werror=odr]
11 | struct LineMi
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/geometry/linei.h:11:10: note: a different type is defined in another translation unit
11 | struct LineMi
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/geometry/linei.h:271:14: note: the first difference of corresponding definitions is field ‘v0’
271 | vuint<M> v0; // index of start vertex
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/geometry/linei.h:271:14: note: a field of same name but different type is defined in another translation unit
271 | vuint<M> v0; // index of start vertex
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/geometry/linei.h:11:10: note: type ‘struct vuint’ itself violates the C++ One Definition Rule
11 | struct LineMi
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/bvh/../common/../../common/sys/../math/vec3.h:21:14: error: type ‘struct <anon>’ violates the C++ One Definition Rule [-Werror=odr]
21 | struct {
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/bvh/../common/../../common/sys/../math/vec3.h:21:14: note: a different type is defined in another translation unit
21 | struct {
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/bvh/../common/../../common/sys/../math/vec3.h:22:11: note: the first difference of corresponding definitions is field ‘x’
22 | T x, y, z;
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/bvh/../common/../../common/sys/../math/vec3.h:22:11: note: a field of same name but different type is defined in another translation unit
22 | T x, y, z;
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/geometry/../common/../../common/sys/../math/../simd/vint8_avx.h:18:10: note: type ‘struct vint_impl’ itself violates the C++ One Definition Rule
18 | struct vint<8>
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/geometry/../common/../../common/sys/../math/../simd/vint8_avx2.h:18:10: note: the incompatible type is defined here
18 | struct vint<8>
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/bvh/../common/../../common/sys/../math/vec3.h:20:11: error: type ‘union <anon>’ violates the C++ One Definition Rule [-Werror=odr]
20 | union {
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/bvh/../common/../../common/sys/../math/vec3.h:20:11: note: a different type is defined in another translation unit
20 | union {
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/bvh/../common/../../common/sys/../math/vec3.h:21:7: note: the first difference of corresponding definitions is field ‘<anonymous>’
21 | struct {
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/bvh/../common/../../common/sys/../math/vec3.h:21:7: note: a field of same name but different type is defined in another translation unit
21 | struct {
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/bvh/../common/../../common/sys/../math/vec3.h:21:14: note: type ‘struct <anon>’ itself violates the C++ One Definition Rule
21 | struct {
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/bvh/../common/../../common/sys/../math/vec3.h:16:31: error: type ‘struct Vec3’ violates the C++ One Definition Rule [-Werror=odr]
16 | template<typename T> struct Vec3
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/bvh/../common/../../common/sys/../math/vec3.h:16:31: note: a different type is defined in another translation unit
16 | template<typename T> struct Vec3
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/bvh/../common/../../common/sys/../math/vec3.h:20:5: note: the first difference of corresponding definitions is field ‘<anonymous>’
20 | union {
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/bvh/../common/../../common/sys/../math/vec3.h:20:5: note: a field of same name but different type is defined in another translation unit
20 | union {
| ^
/var/tmp/portage/media-libs/embree-4.3.1/work/embree-4.3.1/kernels/bvh/../common/../../common/sys/../math/vec3.h:20:11: note: type ‘union <anon>’ itself violates the C++ One Definition Rule
20 | union {
| ^
lto1: some warnings being treated as errors
lto-wrapper: fatal error: /usr/bin/x86_64-pc-linux-gnu-g++ returned 1 exit status
compilation terminated.
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
Originally reported downstream: https://bugs.gentoo.org/859838
Full build log: build.log
Metadata
Metadata
Assignees
Labels
No labels
Type
Fields
No fields configured for issues without a type.
Activity
svenwoop commentedon Apr 30, 2025
Embree does not work with strict aliasing rules, which is why Embree compile option disable strict aliasing checks. Please just keep default compile settings.
eli-schwartz commentedon Apr 30, 2025
Hi, please take another look at this. The error message is NOT reporting a strict-aliasing issue, the error message states that you are violating the C++ One Definition Rule.
As part of working to make global distribution-wide LTO possible and safe, we test several flags at the same time. I could do a second build with LTO but without -Werror=strict-aliasing in order to "prove" that it's not a strict-aliasing diagnostic but IMO doing a second build for that is a waste of time -- the error message is already clear about that.
Please also note that:
I haven't overridden these! You can see in the compiler command line from the quoted diagnostic that your -fno-strict-aliasing is still being passed. Using
-Werror=strict-aliasing -fno-strict-aliasingis fine, because the compiler will not report aliasing issues (the-fcodegen option overrides a mere-Wwarning flag).The C++ One Definition Rule violation is its own distinct problem which is probably still worth fixing.
[-]Build fails with LTO[/-][+]Build fails with LTO due to ODR violations[/+]svenwoop commentedon Apr 30, 2025
Thanks for that feedback, I reopened the issue.