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

Cross-compiling to aarch64 with -flto breaks try_compile in configure__f.sh #148

Open
DrasLorus opened this issue Sep 28, 2024 · 0 comments

Comments

@DrasLorus
Copy link

Trying to cross compile perl-5.40 for aarch64-unknown-linux-gnu from x86_64-pv-linux-gnu fails during miniperl configure aarch64 stage with perl-cross-1.6.

GCC version: 13.3.1 20240614
Perl: 5.40.0
perl-cross: 1.6
Host: Gentoo x86_64-pc-linux-gnu
Target: Gentoo aarch64-unknown-linux-gnu
Build method: using ebuild from Gentoo

In configure_type.sh, all byte length estimations fail if -flto is present in CFLAGS.
It thus results in all byte length and order checks to fail.

I found out that adding -fno-lto in try_compile in configure__f.sh, line 279, solves the issue.
I am not aware of possible side effects, as I am not familiar with autotool.

About what seems to be the cause: it appears that the symbol foo is not directly available in the symbol table of the try.o file when LTO is enabled, but instead hidden in the LTO table.
Thus, the “result” variable of line 48 of configure_type.sh is empty.
It also results in an “integer expected line 48” produced by the script (where I started the journey), e.g.:

Checking type long long ... found
Checking size of char ... cnf/configure_type.sh: line 48: [: : integer expression expected
 bytes
Checking size of short ... cnf/configure_type.sh: line 48: [: : integer expression expected
 bytes
Checking size of int ... cnf/configure_type.sh: line 48: [: : integer expression expected
 bytes
Checking size of long ... cnf/configure_type.sh: line 48: [: : integer expression expected
 bytes
Checking size of double ... cnf/configure_type.sh: line 48: [: : integer expression expected
 bytes
Checking size of void* ... cnf/configure_type.sh: line 48: [: : integer expression expected
 bytes
Checking size of long double ... cnf/configure_type.sh: line 48: [: : integer expression expected
 bytes
Checking size of long long ... cnf/configure_type.sh: line 48: [: : integer expression expected
 bytes
Checking type fd_set ... found
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