Closed
Description
Lately, I've been trying to build Jerry on a platform which is not supported by jerry-libc (aarch64-linux), thus I had to fall back to the default glibc available there. Debug build worked fine, however, release build failed. Then it turned out that the error is also reproducible on an x86-64 box as well:
/usr/bin/x86_64-linux-gnu-g++ -ffixed-rbp -ffixed-rbp -fno-builtin -flto -fno-fat-lto-objects -fno-stack-protector -g -gdwarf-4 -Wall -Wextra -pedantic -Wformat-nonliteral -Winit-self -Wno-stack-protector -Wconversion -Wsign-conversion -Wformat-security -Wmissing-declarations -Wno-attributes -Wfatal-errors -Werror -Wlogical-op -std=c++11 -fno-exceptions -fno-rtti -fno-implicit-templates -fno-implicit-inline-templates -Os -Wl,-z,noexecstack -flto -static CMakeFiles/release.linux.dir/main-linux.cpp.o -o release.linux jerry-core/librelease.jerry-core.a third-party/fdlibm/librelease.jerry-fdlibm.third_party.lib.a /usr/lib/gcc/x86_64-linux-gnu/4.9/libgcc.a /usr/lib/gcc/x86_64-linux-gnu/4.9/libgcc_eh.a
In function ‘__fread_alias’,
inlined from ‘read_snapshot’ at /home/akiss/devel/jerry/jerryscript/main-linux.cpp:153:69,
inlined from ‘main’ at /home/akiss/devel/jerry/jerryscript/main-linux.cpp:390:70:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:290:66: error: call to ‘__fread_chk_warn’ declared with attribute warning: fread called with bigger size * nmemb than length of destination buffer [-Werror]
return __fread_chk (__ptr, __bos0 (__ptr), __size, __n, __stream);
^
compilation terminated due to -Wfatal-errors.
lto1: all warnings being treated as errors
lto-wrapper: /usr/bin/x86_64-linux-gnu-g++ returned 1 exit status
/usr/bin/ld: lto-wrapper failed
collect2: error: ld returned 1 exit status
make[4]: *** [release.linux] Error 1
It seems that a long-open gcc bug causes spurious warnings when LTO is enabled: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61886 And the -Werror flag turns these eventually into errors, and thus the build process fails. Unfortunately, there is no way to selectively disable the warning with pragmas or -Wno-error=xxx flags.
Metadata
Metadata
Assignees
Labels
No labels