alire-project / alire

Command-line tool from the Alire project and supporting library
GNU General Public License v3.0
278 stars 49 forks source link

Testsuite failures on aarch64-apple-darwin #1012

Open simonjwright opened 2 years ago

simonjwright commented 2 years ago

Having applied this fix to e3-core I get the following failures with d34cc53.

INFO     FAIL            pin__recursive-local: non-zero status code
INFO     FAIL            printenv__compiler-indirect: non-zero status code
INFO     FAIL            pin__dir-mismatch: non-zero status code
INFO     FAIL            with__git-reference: non-zero status code
INFO     FAIL            pin__conflicting-link: non-zero status code
INFO     FAIL            pin__dir-crate: non-zero status code
INFO     FAIL            with__pin-transitive: non-zero status code
INFO     FAIL            build_profile__custom_switches: non-zero status code
INFO     FAIL            pin__without-lockfile: non-zero status code
INFO     FAIL            pin__branch: non-zero status code
INFO     FAIL            build_profile__custom_profiles: non-zero status code
INFO     FAIL            pin__change-path: non-zero status code
INFO     FAIL            pin__equivalent: non-zero status code
INFO     FAIL            publish__pin-removal: non-zero status code
INFO     FAIL            workflows__actions-as-root: non-zero status code
INFO     FAIL            pin__recursive-remote: non-zero status code
INFO     FAIL            pin__remote: non-zero status code
INFO     FAIL            with__tree-switch: non-zero status code
INFO     FAIL            with__pin-dir-crate-autodetect: non-zero status code
INFO     FAIL            with__changes-info: non-zero status code
INFO     FAIL            printenv__linked-paths: non-zero status code
INFO     FAIL            build_profile__default: non-zero status code
INFO     FAIL            pin__pin-dir: non-zero status code
INFO     FAIL            pin__change-type: non-zero status code
INFO     FAIL            pin__pin-dir-with-regular: non-zero status code
INFO     FAIL            get__indirect-link: non-zero status code
INFO     FAIL            with__pin-dir-mismatch: non-zero status code
INFO     FAIL            with__equivalent: non-zero status code
INFO     FAIL            pin__conflicting-remote: non-zero status code
INFO     FAIL            with__versions-switch: non-zero status code
INFO     FAIL            with__pin-dir: non-zero status code
INFO     FAIL            crate_config__basic: non-zero status code
INFO     FAIL            build__incremental: non-zero status code
INFO     FAIL            pin__portable-path: non-zero status code
INFO     FAIL            with__pin-dir-crate: non-zero status code
INFO     FAIL            workflows__actions-as-dependency: non-zero status code
INFO     FAIL            pin__circularity: non-zero status code
INFO     FAIL            build_profile__alr_build_switches: non-zero status code
INFO     FAIL            solver__compiler-mixing: non-zero status code
  FAIL         39

This appears to be related to pins, particularly link pins, as in this output from alr update in trendy_terminal_tests:

$ alr update
[...]                                                                   
Changes to dependency solution:

   +⊙ trendy_terminal 0.0.5 (new,path=)
   +  trendy_test     0.0.3 (new)      

Do you want to proceed?
[Y] Yes  [N] No  (default is Yes) no

(the path=).

I strongly suspect this is related to this ada-toml issue.

I started to work on fixing up the alire source, but became quite confused about which parts were meant to change queues and which were merely to inspect them, so I'm not going to proceed until I hear from you!

I think we're OK as long as people don't use pins, so newcomers should be unaffected.

simonjwright commented 2 years ago

I tried to make a reproducer, but failed: it could always be a compiler error 👎

simonjwright commented 2 years ago

It is a compiler issue, nothing to do with ada-toml; alire-vfs.adb needs to be compiled with optimisation level > 0.

That done I get only one fail, crate_config__basic:

_Diff:
_--- expected
_
_+++ actual
_
_@@ -1,7 +1,7 @@
_
_ Ada -> Crate_Version: 1.0.0
_ Ada -> Crate_Name: libcrate_config
_ Ada -> Alire_Host_OS: macos
_-Ada -> Alire_Host_Arch: arm64
_+Ada -> Alire_Host_Arch: aarch64
_ Ada -> Alire_Host_Distro: distro_unknown
_ Ada -> Var_Bool: TRUE
_ Ada -> Var_String: 'Test string.'
_@@ -18,7 +18,7 @@
_
_ C -> Crate_Version: 1.0.0
_ C -> Crate_Name: libcrate_config
_ C -> Alire_Host_OS: macos
_-C -> Alire_Host_Arch: arm64
_+C -> Alire_Host_Arch: aarch64
_ C -> Alire_Host_Distro: distro_unknown
_ C -> VAR_BOOL: 1
_ C -> VAR_STRING: 'Test string.'

which should be easy enough to fix.

BTW, -Og fixes the problem too.

JeremyGrosser commented 2 years ago

I believe I'm running into the same issue on aarch64 Linux.

Tracing with gdb, this Dynamic_Predicate is calling memset and causing a segfault there.

Removing that predicate fixes pins regardless of optimization level.

On armv8-a, the stack pointer must always be aligned to a 16-bit word (eg. the lowest 4 bits must always be zero). I suspect that somehow the compiler isn't accounting for this.

Adding Alignment => 2 to type Portable_Path fixes the issue without removing the predicate or changing optimization flags.

Fabien-Chouteau commented 2 years ago

@simonjwright that should do the trick -> https://github.com/alire-project/alire/pull/1015

simonjwright commented 2 years ago

@JeremyGrosser Thanks, but that didn't fix this problem