all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Nikita Karetnikov <nikita@karetnikov.org>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: bug-guix@gnu.org
Subject: Re: Initial cross-compilation support
Date: Sat, 30 Mar 2013 01:20:13 +0400	[thread overview]
Message-ID: <87hajtq4xe.fsf@karetnikov.org> (raw)
In-Reply-To: 877gkqo7w7.fsf@gnu.org

[-- Attachment #1: Type: text/plain, Size: 6290 bytes --]

> The absolute file name appeared in your previous message:

>   /nix/store/g9js73bwv1fl92h1nnf50vf1619irnxf-gcc-cross-sans-libc-mips64el-linux-gnu-4.7.2/lib/gcc/mips64el-linux-gnu/4.7.2/libgcc.a

# objdump -a /nix/store/g9js73bwv1fl92h1nnf50vf1619irnxf-gcc-cross-sans-libc-mips64el-linux-gnu-4.7.2/lib/gcc/mips64el-linux-gnu/4.7.2/libgcc.a | grep 'file format' | head
_m16addsf3.o:     file format elf64-little
_m16subsf3.o:     file format elf64-little
_m16mulsf3.o:     file format elf64-little
_m16divsf3.o:     file format elf64-little
_m16eqsf2.o:     file format elf64-little
_m16nesf2.o:     file format elf64-little
_m16gtsf2.o:     file format elf64-little
_m16gesf2.o:     file format elf64-little
_m16lesf2.o:     file format elf64-little
_m16ltsf2.o:     file format elf64-little

> After a bit of research, I found ports/sysdeps/mips/preconfigure (in
> libc).  Apparently, it interprets the OS part of the target triplet to
> determine the ABI.  So, if you specify --target=mips64el-linux-gnuabi64,
> it should automatically build glibc for n64.

I changed it like this:

diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm
index 69dc9f5..8cd93e9 100644
--- a/gnu/packages/cross-base.scm
+++ b/gnu/packages/cross-base.scm
@@ -87,6 +87,10 @@ GCC that does not target a libc; otherwise, target that libc."
                                    "--disable-libssp"
                                    "--disable-libquadmath"
                                    "--disable-decimal-float" ; would need libc
+
+                                   ;; MIPS64
+                                   "--with-arch=mips64"
+                                   "--with-abi=64"
                                    )))
 
                      ,(if libc
@@ -231,7 +235,8 @@ XBINUTILS and the cross tool chain."
 ;;;
 
 (define-public xgcc-mips64el
-  (let ((triplet "mips64el-linux-gnu"))
+  ;; (let ((triplet "mips64el-linux-gnu"))
+  (let ((triplet "mips64el-linux-gnuabi64"))
     (cross-gcc triplet
                (cross-binutils triplet)
                (cross-libc triplet))))

> So, if you specify --target=mips64el-linux-gnuabi64,
> it should automatically build glibc for n64.

But 'guix build' doesn't have '--target'.  How can I specify it?

So I used the following command:

# ./pre-inst-env guix build -K gcc-cross-mips64el-linux-gnuabi64

[...]

mips64el-linux-gnuabi64-gcc -mabi=64   -nostdlib -nostartfiles -r -o /tmp/nix-build-glibc-cross-mips64el-linux-gnuabi64-2.17.drv-1/build/libc_pic.os \
 -Wl,-d -Wl,--whole-archive /tmp/nix-build-glibc-cross-mips64el-linux-gnuabi64-2.17.drv-1/build/libc_pic.a -o /tmp/nix-build-glibc-cross-mips64el-linux-gnuabi64-2.17.drv-1/build/libc_pic.os
mips64el-linux-gnuabi64-gcc -mabi=64   -nostdlib -nostartfiles -r -o /tmp/nix-build-glibc-cross-mips64el-linux-gnuabi64-2.17.drv-1/build/elf/librtld.map.o '-Wl,-(' /tmp/nix-build-glibc-cross-mips64el-linux-gnuabi64-2.17.drv-1/build/elf/dl-allobjs.os /tmp/nix-build-glibc-cross-mips64el-linux-gnuabi64-2.17.drv-1/build/libc_pic.a -lgcc '-Wl,-)' -Wl,-Map,/tmp/nix-build-glibc-cross-mips64el-linux-gnuabi64-2.17.drv-1/build/elf/librtld.mapT
/tmp/nix-build-glibc-cross-mips64el-linux-gnuabi64-2.17.drv-1/build/libc_pic.a: could not read symbols: Archive has no index; run ranlib to add one
collect2: error: ld returned 1 exit status
make[2]: *** [/tmp/nix-build-glibc-cross-mips64el-linux-gnuabi64-2.17.drv-1/build/elf/librtld.map] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: Leaving directory `/tmp/nix-build-glibc-cross-mips64el-linux-gnuabi64-2.17.drv-1/glibc-2.17/elf'
make[1]: *** [elf/subdir_lib] Error 2
make[1]: Leaving directory `/tmp/nix-build-glibc-cross-mips64el-linux-gnuabi64-2.17.drv-1/glibc-2.17'
make: *** [all] Error 2
phase `build' failed after 258 seconds
note: keeping build directory `/tmp/nix-build-glibc-cross-mips64el-linux-gnuabi64-2.17.drv-1'
builder for `/nix/store/hdga358q2fcdcwlzy9g72cc6xaf2wvza-glibc-cross-mips64el-linux-gnuabi64-2.17.drv' failed with exit code 1
@ build-failed /nix/store/hdga358q2fcdcwlzy9g72cc6xaf2wvza-glibc-cross-mips64el-linux-gnuabi64-2.17.drv /nix/store/ca0s9nrmmfy654fjyg0rm73n3pnc677n-glibc-cross-mips64el-linux-gnuabi64-2.17 1 builder for `/nix/store/hdga358q2fcdcwlzy9g72cc6xaf2wvza-glibc-cross-mips64el-linux-gnuabi64-2.17.drv' failed with exit code 1
cannot build derivation `/nix/store/c4avrlc8bg33jsmwq9rgj8z8vyc69sdy-gcc-cross-mips64el-linux-gnuabi64-4.7.2.drv': 1 dependencies couldn't be built
error: build failed: build of `/nix/store/c4avrlc8bg33jsmwq9rgj8z8vyc69sdy-gcc-cross-mips64el-linux-gnuabi64-4.7.2.drv' failed

config.log:

[...]

configure:7187: mips64el-linux-gnuabi64-gcc -o conftest -g -O2   -mabi=64   conftest.c  -lgd -lpng -lz -lm >&5
conftest.c:19:16: fatal error: gd.h: No such file or directory

[...]

configure:7209: checking for is_selinux_enabled in -lselinux
configure:7234: mips64el-linux-gnuabi64-gcc -o conftest -g -O2  -mabi=64  conftest.c -lselinux   >&5
/nix/store/19rp26b4hzpdxnday60fxv7ygr5445aj-gcc-cross-sans-libc-mips64el-linux-gnuabi64-4.7.2/libexec/gcc/mips64el-linux-gnuabi64/ld: cannot find crt1.o: No such file or directory
/nix/store/19rp26b4hzpdxnday60fxv7ygr5445aj-gcc-cross-sans-libc-mips64el-linux-gnuabi64-4.7.2/libexec/gcc/mips64el-linux-gnuabi64/ld: cannot find crti.o: No such file or directory
/nix/store/19rp26b4hzpdxnday60fxv7ygr5445aj-gcc-cross-sans-libc-mips64el-linux-gnuabi64-4.7.2/libexec/gcc/mips64el-linux-gnuabi64/ld: cannot find -lselinux
/nix/store/19rp26b4hzpdxnday60fxv7ygr5445aj-gcc-cross-sans-libc-mips64el-linux-gnuabi64-4.7.2/libexec/gcc/mips64el-linux-gnuabi64/ld: cannot find -lc
/nix/store/19rp26b4hzpdxnday60fxv7ygr5445aj-gcc-cross-sans-libc-mips64el-linux-gnuabi64-4.7.2/libexec/gcc/mips64el-linux-gnuabi64/ld: cannot find crtn.o: No such file or directory
collect2: error: ld returned 1 exit status

[...]

configure:7404: mips64el-linux-gnuabi64-gcc -o conftest -g -O2  -mabi=64  conftest.c  >&5
conftest.c:22:19: fatal error: stdio.h: No such file or directory
compilation terminated.

There are other errors.  But I guess that they all have the same cause
(i.e., GCC can't find the needed files).  Is it correct?

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

  reply	other threads:[~2013-03-29 21:17 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-27 20:05 Initial cross-compilation support Ludovic Courtès
2013-03-03 16:26 ` Andreas Enge
2013-03-03 21:32   ` Ludovic Courtès
2013-03-28  9:35     ` Nikita Karetnikov
2013-03-28 13:38       ` Ludovic Courtès
2013-03-28 21:00         ` Nikita Karetnikov
2013-03-28 22:41           ` Ludovic Courtès
2013-03-29  1:49             ` Nikita Karetnikov
2013-03-29  9:46               ` Ludovic Courtès
2013-03-29 21:20                 ` Nikita Karetnikov [this message]
2013-03-29 21:39                   ` Ludovic Courtès
2013-03-29 22:06                     ` Nikita Karetnikov
2013-05-20 19:40                       ` Ludovic Courtès
2013-05-21 18:46                         ` Nikita Karetnikov
2013-05-21 20:04                           ` Ludovic Courtès
2013-05-21 20:23                             ` Nikita Karetnikov
2013-05-21 20:54                               ` Nikita Karetnikov
2013-05-21 21:00                               ` Ludovic Courtès
2013-03-04  0:19   ` Nikita Karetnikov
2013-03-04 10:10     ` Ludovic Courtès
2013-03-04 16:56       ` Nikita Karetnikov
2013-03-09  9:56         ` Nikita Karetnikov
2013-05-24 21:30           ` Ludovic Courtès
2013-05-24 21:59             ` Nikita Karetnikov
2013-05-24 22:26               ` Ludovic Courtès
2013-05-27 21:49                 ` Ludovic Courtès
2013-05-24 22:04 ` 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

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

  git send-email \
    --in-reply-to=87hajtq4xe.fsf@karetnikov.org \
    --to=nikita@karetnikov.org \
    --cc=bug-guix@gnu.org \
    --cc=ludo@gnu.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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.