GHC issueshttps://gitlab.haskell.org/ghc/ghc/-/issues2019-07-07T18:35:46Zhttps://gitlab.haskell.org/ghc/ghc/-/issues/10476Wrong ar during cross-compilation2019-07-07T18:35:46ZJakub ZalewskiWrong ar during cross-compilationIt appears that during cross-compilation, while building stage 1 ghc, the build system uses ar for target architecture instead of ar for build/host architecture.
It will cause linking errors on systems where ar for target architecture i...It appears that during cross-compilation, while building stage 1 ghc, the build system uses ar for target architecture instead of ar for build/host architecture.
It will cause linking errors on systems where ar for target architecture is incompatible with ar for build/host architecture (sample output attached below).
```
(...)
"rm" -f libraries/Cabal/Cabal/dist-boot/build/libHSCabal-1.22.3.0-3tdTeip89ooLNDDdwdA54s.a.contents
"rm" -f libraries/bin-package-db/dist-boot/build/libHSbin-package-db-0.0.0.0-Gk3F1vzzO3g80wuNGtok3x.a libraries/bin-package-db/dist-boot/build/libHSbin-package-db-0.0.0.0-Gk3F1vzzO3g80wuNGtok3x.a.contents
echo libraries/bin-package-db/dist-boot/build/GHC/PackageDb.o >> libraries/bin-package-db/dist-boot/build/libHSbin-package-db-0.0.0.0-Gk3F1vzzO3g80wuNGtok3x.a.contents
"/Users/jakub/src/haskell/PNaCl/gsoc/wrappers/i686-unknown-nacl-ar" q libraries/bin-package-db/dist-boot/build/libHSbin-package-db-0.0.0.0-Gk3F1vzzO3g80wuNGtok3x.a @libraries/bin-package-db/dist-boot/build/libHSbin-package-db-0.0.0.0-Gk3F1vzzO3g80wuNGtok3x.a.contents
/Users/jakub/src/nacl_sdk/pepper_canary/toolchain/mac_x86_newlib/bin/i686-nacl-ar: creating libraries/bin-package-db/dist-boot/build/libHSbin-package-db-0.0.0.0-Gk3F1vzzO3g80wuNGtok3x.a
"rm" -f libraries/bin-package-db/dist-boot/build/libHSbin-package-db-0.0.0.0-Gk3F1vzzO3g80wuNGtok3x.a.contents
(...)
ld: archive has no table of contents file '/Users/jakub/src/haskell/PNaCl/ghc-pnacl/libraries/terminfo/dist-boot/build/libHSterminfo-0.4.0.1-7qZwBlx3clR8sTBilJl253.a' for architecture x86_64
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ---------------- |
| Version | 7.11 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | low |
| Resolution | Unresolved |
| Component | Build System |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | Unknown/Multiple |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Wrong ar during cross-compilation","status":"New","operating_system":"Unknown/Multiple","component":"Build System","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"7.11","keywords":["cross-compiling"],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"It appears that during cross-compilation, while building stage 1 ghc, the build system uses ar for target architecture instead of ar for build/host architecture.\r\n\r\nIt will cause linking errors on systems where ar for target architecture is incompatible with ar for build/host architecture (sample output attached below).\r\n\r\n{{{\r\n(...)\r\n\"rm\" -f libraries/Cabal/Cabal/dist-boot/build/libHSCabal-1.22.3.0-3tdTeip89ooLNDDdwdA54s.a.contents \r\n\"rm\" -f libraries/bin-package-db/dist-boot/build/libHSbin-package-db-0.0.0.0-Gk3F1vzzO3g80wuNGtok3x.a libraries/bin-package-db/dist-boot/build/libHSbin-package-db-0.0.0.0-Gk3F1vzzO3g80wuNGtok3x.a.contents \r\necho libraries/bin-package-db/dist-boot/build/GHC/PackageDb.o >> libraries/bin-package-db/dist-boot/build/libHSbin-package-db-0.0.0.0-Gk3F1vzzO3g80wuNGtok3x.a.contents\r\n\"/Users/jakub/src/haskell/PNaCl/gsoc/wrappers/i686-unknown-nacl-ar\" q libraries/bin-package-db/dist-boot/build/libHSbin-package-db-0.0.0.0-Gk3F1vzzO3g80wuNGtok3x.a @libraries/bin-package-db/dist-boot/build/libHSbin-package-db-0.0.0.0-Gk3F1vzzO3g80wuNGtok3x.a.contents\r\n/Users/jakub/src/nacl_sdk/pepper_canary/toolchain/mac_x86_newlib/bin/i686-nacl-ar: creating libraries/bin-package-db/dist-boot/build/libHSbin-package-db-0.0.0.0-Gk3F1vzzO3g80wuNGtok3x.a\r\n\"rm\" -f libraries/bin-package-db/dist-boot/build/libHSbin-package-db-0.0.0.0-Gk3F1vzzO3g80wuNGtok3x.a.contents \r\n(...)\r\nld: archive has no table of contents file '/Users/jakub/src/haskell/PNaCl/ghc-pnacl/libraries/terminfo/dist-boot/build/libHSterminfo-0.4.0.1-7qZwBlx3clR8sTBilJl253.a' for architecture x86_64\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->7.10.3Thomas MiedemaThomas Miedemahttps://gitlab.haskell.org/ghc/ghc/-/issues/10409Binary compiled with ghc-7.10 amd64/linux to aarch64/linux cross compiler seg...2019-07-07T18:36:03ZerikdBinary compiled with ghc-7.10 amd64/linux to aarch64/linux cross compiler segfaults.Compiling a simple "hello-world" program with an amd64/linux to aarch64/linux cross compiler built from the current `ghc-7.10` branch results in a binary that segfaults as soon as it is run.
A cross compiler build from the master branch...Compiling a simple "hello-world" program with an amd64/linux to aarch64/linux cross compiler built from the current `ghc-7.10` branch results in a binary that segfaults as soon as it is run.
A cross compiler build from the master branch works and I thought it also worked for `ghc-7.10`.
A native aarch64/linux compiler built from the `ghc-7.10` branch works correctly.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 7.10.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Binary compiled with ghc-7.10 amd64/linux to aarch64/linux cross compiler segfaults.","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"OwnedBy","contents":"erikd"},"version":"7.10.1","keywords":["cross-compiling"],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"Compiling a simple \"hello-world\" program with an amd64/linux to aarch64/linux cross compiler built from the current `ghc-7.10` branch results in a binary that segfaults as soon as it is run.\r\n\r\nA cross compiler build from the master branch works and I thought it also worked for `ghc-7.10`.\r\n\r\nA native aarch64/linux compiler built from the `ghc-7.10` branch works correctly.\r\n\r\n\r\n","type_of_failure":"OtherFailure","blocking":[]} -->7.10.3erikderikd