ghc - 如何在 Alpinelinux 中构建 GHC 的交叉编译器?
问题描述
我在 Alpinelinux v3.9 x86_64 中完成了以下步骤并得到了错误。
- 在 aport 中运行 bootstrap.sh 以获取 aarch64-alpine-linux-musl-* 工具。
- 在 x86_64 中构建和安装 llvm6。
- 将所有 aarch64-alpine-linux-musl-* 链接到 aarch64-unknown-linux-*。
仅使用“--target=aarch64-unknown-linux”配置 ghc 8.6.3。
Configure completed successfully. Building GHC version : 8.6.3 Git commit id : 31cd867e4d37072c3ce1d51efadc94e66ddc1c28 Build platform : x86_64-alpine-linux Host platform : x86_64-alpine-linux Target platform : aarch64-unknown-linux Bootstrapping using : /usr/bin/ghc which is version : 8.4.3 Using (for bootstrapping) : gcc Using gcc : aarch64-unknown-linux-gcc which is version : 8.2.0 Building a cross compiler : YES Unregisterised : NO hs-cpp : aarch64-unknown-linux-gcc hs-cpp-flags : -E -undef -traditional ar : aarch64-unknown-linux-ar ld : aarch64-unknown-linux-ld.gold nm : aarch64-unknown-linux-nm libtool : objdump : aarch64-unknown-linux-objdump ranlib : aarch64-unknown-linux-ranlib windres : dllwrap : genlib : Happy : () Alex : () Perl : /usr/bin/perl sphinx-build : xelatex : Using LLVM tools clang : llc : llc opt : opt HsColour was not found; documentation will not contain source links Tools to build Sphinx HTML documentation available: NO Tools to build Sphinx PDF documentation available: NO ---------------------------------------------------------------------- For a standard build of GHC (fully optimised with profiling), type (g)make. To make changes to the default build configuration, copy the file mk/build.mk.sample to mk/build.mk, and edit the settings in there. For more information on how to configure your GHC build, see http://ghc.haskell.org/trac/ghc/wiki/Building
制作。
===--- building final phase make --no-print-directory -f ghc.mk phase=final all "ld" -z noexecstack -r -o libraries/ghc-prim/dist-install/build/HSghc-prim-0.5.3.o libraries/ghc-prim/dist-install/build/GHC/CString.o libraries/ghc-prim/dist-install/build/GHC/Classes.o libraries/ghc-prim/dist-install/build/GHC/Debug.o libraries/ghc-prim/dist-install/build/GHC/IntWord64.o libraries/ghc-prim/dist-install/build/GHC/Magic.o libraries/ghc-prim/dist-install/build/GHC/PrimopWrappers.o libraries/ghc-prim/dist-install/build/GHC/Tuple.o libraries/ghc-prim/dist-install/build/GHC/Types.o libraries/ghc-prim/dist-install/build/cbits/atomic.o libraries/ghc-prim/dist-install/build/cbits/bswap.o libraries/ghc-prim/dist-install/build/cbits/clz.o libraries/ghc-prim/dist-install/build/cbits/ctz.o libraries/ghc-prim/dist-install/build/cbits/debug.o libraries/ghc-prim/dist-install/build/cbits/longlong.o libraries/ghc-prim/dist-install/build/cbits/pdep.o libraries/ghc-prim/dist-install/build/cbits/pext.o libraries/ghc-prim/dist-install/build/cbits/popcnt.o libraries/ghc-prim/dist-install/build/cbits/word2float.o ld: libraries/ghc-prim/dist-install/build/GHC/CString.o: Relocations in generic ELF (EM: 183) ld: libraries/ghc-prim/dist-install/build/GHC/CString.o: Relocations in generic ELF (EM: 183) ld: libraries/ghc-prim/dist-install/build/GHC/CString.o: error adding symbols: file in wrong format make[1]: *** [libraries/ghc-prim/ghc.mk:4: libraries/ghc-prim/dist-install/build/HSghc-prim-0.5.3.o] Error 1 make: *** [Makefile:127: all] Error 2 $ file ./libraries/ghc-prim/dist-install/build/GHC/CString.o ./libraries/ghc-prim/dist-install/build/GHC/CString.o: ELF 64-bit LSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
解决方案
知道了。删除 ld.gold 并将 ld 复制为 ld.gold 后,构建过程通过。简单测试通过。
推荐阅读
- python - 'where 子句'中的未知列'name'
- swift - 检查特定日期是否是今天(或过去)斯威夫特
- c++11 - 使用整数 (int) 作为指针参数
- python-3.x - ubuntu 上的 Python 脚本 - OSError: [Errno 12] 无法分配内存
- rust - 在 Vulkan 计算管道中使用输入和输出缓冲区
- c - 清除malloc的函数,并使指针指向null
- php - 有没有办法让 `$this->$key` 被声明为受保护或私有而不是公共
- ios - URL Scheme 并不总是调用函数
- button - Fullcalendar 标题按钮没有响应?
- javascript - 由于函数的执行顺序,重定向不起作用