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

Build fails with LTO #584

Open
eli-schwartz opened this issue May 2, 2024 · 0 comments
Open

Build fails with LTO #584

eli-schwartz opened this issue May 2, 2024 · 0 comments

Comments

@eli-schwartz
Copy link

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:

x86_64-pc-linux-gnu-gcc  -march=native -fstack-protector-all -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -flto=4 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing  -Wformat -Werror=format-security -Werror=implicit-function-declaration -Werror=implicit-int -Werror=int-conversion -Werror=incompatible-pointer-types  -Wl,-O1 -Wl,--as-needed -flto=4 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing -Wl,--defsym=__gentoo_check_ldflags__=0 -o ros main.o opt.o download.o download_windows.o archive.o archive_windows.o register-commands.o tsv-sbcl-bin.o util.o util_windows.o util-list.o util-string.o util-dir.o util-dir_windows.o util-file.o util-file_windows.o util-system.o util-system_windows.o util-cmdline.o proc-opt.o manual.o manual_windows.o cmd-internal.o cmd-script.o cmd-run.o cmd-run-sbcl.o cmd-run-ccl.o cmd-run-clasp.o cmd-run-clisp.o cmd-run-ecl.o cmd-run-mkcl.o cmd-run-abcl.o cmd-run-cmu.o cmd-run-acl.o cmd-run-lispworks.o cmd-run-npt.o cmd-install.o install-sbcl-bin.o install-sbcl-bin_windows.o resources.o -lcurl 
cmd-run.h:27:13: error: type of ‘register_runtime_options’ does not match original declaration [-Werror=lto-type-mismatch]
   27 | extern LVal register_runtime_options();
      |             ^
register-commands.c:63:18: note: return value type mismatch
   63 | struct proc_opt* register_runtime_options(struct proc_opt* cmd) {
      |                  ^
register-commands.c:63:18: note: ‘register_runtime_options’ was previously declared here
register-commands.c:63:18: note: code may be misoptimized unless ‘-fno-strict-aliasing’ is used
lto1: some warnings being treated as errors
lto-wrapper: fatal error: x86_64-pc-linux-gnu-gcc 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
make[2]: *** [Makefile:436: ros] Error 1
make[2]: Leaving directory '/var/tmp/portage/dev-lisp/roswell-22.12.14.113/work/roswell-22.12.14.113/src'
make[1]: *** [Makefile:615: all-recursive] Error 1
make: *** [Makefile:438: all] Error 2
 * ERROR: dev-lisp/roswell-22.12.14.113::gentoo failed (compile phase):

Originally reported downstream at https://bugs.gentoo.org/856106
Full build log: build.log

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant