Nikita Karetnikov <nik...@karetnikov.org> skribis: > I'm trying to cross-build the Glasgow Haskell Compiler 7.6.2 [1]. > > I got stuck when I was trying to build a cross-compiler (Stage 1). > For some reason, it uses '/usr/bin/ld' instead of a cross-linker.
You mean it _tries_ to use it, because it’s not available in chroot builds, right? > # ./configure --target=mips64el-linux \ > > --with-gcc=/nix/store/khdyz3i5aih56lxfk6hjvp3884apm7qb-gcc-cross-mips64el-linux-gnu-4.7.2/bin/mips64el-linux-gnu-gcc > \ > > --with-ld=/nix/store/bqw0chxysv4x73mf6bv7jqmgy7553xqh-binutils-cross-mips64el-linux-gnu-2.22/bin/mips64el-linux-gnu-ld > \ > > --with-nm=/nix/store/khdyz3i5aih56lxfk6hjvp3884apm7qb-gcc-cross-mips64el-linux-gnu-4.7.2/bin/mips64el-linux-gnu-gcc-nm > > However, the above doesn't work. I'm getting the following error: > > /usr/bin/ld: > /nix/store/mifp2p1zjlvb4ndslw1r8grkpglybqjf-glibc-cross-mips64el-linux-gnu-2.17/include/../lib/crt1.o: > Relocations in generic ELF (EM: 8) > /usr/bin/ld: > /nix/store/mifp2p1zjlvb4ndslw1r8grkpglybqjf-glibc-cross-mips64el-linux-gnu-2.17/include/../lib/crt1.o: > Relocations in generic ELF (EM: 8) > /usr/bin/ld: > /nix/store/mifp2p1zjlvb4ndslw1r8grkpglybqjf-glibc-cross-mips64el-linux-gnu-2.17/include/../lib/crt1.o: > Relocations in generic ELF (EM: 8) > /usr/bin/ld: > /nix/store/mifp2p1zjlvb4ndslw1r8grkpglybqjf-glibc-cross-mips64el-linux-gnu-2.17/include/../lib/crt1.o: > Relocations in generic ELF (EM: 8) > /nix/store/mifp2p1zjlvb4ndslw1r8grkpglybqjf-glibc-cross-mips64el-linux-gnu-2.17/include/../lib/crt1.o: > could not read symbols: File in wrong format > collect2: ld returned 1 exit status > configure: error: Building ghc-pwd failed Perhaps it needs both a native GCC and a cross-GCC (ditto for ‘ld’), no? (For instance because ghc-pwd is a program to run during the build, so it needs to be a native program.) Does it have --with-target-gcc or similar in addition to --with-gcc? If not, you should find the Makefile that triggers the faulty /usr/bin/ld invocation above, and see if you could patch it somehow. Wild guesses & free advice. ;-) Ludo’.