unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: Nikita Karetnikov <nikita@karetnikov.org>
Cc: bug-guix@gnu.org
Subject: Re: Cross-building GHC
Date: Thu, 14 Mar 2013 18:32:09 +0100	[thread overview]
Message-ID: <87620trip2.fsf@gnu.org> (raw)
In-Reply-To: <87sj443got.fsf@karetnikov.org> (Nikita Karetnikov's message of "Sat, 09 Mar 2013 16:23:30 +0400")

Nikita Karetnikov <nikita@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’.

  reply	other threads:[~2013-03-14 17:32 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-09 12:23 Cross-building GHC Nikita Karetnikov
2013-03-14 17:32 ` Ludovic Courtès [this message]
2013-03-14 19:12   ` Nikita Karetnikov
2013-03-14 23:20     ` Ludovic Courtès
2013-05-16  8:04       ` Nikita Karetnikov
2013-05-16 18:16         ` Ludovic Courtès
2013-05-17  4:03           ` Nikita Karetnikov
2013-05-17 13:31             ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87620trip2.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=bug-guix@gnu.org \
    --cc=nikita@karetnikov.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).