You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 Undefined Behavior 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:
libtool: link: x86_64-pc-linux-gnu-g++ -fPIC -DPIC -shared -nostdlib /usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../lib64/crti.o /usr/lib/gcc/x86_64-pc-linux-gnu/13/crtbeginS.o src/base/.libs/libctemplate_la-arena.o src/.libs/libctemplate_la-per_expand_data.o src/.libs/libctemplate_la-template.o src/.libs/libctemplate_la-template_annotator.o src/.libs/libctemplate_la-template_cache.o src/.libs/libctemplate_la-template_dictionary.o src/.libs/libctemplate_la-template_modifiers.o src/.libs/libctemplate_la-template_namelist.o src/.libs/libctemplate_la-template_pathops.o src/.libs/libctemplate_la-template_string.o src/htmlparser/.libs/libctemplate_la-htmlparser.o src/htmlparser/.libs/libctemplate_la-jsparser.o src/htmlparser/.libs/libctemplate_la-statemachine.o -Wl,--as-needed -L/usr/lib/gcc/x86_64-pc-linux-gnu/13 -L/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/lib -L/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../.. -lstdc++ -lm -lc -lgcc_s /usr/lib/gcc/x86_64-pc-linux-gnu/13/crtendS.o /usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../lib64/crtn.o -march=native -fstack-protector-all -O2 -fdiagnostics-color=always -frecord-gcc-switches -flto=4 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing -Werror=format-security -Wl,-O1 -Wl,-z -Wl,pack-relative-relocs -flto=4 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing -Wl,--defsym=__gentoo_check_ldflags__=0 -pthread -Wl,-soname -Wl,libctemplate.so.3 -Wl,-retain-symbols-file -Wl,.libs/libctemplate.exp -o .libs/libctemplate.so.3.0.0
./src/ctemplate/template_cache.h:61:8: error: type 'struct TemplateCache' violates the C++ One Definition Rule [-Werror=odr]
61 | class TemplateCache {
| ^
./src/ctemplate/template_cache.h:61:8: note: a different type is defined in another translation unit
61 | class TemplateCache {
| ^
./src/ctemplate/template_cache.h:357:16: note: the first difference of corresponding definitions is field 'mutex_'
357 | Mutex* const mutex_;
| ^
./src/ctemplate/template_cache.h:357:16: note: a field of same name but different type is defined in another translation unit
357 | Mutex* const mutex_;
| ^
./src/base/mutex.h:168:7: note: type name 'ctemplate::Mutex' should match type name 'Mutex'
168 | class Mutex {
| ^
./src/ctemplate/template_cache.h:48:7: note: the incompatible type is defined here
48 | class Mutex;
| ^
lto1: some warnings being treated as errors
lto-wrapper: fatal error: x86_64-pc-linux-gnu-g++ returned 1 exit status
compilation terminated.
/usr/libexec/gcc/x86_64-pc-linux-gnu/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:1779: libctemplate.la] Error 1
There is nothing in this error message that is intrinsically about a forward declaration? The compiler is simply asserting the claim that they are different types with different names. One is ctemplate::Mutex and the other is Mutex.
template_cache.h.in declares Mutex one line below a namespace for ctemplate; mutex.h declares Mutex inside of a ctemplate namespace.
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 Undefined Behavior 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:
Originally reported downstream: https://bugs.gentoo.org/924637
Full build log: build.log
The text was updated successfully, but these errors were encountered: