-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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-compilation to aarch64 fails because of __arm__ ends up also defined. #10335
Comments
I can confirm the produced aarch64 binaries with arm undefined seem to work fine on aarch64 (raspberrypi4 in 64 bit mode).
|
I tried your recipe on hardknott and found it helpful. But I needed to add
to make it compile. (There was an error However I can't confirm this issue here for building for Odroid device that is also aarch64. Maybe a problem with rasberrypi recipe? Nonetheless thanks for this recipe. I hope we will find more people testing this recipe on aarch64 devices. |
Using Dunfell I could reproduce @cveilleux's issue. |
aarch64 is a different architecture than arm. Some compilers might choke when both __arm__ and __aarch64__ are defined. This change separates the checks for arm and for aarch64 in the isa_defs.h header files. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Windel Bouwman <[email protected]> Closes openzfs#10335 Closes openzfs#13151
aarch64 is a different architecture than arm. Some compilers might choke when both __arm__ and __aarch64__ are defined. This change separates the checks for arm and for aarch64 in the isa_defs.h header files. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Windel Bouwman <[email protected]> Closes openzfs#10335 Closes openzfs#13151
aarch64 is a different architecture than arm. Some compilers might choke when both __arm__ and __aarch64__ are defined. This change separates the checks for arm and for aarch64 in the isa_defs.h header files. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Windel Bouwman <[email protected]> Closes openzfs#10335 Closes openzfs#13151
aarch64 is a different architecture than arm. Some compilers might choke when both __arm__ and __aarch64__ are defined. This change separates the checks for arm and for aarch64 in the isa_defs.h header files. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Windel Bouwman <[email protected]> Closes openzfs#10335 Closes openzfs#13151
aarch64 is a different architecture than arm. Some compilers might choke when both __arm__ and __aarch64__ are defined. This change separates the checks for arm and for aarch64 in the isa_defs.h header files. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Windel Bouwman <[email protected]> Closes openzfs#10335 Closes openzfs#13151
aarch64 is a different architecture than arm. Some compilers might choke when both __arm__ and __aarch64__ are defined. This change separates the checks for arm and for aarch64 in the isa_defs.h header files. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Windel Bouwman <[email protected]> Closes openzfs#10335 Closes openzfs#13151
aarch64 is a different architecture than arm. Some compilers might choke when both __arm__ and __aarch64__ are defined. This change separates the checks for arm and for aarch64 in the isa_defs.h header files. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Windel Bouwman <[email protected]> Closes openzfs#10335 Closes openzfs#13151
aarch64 is a different architecture than arm. Some compilers might choke when both __arm__ and __aarch64__ are defined. This change separates the checks for arm and for aarch64 in the isa_defs.h header files. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Windel Bouwman <[email protected]> Closes openzfs#10335 Closes openzfs#13151
aarch64 is a different architecture than arm. Some compilers might choke when both __arm__ and __aarch64__ are defined. This change separates the checks for arm and for aarch64 in the isa_defs.h header files. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Windel Bouwman <[email protected]> Closes openzfs#10335 Closes openzfs#13151
aarch64 is a different architecture than arm. Some compilers might choke when both __arm__ and __aarch64__ are defined. This change separates the checks for arm and for aarch64 in the isa_defs.h header files. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Windel Bouwman <[email protected]> Closes openzfs#10335 Closes openzfs#13151
aarch64 is a different architecture than arm. Some compilers might choke when both __arm__ and __aarch64__ are defined. This change separates the checks for arm and for aarch64 in the isa_defs.h header files. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Windel Bouwman <[email protected]> Closes openzfs#10335 Closes openzfs#13151
aarch64 is a different architecture than arm. Some compilers might choke when both __arm__ and __aarch64__ are defined. This change separates the checks for arm and for aarch64 in the isa_defs.h header files. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Windel Bouwman <[email protected]> Closes openzfs#10335 Closes openzfs#13151
aarch64 is a different architecture than arm. Some compilers might choke when both __arm__ and __aarch64__ are defined. This change separates the checks for arm and for aarch64 in the isa_defs.h header files. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Windel Bouwman <[email protected]> Closes openzfs#10335 Closes openzfs#13151
aarch64 is a different architecture than arm. Some compilers might choke when both __arm__ and __aarch64__ are defined. This change separates the checks for arm and for aarch64 in the isa_defs.h header files. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Windel Bouwman <[email protected]> Closes openzfs#10335 Closes openzfs#13151
aarch64 is a different architecture than arm. Some compilers might choke when both __arm__ and __aarch64__ are defined. This change separates the checks for arm and for aarch64 in the isa_defs.h header files. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Windel Bouwman <[email protected]> Closes openzfs#10335 Closes openzfs#13151
System information
Describe the problem you're observing
Cross-compilation using the Yocto build system works for arm, but fails when targetting aarch64.
Describe how to reproduce the problem
The autotools class of yocto will produce what looks like a reasonable setup for cross-compiling zfs.
The ./configure step is called with:
This sets both the host and target and the libtool root if fully setup with all the requirements compiled for aarch64.
You can see my bitbake recipe here:
https://gist.github.com/cveilleux/54961ccc41071e8aee8c19b69fcba78f
Include any warning/errors/backtraces from the system logs
The compilation on aarch64 will crash on the first input file with:
As you can see, libc's bits/endian.h is trying to import 32 bits headers, which do not exist on aarch64. Something is wrong.
Investigation
I've looked into the ifdefs of endian.h. The relevant part:
The ifdefs looks for arm first, then for arch64.
With some debugging I've concluded that zfs ends up defining both arm and aarch64, and the ifdef orders ends-up wrongly selected 32 bit wordsize.
Crappy hack to get it to compile
I found that include/spl/sys/isa_defs.h and lib/libspl/include/sys/isa_defs.h in zfs source ends up defining both arm and aarch64 here:
https://github.com/openzfs/zfs/blob/master/lib/libspl/include/sys/isa_defs.h#L113-L115
and here:
zfs/include/os/linux/spl/sys/isa_defs.h
Lines 101 to 103 in 4254e40
By removing these defs, I was able to cross-compile for aarch64.
I so far tested that the produced builds from this hack work on arm and amd64, but I am waiting on hardware to confirm the fix also works on aarch64. I will report back on success.
I am not confident enough that this change won't break anything to submit a pull-request.
I've searched the zfs code-base and there seems to be only very few cases where there is an ifdef on arm and not also a specific one on aarch64.
The text was updated successfully, but these errors were encountered: