* Initial cross-compilation support
@ 2013-02-27 20:05 Ludovic Courtès
2013-03-03 16:26 ` Andreas Enge
2013-05-24 22:04 ` Ludovic Courtès
0 siblings, 2 replies; 27+ messages in thread
From: Ludovic Courtès @ 2013-02-27 20:05 UTC (permalink / raw)
To: bug-guix
Hello!
Commit 827d289 of the ‘core-updates’ branch adds cross-base.scm, which
builds a cross tool chain.
So if you type ‘guix build gcc-cross-mips64el-linux-gnu’, you get a
cross-compiler (+ libc, binutils) for that platform. The compiler is
slightly modified by this patch:
http://git.savannah.gnu.org/cgit/guix.git/tree/gnu/packages/patches/gcc-cross-environment-variables.patch?h=core-updates&id=827d28914a16ef2d10ebdad4695efdb02ace07fb
The end goal is to be able to run:
guix build --target=mips64el-linux-gnu coreutils
and get a cross-built Coreutils.
What remains to be done is to implement ‘package-cross-derivation’ in
(guix packages), and to adjust build-system/gnu to support cross builds.
If someone volunteers, that’s always appreciated ;-), otherwise I’ll
check what I can do later on.
Ludo’.
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: Initial cross-compilation support
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-04 0:19 ` Nikita Karetnikov
2013-05-24 22:04 ` Ludovic Courtès
1 sibling, 2 replies; 27+ messages in thread
From: Andreas Enge @ 2013-03-03 16:26 UTC (permalink / raw)
To: bug-guix
Am Mittwoch, 27. Februar 2013 schrieb Ludovic Courtès:
> Commit 827d289 of the ‘core-updates’ branch adds cross-base.scm, which
> builds a cross tool chain.
>
> So if you type ‘guix build gcc-cross-mips64el-linux-gnu’, you get a
> cross-compiler (+ libc, binutils) for that platform. The compiler is
> slightly modified by this patch:
Congratulations! I tried the build and it worked without problem.
Am Sonntag, 3. März 2013 schrieb Nikita Karetnikov:
> > I’m making progress, but it may still be a week before it’s all in
> > place.
>
> I'm willing to try this [1]. What should I adjust to build with n64?
Currently, "file /nix/store/bxxk1jih4qy1hs7s22hp4f0i98b1ldn6-gcc-cross-
mips64el-linux-gnu-4.7.2/mips64el-linux-gnu/lib/libgcc_s.so.1" returns
ELF 32-bit LSB shared object, MIPS, N32 MIPS-III version 1 (SYSV),
dynamically linked, with unknown capability 0xf41 = 0x756e6700, with
unknown capability 0x70100 = 0x1040000, not stripped
I think one needs to add the configure parameters "--with-arch=mips64 --
with-abi=64" to the cross build of gcc; and maybe "-march=mip64 -mabi=64"
to the binutils and glibc. Ludovic should know best where to do it in the
code. And then, if one wishes to extract bootstrap binaries for arbitrary
target architectures (which are still needed, I suppose?), I assume one
would have to modify bootstrap.scm to use the cross gcc instead of the
native one.
Andreas
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: Initial cross-compilation support
2013-03-03 16:26 ` Andreas Enge
@ 2013-03-03 21:32 ` Ludovic Courtès
2013-03-28 9:35 ` Nikita Karetnikov
2013-03-04 0:19 ` Nikita Karetnikov
1 sibling, 1 reply; 27+ messages in thread
From: Ludovic Courtès @ 2013-03-03 21:32 UTC (permalink / raw)
To: Andreas Enge; +Cc: bug-guix
Andreas Enge <andreas@enge.fr> skribis:
> I think one needs to add the configure parameters "--with-arch=mips64 --
> with-abi=64" to the cross build of gcc; and maybe "-march=mip64 -mabi=64"
> to the binutils and glibc. Ludovic should know best where to do it in the
> code.
I would add a keyword parameter to ‘cross-gcc’ to allow extra configure
flags to be passed, or perhaps just an abstract #:abi flag.
> And then, if one wishes to extract bootstrap binaries for arbitrary
> target architectures (which are still needed, I suppose?), I assume
> one would have to modify bootstrap.scm to use the cross gcc instead of
> the native one.
Rather, you’d run ‘guix build --target=mips64-linux-gnu bootstrap-tarballs’
from an x86 machine.
Ludo’.
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: Initial cross-compilation support
2013-03-03 16:26 ` Andreas Enge
2013-03-03 21:32 ` Ludovic Courtès
@ 2013-03-04 0:19 ` Nikita Karetnikov
2013-03-04 10:10 ` Ludovic Courtès
1 sibling, 1 reply; 27+ messages in thread
From: Nikita Karetnikov @ 2013-03-04 0:19 UTC (permalink / raw)
To: Andreas Enge; +Cc: bug-guix
[-- Attachment #1: Type: text/plain, Size: 869 bytes --]
> Congratulations! I tried the build and it worked without problem.
How can I try it?
I set the LIBRARY_PATH variable:
export LIBRARY_PATH=/nix/store/mifp2p1zjlvb4ndslw1r8grkpglybqjf-glibc-cross-mips64el-linux-gnu-2.17/lib
and tried to compile a test file 'foo.c':
int main() {return 0;}
However, 'ld' failed to find 'crt1.o' and 'crti.o':
# /nix/store/khdyz3i5aih56lxfk6hjvp3884apm7qb-gcc-cross-mips64el-linux-gnu-4.7.2/bin/mips64el-linux-gnu-gcc foo.c
/nix/store/khdyz3i5aih56lxfk6hjvp3884apm7qb-gcc-cross-mips64el-linux-gnu-4.7.2/libexec/gcc/mips64el-linux-gnu/ld: cannot find crt1.o: No such file or directory
/nix/store/khdyz3i5aih56lxfk6hjvp3884apm7qb-gcc-cross-mips64el-linux-gnu-4.7.2/libexec/gcc/mips64el-linux-gnu/ld: cannot find crti.o: No such file or directory
collect2: error: ld returned 1 exit status
Is it necessary to set any other variables?
[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: Initial cross-compilation support
2013-03-04 0:19 ` Nikita Karetnikov
@ 2013-03-04 10:10 ` Ludovic Courtès
2013-03-04 16:56 ` Nikita Karetnikov
0 siblings, 1 reply; 27+ messages in thread
From: Ludovic Courtès @ 2013-03-04 10:10 UTC (permalink / raw)
To: Nikita Karetnikov; +Cc: bug-guix
Nikita Karetnikov <nikita@karetnikov.org> skribis:
>> Congratulations! I tried the build and it worked without problem.
>
> How can I try it?
>
> I set the LIBRARY_PATH variable:
>
> export LIBRARY_PATH=/nix/store/mifp2p1zjlvb4ndslw1r8grkpglybqjf-glibc-cross-mips64el-linux-gnu-2.17/lib
It should be ‘CROSS_LIBRARY_PATH’ instead.
Now, it could be that there are other issues...
Ludo’.
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: Initial cross-compilation support
2013-03-04 10:10 ` Ludovic Courtès
@ 2013-03-04 16:56 ` Nikita Karetnikov
2013-03-09 9:56 ` Nikita Karetnikov
0 siblings, 1 reply; 27+ messages in thread
From: Nikita Karetnikov @ 2013-03-04 16:56 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: bug-guix
[-- Attachment #1: Type: text/plain, Size: 687 bytes --]
> It should be ‘CROSS_LIBRARY_PATH’ instead.
# cat foo.c
int main() {return 0;}
# /nix/store/khdyz3i5aih56lxfk6hjvp3884apm7qb-gcc-cross-mips64el-linux-gnu-4.7.2/bin/mips64el-linux-gnu-gcc foo.c
/nix/store/khdyz3i5aih56lxfk6hjvp3884apm7qb-gcc-cross-mips64el-linux-gnu-4.7.2/libexec/gcc/mips64el-linux-gnu/ld: cannot find crt1.o: No such file or directory
/nix/store/khdyz3i5aih56lxfk6hjvp3884apm7qb-gcc-cross-mips64el-linux-gnu-4.7.2/libexec/gcc/mips64el-linux-gnu/ld: cannot find crti.o: No such file or directory
collect2: error: ld returned 1 exit status
# echo $CROSS_LIBRARY_PATH
/nix/store/mifp2p1zjlvb4ndslw1r8grkpglybqjf-glibc-cross-mips64el-linux-gnu-2.17/lib
[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: Initial cross-compilation support
2013-03-04 16:56 ` Nikita Karetnikov
@ 2013-03-09 9:56 ` Nikita Karetnikov
2013-05-24 21:30 ` Ludovic Courtès
0 siblings, 1 reply; 27+ messages in thread
From: Nikita Karetnikov @ 2013-03-09 9:56 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: bug-guix
[-- Attachment #1: Type: text/plain, Size: 3244 bytes --]
I was able to cross-compile a "hello world" program.
First, I created the following symlinks:
# ln -s /nix/store/mifp2p1zjlvb4ndslw1r8grkpglybqjf-glibc-cross-mips64el-linux-gnu-2.17/lib/crti.o /nix/store/khdyz3i5aih56lxfk6hjvp3884apm7qb-gcc-cross-mips64el-linux-gnu-4.7.2/lib/gcc/mips64el-linux-gnu/4.7.2/crti.o
# ln -s /nix/store/mifp2p1zjlvb4ndslw1r8grkpglybqjf-glibc-cross-mips64el-linux-gnu-2.17/lib/crt1.o /nix/store/khdyz3i5aih56lxfk6hjvp3884apm7qb-gcc-cross-mips64el-linux-gnu-4.7.2/lib/gcc/mips64el-linux-gnu/4.7.2/crt1.o
# ln -s /nix/store/mifp2p1zjlvb4ndslw1r8grkpglybqjf-glibc-cross-mips64el-linux-gnu-2.17/lib/crtn.o /nix/store/khdyz3i5aih56lxfk6hjvp3884apm7qb-gcc-cross-mips64el-linux-gnu-4.7.2/lib/gcc/mips64el-linux-gnu/4.7.2/crtn.o
These are needed because I haven't found a way to set the
CROSS_LIBRARY_PATH variable. (I'll show an example below.)
Then I set this variable:
# export COMPILER_PATH=/nix/store/khdyz3i5aih56lxfk6hjvp3884apm7qb-gcc-cross-mips64el-linux-gnu-4.7.2/libexec/gcc/mips64el-linux-gnu:/nix/store/khdyz3i5aih56lxfk6hjvp3884apm7qb-gcc-cross-mips64el-linux-gnu-4.7.2/libexec/gcc/mips64el-linux-gnu/4.7.2
which is used to locate subprograms [1].
After that I specified this one:
# export C_INCLUDE_PATH=/nix/store/mifp2p1zjlvb4ndslw1r8grkpglybqjf-glibc-cross-mips64el-linux-gnu-2.17/include
And compiled the following program:
#include <stdio.h>
int main ()
{
printf ("Hello World!\n");
}
# /nix/store/khdyz3i5aih56lxfk6hjvp3884apm7qb-gcc-cross-mips64el-linux-gnu-4.7.2/bin/mips64el-linux-gnu-gcc -static -o hello hello.c
Then I ran 'hello' on mips64el and it worked. Is it enough to be sure
that cross-compiler will also work for non-trivial programs?
Here is the example I mentioned:
# export CROSS_LIBRARY_PATH=foo
# /nix/store/khdyz3i5aih56lxfk6hjvp3884apm7qb-gcc-cross-mips64el-linux-gnu-4.7.2/bin/mips64el-linux-gnu-gcc -static -o hello -v hello.c |& grep CROSS_LIBRARY_PATH
CROSS_LIBRARY_PATH=/nix/store/khdyz3i5aih56lxfk6hjvp3884apm7qb-gcc-cross-mips64el-linux-gnu-4.7.2/lib/gcc/mips64el-linux-gnu/4.7.2/:/nix/store/khdyz3i5aih56lxfk6hjvp3884apm7qb-gcc-cross-mips64el-linux-gnu-4.7.2/lib/gcc/mips64el-linux-gnu/4.7.2/../../../../mips64el-linux-gnu/lib
Note that CROSS_LIBRARY_PATH is not set to 'foo'. Could you explain
why? Is it determined automatically (e.g., based on the location of
GCC)?
# ltrace /nix/store/khdyz3i5aih56lxfk6hjvp3884apm7qb-gcc-cross-mips64el-linux-gnu-4.7.2/bin/mips64el-linux-gnu-gcc -static -o hello -v hello.c |& grep CROSS_LIBRARY_PATH
getenv("CROSS_LIBRARY_PATH") = "foo"
strlen("CROSS_LIBRARY_PATH") = 18
memcpy(0x0867b044, "CROSS_LIBRARY_PATH", 18) = 0x0867b044
vfprintf(0xb77b3980, "%s\n", 0xbf9b3d88CROSS_LIBRARY_PATH=/nix/store/khdyz3i5aih56lxfk6hjvp3884apm7qb-gcc-cross-mips64el-linux-gnu-4.7.2/lib/gcc/mips64el-linux-gnu/4.7.2/:/nix/store/khdyz3i5aih56lxfk6hjvp3884apm7qb-gcc-cross-mips64el-linux-gnu-4.7.2/lib/gcc/mips64el-linux-gnu/4.7.2/../../../../mips64el-linux-gnu/lib/
putenv("CROSS_LIBRARY_PATH=/nix/store/kh"...) = 0
How did 'vfprintf' get its third argument?
Comments? Do you know how to do it without the symlinks?
[1] http://gcc.gnu.org/onlinedocs/gcc/Environment-Variables.html
[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: Initial cross-compilation support
2013-03-03 21:32 ` Ludovic Courtès
@ 2013-03-28 9:35 ` Nikita Karetnikov
2013-03-28 13:38 ` Ludovic Courtès
0 siblings, 1 reply; 27+ messages in thread
From: Nikita Karetnikov @ 2013-03-28 9:35 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: bug-guix
[-- Attachment #1: Type: text/plain, Size: 5286 bytes --]
>> I think one needs to add the configure parameters "--with-arch=mips64 --
>> with-abi=64" to the cross build of gcc; and maybe "-march=mip64 -mabi=64"
>> to the binutils and glibc. Ludovic should know best where to do it in the
>> code.
> I would add a keyword parameter to ‘cross-gcc’ to allow extra configure
> flags to be passed, or perhaps just an abstract #:abi flag.
I tried to add
"--with-arch=mips64"
"--with-abi=64"
to '#:configure-flags' of 'cross-gcc'. It failed:
/nix/store/g9js73bwv1fl92h1nnf50vf1619irnxf-gcc-cross-sans-libc-mips64el-linux-gnu-4.7.2/libexec/gcc/mips64el-linux-gnu/ld: /nix/store/g9js73bwv1fl92h1nnf50vf1619irnxf-gcc-cross-sans-libc-mips64el-linux-gnu-4.7.2/lib/gcc/mips64el-linux-gnu/4.7.2/libgcc.a(_fpcmp_parts_tf.o): ABI is incompatible with that of the selected emulation
/nix/store/g9js73bwv1fl92h1nnf50vf1619irnxf-gcc-cross-sans-libc-mips64el-linux-gnu-4.7.2/libexec/gcc/mips64el-linux-gnu/ld: failed to merge target specific data of file /nix/store/g9js73bwv1fl92h1nnf50vf1619irnxf-gcc-cross-sans-libc-mips64el-linux-gnu-4.7.2/lib/gcc/mips64el-linux-gnu/4.7.2/libgcc.a(_fpcmp_parts_tf.o)
[...]
/nix/store/g9js73bwv1fl92h1nnf50vf1619irnxf-gcc-cross-sans-libc-mips64el-linux-gnu-4.7.2/lib/gcc/mips64el-linux-gnu/4.7.2/libgcc.a(_addsub_tf.o): In function `_fpadd_parts':
/tmp/nix-build-gcc-cross-sans-libc-mips64el-linux-gnu-4.7.2.drv-0/build/mips64el-linux-gnu/libgcc/../../../gcc-4.7.2/libgcc/fp-bit.c:617:(.text+0x3a0): relocation truncated to fit: R_MIPS_GOT_DISP against `__thenan_tf'
/nix/store/g9js73bwv1fl92h1nnf50vf1619irnxf-gcc-cross-sans-libc-mips64el-linux-gnu-4.7.2/lib/gcc/mips64el-linux-gnu/4.7.2/libgcc.a(_addsub_tf.o): In function `__addtf3':
/tmp/nix-build-gcc-cross-sans-libc-mips64el-linux-gnu-4.7.2.drv-0/build/mips64el-linux-gnu/libgcc/../../../gcc-4.7.2/libgcc/fp-bit.c:744:(.text+0x3c4): relocation truncated to fit: R_MIPS_CALL16 against `__unpack_t'
/tmp/nix-build-gcc-cross-sans-libc-mips64el-linux-gnu-4.7.2.drv-0/build/mips64el-linux-gnu/libgcc/../../../gcc-4.7.2/libgcc/fp-bit.c:745:(.text+0x3e8): relocation truncated to fit: R_MIPS_CALL16 against `__unpack_t'
/tmp/nix-build-gcc-cross-sans-libc-mips64el-linux-gnu-4.7.2.drv-0/build/mips64el-linux-gnu/libgcc/../../../gcc-4.7.2/libgcc/fp-bit.c:747:(.text+0x3f8): relocation truncated to fit: R_MIPS_GOT_PAGE against `.text'
/tmp/nix-build-gcc-cross-sans-libc-mips64el-linux-gnu-4.7.2.drv-0/build/mips64el-linux-gnu/libgcc/../../../gcc-4.7.2/libgcc/fp-bit.c:747:(.text+0x404): relocation truncated to fit: R_MIPS_GOT_OFST against `.text'
/tmp/nix-build-gcc-cross-sans-libc-mips64el-linux-gnu-4.7.2.drv-0/build/mips64el-linux-gnu/libgcc/../../../gcc-4.7.2/libgcc/fp-bit.c:749:(.text+0x410): relocation truncated to fit: R_MIPS_CALL16 against `__pack_t'
/nix/store/g9js73bwv1fl92h1nnf50vf1619irnxf-gcc-cross-sans-libc-mips64el-linux-gnu-4.7.2/lib/gcc/mips64el-linux-gnu/4.7.2/libgcc.a(_addsub_tf.o): In function `__subtf3':
/tmp/nix-build-gcc-cross-sans-libc-mips64el-linux-gnu-4.7.2.drv-0/build/mips64el-linux-gnu/libgcc/../../../gcc-4.7.2/libgcc/fp-bit.c:764:(.text+0x454): relocation truncated to fit: R_MIPS_CALL16 against `__unpack_t'
/tmp/nix-build-gcc-cross-sans-libc-mips64el-linux-gnu-4.7.2.drv-0/build/mips64el-linux-gnu/libgcc/../../../gcc-4.7.2/libgcc/fp-bit.c:765:(.text+0x478): relocation truncated to fit: R_MIPS_CALL16 against `__unpack_t'
/tmp/nix-build-gcc-cross-sans-libc-mips64el-linux-gnu-4.7.2.drv-0/build/mips64el-linux-gnu/libgcc/../../../gcc-4.7.2/libgcc/fp-bit.c:769:(.text+0x488): relocation truncated to fit: R_MIPS_GOT_PAGE against `.text'
/tmp/nix-build-gcc-cross-sans-libc-mips64el-linux-gnu-4.7.2.drv-0/build/mips64el-linux-gnu/libgcc/../../../gcc-4.7.2/libgcc/fp-bit.c:769:(.text+0x49c): relocation truncated to fit: R_MIPS_GOT_OFST against `.text'
/tmp/nix-build-gcc-cross-sans-libc-mips64el-linux-gnu-4.7.2.drv-0/build/mips64el-linux-gnu/libgcc/../../../gcc-4.7.2/libgcc/fp-bit.c:771:(.text+0x4ac): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
make[2]: *** [/tmp/nix-build-glibc-cross-mips64el-linux-gnu-2.17.drv-0/build/libc.so] Error 1
make[2]: Leaving directory `/tmp/nix-build-glibc-cross-mips64el-linux-gnu-2.17.drv-0/glibc-2.17/elf'
make[1]: *** [elf/subdir_lib] Error 2
make[1]: Leaving directory `/tmp/nix-build-glibc-cross-mips64el-linux-gnu-2.17.drv-0/glibc-2.17'
make: *** [all] Error 2
phase `build' failed after 286 seconds
builder for `/nix/store/jk6f01ribh66daq71b1rzyijm7jqb8w1-glibc-cross-mips64el-linux-gnu-2.17.drv' failed with exit code 1
@ build-failed /nix/store/jk6f01ribh66daq71b1rzyijm7jqb8w1-glibc-cross-mips64el-linux-gnu-2.17.drv /nix/store/74147nkjp39bpiqcpzvmj2gw6a216jzc-glibc-cross-mips64el-linux-gnu-2.17 1 builder for `/nix/store/jk6f01ribh66daq71b1rzyijm7jqb8w1-glibc-cross-mips64el-linux-gnu-2.17.drv' failed with exit code 1
cannot build derivation `/nix/store/68m2mhwasx65793bnnwl4kadckw2rh30-gcc-cross-mips64el-linux-gnu-4.7.2.drv': 1 dependencies couldn't be built
error: build failed: build of `/nix/store/68m2mhwasx65793bnnwl4kadckw2rh30-gcc-cross-mips64el-linux-gnu-4.7.2.drv' failed
I'd also wanted to add "-march=mips64 -mabi=64" to 'cross' but failed to
do it properly.
[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: Initial cross-compilation support
2013-03-28 9:35 ` Nikita Karetnikov
@ 2013-03-28 13:38 ` Ludovic Courtès
2013-03-28 21:00 ` Nikita Karetnikov
0 siblings, 1 reply; 27+ messages in thread
From: Ludovic Courtès @ 2013-03-28 13:38 UTC (permalink / raw)
To: Nikita Karetnikov; +Cc: bug-guix
Nikita Karetnikov <nikita@karetnikov.org> skribis:
> I tried to add
>
> "--with-arch=mips64"
> "--with-abi=64"
>
> to '#:configure-flags' of 'cross-gcc'. It failed:
So it’s glibc that fails to build, but the initial “sans libc”
cross-compiler is correctly built.
> /nix/store/g9js73bwv1fl92h1nnf50vf1619irnxf-gcc-cross-sans-libc-mips64el-linux-gnu-4.7.2/libexec/gcc/mips64el-linux-gnu/ld: /nix/store/g9js73bwv1fl92h1nnf50vf1619irnxf-gcc-cross-sans-libc-mips64el-linux-gnu-4.7.2/lib/gcc/mips64el-linux-gnu/4.7.2/libgcc.a(_fpcmp_parts_tf.o): ABI is incompatible with that of the selected emulation
This may indicate that glibc was built for N32, whereas libgcc &
co. were built for N64.
Can you run ‘file’ on libgcc.a (or one of the .o files it contains)?
Can you check in the glibc log whether a -mabi flag is passed?
You may need to explicitly add -mabi=64 for glibc. It should be
possible to do it with something like:
#:configure-flags '("CFLAGS=-mabi=64 -g -O2")
HTH,
Ludo’.
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: Initial cross-compilation support
2013-03-28 13:38 ` Ludovic Courtès
@ 2013-03-28 21:00 ` Nikita Karetnikov
2013-03-28 22:41 ` Ludovic Courtès
0 siblings, 1 reply; 27+ messages in thread
From: Nikita Karetnikov @ 2013-03-28 21:00 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: bug-guix
[-- Attachment #1: Type: text/plain, Size: 927 bytes --]
> Can you run ‘file’ on libgcc.a (or one of the .o files it contains)?
> Can you check in the glibc log whether a -mabi flag is passed?
Oh, I forgot to add the -K option. There are no logs.
> You may need to explicitly add -mabi=64 for glibc. It should be
> possible to do it with something like:
> #:configure-flags '("CFLAGS=-mabi=64 -g -O2")
Which 'glibc' should be used?
I tried to use
((#:configure-flags flags)
`(cons ,(string-append "CFLAGS=-mabi=64 -g -O2 " "--host=" target)
,flags))
in 'cross-libc' ('cross-base.scm'), but it failed:
checking for suffix of object files... configure: error: in `/tmp/nix-build-glibc-cross-mips64el-linux-gnu-2.17.drv-3/build':
configure: error: cannot compute suffix of object files: cannot compile
I reread the quasiquote-related part of the manual, but I still fail to
understand how to add 'CFLAGS' properly.
[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: Initial cross-compilation support
2013-03-28 21:00 ` Nikita Karetnikov
@ 2013-03-28 22:41 ` Ludovic Courtès
2013-03-29 1:49 ` Nikita Karetnikov
0 siblings, 1 reply; 27+ messages in thread
From: Ludovic Courtès @ 2013-03-28 22:41 UTC (permalink / raw)
To: Nikita Karetnikov; +Cc: bug-guix
Nikita Karetnikov <nikita@karetnikov.org> skribis:
>> Can you run ‘file’ on libgcc.a (or one of the .o files it contains)?
>> Can you check in the glibc log whether a -mabi flag is passed?
>
> Oh, I forgot to add the -K option. There are no logs.
-K has nothing to do with logs. :-)
Logs are always kept, under /nix/var/log/nix/drvs by default (the
directory and file name correspond to the .drv name.)
>> You may need to explicitly add -mabi=64 for glibc. It should be
>> possible to do it with something like:
>
>> #:configure-flags '("CFLAGS=-mabi=64 -g -O2")
>
> Which 'glibc' should be used?
The cross one.
> I tried to use
>
> ((#:configure-flags flags)
> `(cons ,(string-append "CFLAGS=-mabi=64 -g -O2 " "--host=" target)
> ,flags))
>
> in 'cross-libc' ('cross-base.scm'), but it failed:
>
> checking for suffix of object files... configure: error: in `/tmp/nix-build-glibc-cross-mips64el-linux-gnu-2.17.drv-3/build':
> configure: error: cannot compute suffix of object files: cannot compile
Can you check what config.log has to say?
> I reread the quasiquote-related part of the manual, but I still fail to
> understand how to add 'CFLAGS' properly.
You did it right. :-)
Ludo’.
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: Initial cross-compilation support
2013-03-28 22:41 ` Ludovic Courtès
@ 2013-03-29 1:49 ` Nikita Karetnikov
2013-03-29 9:46 ` Ludovic Courtès
0 siblings, 1 reply; 27+ messages in thread
From: Nikita Karetnikov @ 2013-03-29 1:49 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: bug-guix
[-- Attachment #1: Type: text/plain, Size: 1739 bytes --]
>> Oh, I forgot to add the -K option. There are no logs.
> -K has nothing to do with logs. :-)
I meant the build tree.
I can't find 'libgcc.a':
/tmp/nix-build-gcc-cross-sans-libc-mips64el-linux-gnu-4.7.2.drv-0/build/build-i686-pc-linux-gnu/fixincludes# file fixincl.o
fixincl.o: ELF 32-bit LSB relocatable, Intel 80386, version 1 (SYSV), not stripped
> You did it right. :-)
I don't think so.
config.log:
configure:2785: gcc -c -mabi=64 -g -O2 --host=mips64el-linux-gnu conftest.c >&5
gcc: error: unrecognized argument in option '-mabi=64'
gcc: note: valid arguments to '-mabi=' are: ms sysv
gcc: error: unrecognized command line option '--host=mips64el-linux-gnu'
[...]
ac_cv_env_CFLAGS_value='-mabi=64 -g -O2 --host=mips64el-linux-gnu'
Then I tried to use #:make-flags instead:
((#:configure-flags flags)
`(cons ,(string-append "--host=" target)
,flags))
;; MIPS64
((#:make-flags flags)
`(cons "CFLAGS=-mabi=64 -g -O2"
,flags))
((#:phases phases) ...)
And got the same collect2 error as before:
collect2: error: ld returned 1 exit status
make[2]: *** [/tmp/nix-build-glibc-cross-mips64el-linux-gnu-2.17.drv-8/build/libc.so] Error 1
make[2]: Leaving directory `/tmp/nix-build-glibc-cross-mips64el-linux-gnu-2.17.drv-8/glibc-2.17/elf'
make[1]: *** [elf/subdir_lib] Error 2
make[1]: Leaving directory `/tmp/nix-build-glibc-cross-mips64el-linux-gnu-2.17.drv-8/glibc-2.17'
make: *** [all] Error 2
I checked 'config.log' and found out that 'ac_cv_env_CFLAGS_value=' is
empty. Does it mean that #:make-flags are not honored?
I tried to add the above 'CFLAGS' to GCC's #:make-flags, but it also
failed.
I also tried the same with '-march=mips64'.
[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: Initial cross-compilation support
2013-03-29 1:49 ` Nikita Karetnikov
@ 2013-03-29 9:46 ` Ludovic Courtès
2013-03-29 21:20 ` Nikita Karetnikov
0 siblings, 1 reply; 27+ messages in thread
From: Ludovic Courtès @ 2013-03-29 9:46 UTC (permalink / raw)
To: Nikita Karetnikov; +Cc: bug-guix
[-- Attachment #1: Type: text/plain, Size: 1351 bytes --]
Hello!
(Please leave a bit more context when quoting messages, to make it
easier for me to follow. ;-))
Nikita Karetnikov <nikita@karetnikov.org> skribis:
>>> Oh, I forgot to add the -K option. There are no logs.
>
>> -K has nothing to do with logs. :-)
>
> I meant the build tree.
>
> I can't find 'libgcc.a':
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
>> You did it right. :-)
>
> I don't think so.
We were referring to quasiquote/unquote, and yes, you did it right.
> config.log:
>
> configure:2785: gcc -c -mabi=64 -g -O2 --host=mips64el-linux-gnu conftest.c >&5
> gcc: error: unrecognized argument in option '-mabi=64'
> gcc: note: valid arguments to '-mabi=' are: ms sysv
> gcc: error: unrecognized command line option '--host=mips64el-linux-gnu'
Ah, yes, that’s because CFLAGS is also used by the /native/ compiler,
hence this failure.
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.
The simplest way to do that is probably:
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 455 bytes --]
diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm
index 69dc9f5..f4903d3 100644
--- a/gnu/packages/cross-base.scm
+++ b/gnu/packages/cross-base.scm
@@ -231,7 +231,7 @@ XBINUTILS and the cross tool chain."
;;;
(define-public xgcc-mips64el
- (let ((triplet "mips64el-linux-gnu"))
+ (let ((triplet "mips64el-linux-gnuabi64"))
(cross-gcc triplet
(cross-binutils triplet)
(cross-libc triplet))))
[-- Attachment #3: Type: text/plain, Size: 102 bytes --]
(And you can remove previous attempts to specify CFLAGS.)
Can you try that?
TIA!
Ludo’.
^ permalink raw reply related [flat|nested] 27+ messages in thread
* Re: Initial cross-compilation support
2013-03-29 9:46 ` Ludovic Courtès
@ 2013-03-29 21:20 ` Nikita Karetnikov
2013-03-29 21:39 ` Ludovic Courtès
0 siblings, 1 reply; 27+ messages in thread
From: Nikita Karetnikov @ 2013-03-29 21:20 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: bug-guix
[-- 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 --]
^ permalink raw reply related [flat|nested] 27+ messages in thread
* Re: Initial cross-compilation support
2013-03-29 21:20 ` Nikita Karetnikov
@ 2013-03-29 21:39 ` Ludovic Courtès
2013-03-29 22:06 ` Nikita Karetnikov
0 siblings, 1 reply; 27+ messages in thread
From: Ludovic Courtès @ 2013-03-29 21:39 UTC (permalink / raw)
To: Nikita Karetnikov; +Cc: bug-guix
Nikita Karetnikov <nikita@karetnikov.org> skribis:
>> 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
That’s n64, good.
>> 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))))
Looks good.
>> 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?
It’s a ‘configure’ flag; it’s passed automatically when libc is
cross-built.
> 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
Can you run ‘file’ on the above libc_pic.a, or the files it contains?
Could you paste (from the log) the command that built it?
I think the things you mention in config.log are harmless.
(BTW, note that we’re making actual progress! :-))
HTH,
Ludo’.
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: Initial cross-compilation support
2013-03-29 21:39 ` Ludovic Courtès
@ 2013-03-29 22:06 ` Nikita Karetnikov
2013-05-20 19:40 ` Ludovic Courtès
0 siblings, 1 reply; 27+ messages in thread
From: Nikita Karetnikov @ 2013-03-29 22:06 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: bug-guix
[-- Attachment #1: Type: text/plain, Size: 1138 bytes --]
>>> 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?
> It’s a ‘configure’ flag; it’s passed automatically when libc is
> cross-built.
OK. How can I build the bootstrap binaries, then?
> Can you run ‘file’ on the above libc_pic.a, or the files it contains?
# objdump -a /tmp/nix-build-glibc-cross-mips64el-linux-gnuabi64-2.17.drv-1/build/libc_pic.a | grep 'file format' | head
init-first.os: file format elf64-little
libc-start.os: file format elf64-little
sysdep.os: file format elf64-little
version.os: file format elf64-little
check_fds.os: file format elf64-little
dso_handle.os: file format elf64-little
unwind-resume.os: file format elf64-little
errno.os: file format elf64-little
errno-loc.os: file format elf64-little
iconv_open.os: file format elf64-little
> Could you paste (from the log) the command that built it?
I can't find it in the log.
> (BTW, note that we’re making actual progress! :-))
Yep, thanks.
[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: Initial cross-compilation support
2013-03-29 22:06 ` Nikita Karetnikov
@ 2013-05-20 19:40 ` Ludovic Courtès
2013-05-21 18:46 ` Nikita Karetnikov
0 siblings, 1 reply; 27+ messages in thread
From: Ludovic Courtès @ 2013-05-20 19:40 UTC (permalink / raw)
To: Nikita Karetnikov; +Cc: bug-guix
Hi Nikita,
I found this message that I had left unanswered. Did you make any
progress in the meantime? If not, could you share your current patch?
I could try to investigate.
Thanks,
Ludo’.
Nikita Karetnikov <nikita@karetnikov.org> skribis:
>>>> 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?
>
>> It’s a ‘configure’ flag; it’s passed automatically when libc is
>> cross-built.
>
> OK. How can I build the bootstrap binaries, then?
>
>> Can you run ‘file’ on the above libc_pic.a, or the files it contains?
>
> # objdump -a /tmp/nix-build-glibc-cross-mips64el-linux-gnuabi64-2.17.drv-1/build/libc_pic.a | grep 'file format' | head
> init-first.os: file format elf64-little
> libc-start.os: file format elf64-little
> sysdep.os: file format elf64-little
> version.os: file format elf64-little
> check_fds.os: file format elf64-little
> dso_handle.os: file format elf64-little
> unwind-resume.os: file format elf64-little
> errno.os: file format elf64-little
> errno-loc.os: file format elf64-little
> iconv_open.os: file format elf64-little
>
>> Could you paste (from the log) the command that built it?
>
> I can't find it in the log.
>
>> (BTW, note that we’re making actual progress! :-))
>
> Yep, thanks.
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: Initial cross-compilation support
2013-05-20 19:40 ` Ludovic Courtès
@ 2013-05-21 18:46 ` Nikita Karetnikov
2013-05-21 20:04 ` Ludovic Courtès
0 siblings, 1 reply; 27+ messages in thread
From: Nikita Karetnikov @ 2013-05-21 18:46 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: bug-guix
[-- Attachment #1: Type: text/plain, Size: 376 bytes --]
> Did you make any progress in the meantime?
No, I don't have any ideas.
> If not, could you share your current patch?
I don't have any patches. Here is what I use now [1]. I guess it's not
enough because GHC shouldn't fail at that stage.
> I could try to investigate.
That would be great, thanks.
[1] https://lists.gnu.org/archive/html/bug-guix/2013-05/msg00068.html
[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: Initial cross-compilation support
2013-05-21 18:46 ` Nikita Karetnikov
@ 2013-05-21 20:04 ` Ludovic Courtès
2013-05-21 20:23 ` Nikita Karetnikov
0 siblings, 1 reply; 27+ messages in thread
From: Ludovic Courtès @ 2013-05-21 20:04 UTC (permalink / raw)
To: Nikita Karetnikov; +Cc: bug-guix
Nikita Karetnikov <nikita@karetnikov.org> skribis:
>> If not, could you share your current patch?
>
> I don't have any patches. Here is what I use now [1]. I guess it's not
> enough because GHC shouldn't fail at that stage.
[...]
> [1] https://lists.gnu.org/archive/html/bug-guix/2013-05/msg00068.html
I was expecting a patch that uses the right triplet and any other tricks
we discussed so that glibc & co. get built for N64. Do you have
anything like that?
Ludo’.
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: Initial cross-compilation support
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
0 siblings, 2 replies; 27+ messages in thread
From: Nikita Karetnikov @ 2013-05-21 20:23 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: bug-guix
[-- Attachment #1: Type: text/plain, Size: 289 bytes --]
> I was expecting a patch that uses the right triplet and any other tricks
> we discussed so that glibc & co. get built for N64. Do you have
> anything like that?
Well, I'm trying the diff from this message [1] now.
[1] https://lists.gnu.org/archive/html/bug-guix/2013-03/msg00154.html
[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: Initial cross-compilation support
2013-05-21 20:23 ` Nikita Karetnikov
@ 2013-05-21 20:54 ` Nikita Karetnikov
2013-05-21 21:00 ` Ludovic Courtès
1 sibling, 0 replies; 27+ messages in thread
From: Nikita Karetnikov @ 2013-05-21 20:54 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: bug-guix
[-- Attachment #1: Type: text/plain, Size: 3628 bytes --]
>> I was expecting a patch that uses the right triplet and any other tricks
>> we discussed so that glibc & co. get built for N64. Do you have
>> anything like that?
> Well, I'm trying the diff from this message [1] now.
> [1] https://lists.gnu.org/archive/html/bug-guix/2013-03/msg00154.html
Here is the error (the same as before [1]):
# ./pre-inst-env guix build -K gcc-cross-mips64el-linux-gnuabi64
cd /tmp/nix-build-glibc-cross-mips64el-linux-gnuabi64-2.17.drv-0/build && ar cruv libc_pic.a `cat csu/stamp.os iconv/stamp.os locale/stamp.os localedata/stamp.os
[...]
a - elf/dl-iteratephdr.os
a - elf/dl-addr.os
a - elf/dl-profstub.os
a - elf/dl-libc.os
a - elf/dl-sym.os
a - elf/dl-tsd.os
a - elf/unwind-dw2-fde-glibc.os
a - elf/framestate.os
a - elf/unwind-pe.os
mips64el-linux-gnuabi64-gcc -mabi=64 -nostdlib -nostartfiles -r -o /tmp/nix-build-glibc-cross-mips64el-linux-gnuabi64-2.17.drv-0/build/libc_pic.os \
-Wl,-d -Wl,--whole-archive /tmp/nix-build-glibc-cross-mips64el-linux-gnuabi64-2.17.drv-0/build/libc_pic.a -o /tmp/nix-build-glibc-cross-mips64el-linux-gnuabi64-2.17.drv-0/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-0/build/elf/librtld.map.o '-Wl,-(' /tmp/nix-build-glibc-cross-mips64el-linux-gnuabi64-2.17.drv-0/build/elf/dl-allobjs.os /tmp/nix-build-glibc-cross-mips64el-linux-gnuabi64-2.17.drv-0/build/libc_pic.a -lgcc '-Wl,-)' -Wl,-Map,/tmp/nix-build-glibc-cross-mips64el-linux-gnuabi64-2.17.drv-0/build/elf/librtld.mapT
/tmp/nix-build-glibc-cross-mips64el-linux-gnuabi64-2.17.drv-0/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-0/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-0/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-0/glibc-2.17'
make: *** [all] Error 2
phase `build' failed after 242 seconds
note: keeping build directory `/tmp/nix-build-glibc-cross-mips64el-linux-gnuabi64-2.17.drv-0'
builder for `/nix/store/ihz2xz813l8y8a8325312r59ad6k7h60-glibc-cross-mips64el-linux-gnuabi64-2.17.drv' failed with exit code 1
@ build-failed /nix/store/ihz2xz813l8y8a8325312r59ad6k7h60-glibc-cross-mips64el-linux-gnuabi64-2.17.drv - 1 builder for `/nix/store/ihz2xz813l8y8a8325312r59ad6k7h60-glibc-cross-mips64el-linux-gnuabi64-2.17.drv' failed with exit code 1
cannot build derivation `/nix/store/zc7kxmvc8ij4rcga5hvv69mk9z6pbq51-gcc-cross-mips64el-linux-gnuabi64-4.7.3.drv': 1 dependencies couldn't be built
guix build: error: build failed: build of `/nix/store/zc7kxmvc8ij4rcga5hvv69mk9z6pbq51-gcc-cross-mips64el-linux-gnuabi64-4.7.3.drv' failed
# objdump -a /tmp/nix-build-glibc-cross-mips64el-linux-gnuabi64-2.17.drv-0/build/libc_pic.a | grep 'file format' | head
init-first.os: file format elf64-little
libc-start.os: file format elf64-little
sysdep.os: file format elf64-little
version.os: file format elf64-little
check_fds.os: file format elf64-little
dso_handle.os: file format elf64-little
unwind-resume.os: file format elf64-little
errno.os: file format elf64-little
errno-loc.os: file format elf64-little
iconv_open.os: file format elf64-little
[1] https://lists.gnu.org/archive/html/bug-guix/2013-03/msg00155.html
[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: Initial cross-compilation support
2013-05-21 20:23 ` Nikita Karetnikov
2013-05-21 20:54 ` Nikita Karetnikov
@ 2013-05-21 21:00 ` Ludovic Courtès
1 sibling, 0 replies; 27+ messages in thread
From: Ludovic Courtès @ 2013-05-21 21:00 UTC (permalink / raw)
To: Nikita Karetnikov; +Cc: bug-guix
Nikita Karetnikov <nikita@karetnikov.org> skribis:
>> I was expecting a patch that uses the right triplet and any other tricks
>> we discussed so that glibc & co. get built for N64. Do you have
>> anything like that?
>
> Well, I'm trying the diff from this message [1] now.
>
> [1] https://lists.gnu.org/archive/html/bug-guix/2013-03/msg00154.html
Great, that’s what I was looking for. Thanks! :-)
Ludo’.
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: Initial cross-compilation support
2013-03-09 9:56 ` Nikita Karetnikov
@ 2013-05-24 21:30 ` Ludovic Courtès
2013-05-24 21:59 ` Nikita Karetnikov
0 siblings, 1 reply; 27+ messages in thread
From: Ludovic Courtès @ 2013-05-24 21:30 UTC (permalink / raw)
To: Nikita Karetnikov; +Cc: bug-guix
Nikita Karetnikov <nikita@karetnikov.org> skribis:
> I was able to cross-compile a "hello world" program.
>
> First, I created the following symlinks:
>
> # ln -s /nix/store/mifp2p1zjlvb4ndslw1r8grkpglybqjf-glibc-cross-mips64el-linux-gnu-2.17/lib/crti.o /nix/store/khdyz3i5aih56lxfk6hjvp3884apm7qb-gcc-cross-mips64el-linux-gnu-4.7.2/lib/gcc/mips64el-linux-gnu/4.7.2/crti.o
> # ln -s /nix/store/mifp2p1zjlvb4ndslw1r8grkpglybqjf-glibc-cross-mips64el-linux-gnu-2.17/lib/crt1.o /nix/store/khdyz3i5aih56lxfk6hjvp3884apm7qb-gcc-cross-mips64el-linux-gnu-4.7.2/lib/gcc/mips64el-linux-gnu/4.7.2/crt1.o
> # ln -s /nix/store/mifp2p1zjlvb4ndslw1r8grkpglybqjf-glibc-cross-mips64el-linux-gnu-2.17/lib/crtn.o /nix/store/khdyz3i5aih56lxfk6hjvp3884apm7qb-gcc-cross-mips64el-linux-gnu-4.7.2/lib/gcc/mips64el-linux-gnu/4.7.2/crtn.o
>
> These are needed because I haven't found a way to set the
> CROSS_LIBRARY_PATH variable. (I'll show an example below.)
The problem of ‘CROSS_LIBRARY_PATH’ being ignored is fixed by commit 248d08e.
Took me a bit of browsing to find out where that happens in GCC.
Ludo’.
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: Initial cross-compilation support
2013-05-24 21:30 ` Ludovic Courtès
@ 2013-05-24 21:59 ` Nikita Karetnikov
2013-05-24 22:26 ` Ludovic Courtès
0 siblings, 1 reply; 27+ messages in thread
From: Nikita Karetnikov @ 2013-05-24 21:59 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: bug-guix
[-- Attachment #1: Type: text/plain, Size: 265 bytes --]
> The problem of ‘CROSS_LIBRARY_PATH’ being ignored is fixed by commit 248d08e.
> Took me a bit of browsing to find out where that happens in GCC.
That's great, thanks.
Are there any other issues? Have you tried to cross-compile anything
non-trivial?
[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: Initial cross-compilation support
2013-02-27 20:05 Initial cross-compilation support Ludovic Courtès
2013-03-03 16:26 ` Andreas Enge
@ 2013-05-24 22:04 ` Ludovic Courtès
1 sibling, 0 replies; 27+ messages in thread
From: Ludovic Courtès @ 2013-05-24 22:04 UTC (permalink / raw)
To: bug-guix
Hello!
ludo@gnu.org (Ludovic Courtès) skribis:
> Commit 827d289 of the ‘core-updates’ branch adds cross-base.scm, which
> builds a cross tool chain.
>
> So if you type ‘guix build gcc-cross-mips64el-linux-gnu’, you get a
> cross-compiler (+ libc, binutils) for that platform. The compiler is
> slightly modified by this patch:
>
> http://git.savannah.gnu.org/cgit/guix.git/tree/gnu/packages/patches/gcc-cross-environment-variables.patch?h=core-updates&id=827d28914a16ef2d10ebdad4695efdb02ace07fb
>
> The end goal is to be able to run:
>
> guix build --target=mips64el-linux-gnu coreutils
>
> and get a cross-built Coreutils.
Here we are! :-)
So far I’ve only tested with “simple” cases, namely GMP/MPFR/MPC, and it
all cross-builds correctly for mips64el-linux-gnu (N32). I’ve changed
hydra.scm so that Hydra cross-builds a few packages for us. Probably
package definitions and perhaps build systems will need to be adjusted
to allow cross-compilation of more packages, but the foundations are in
place.
Comments and bug reports welcome!
Ludo’.
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: Initial cross-compilation support
2013-05-24 21:59 ` Nikita Karetnikov
@ 2013-05-24 22:26 ` Ludovic Courtès
2013-05-27 21:49 ` Ludovic Courtès
0 siblings, 1 reply; 27+ messages in thread
From: Ludovic Courtès @ 2013-05-24 22:26 UTC (permalink / raw)
To: Nikita Karetnikov; +Cc: bug-guix
Nikita Karetnikov <nikita@karetnikov.org> skribis:
>> The problem of ‘CROSS_LIBRARY_PATH’ being ignored is fixed by commit 248d08e.
>> Took me a bit of browsing to find out where that happens in GCC.
>
> That's great, thanks.
>
> Are there any other issues? Have you tried to cross-compile anything
> non-trivial?
Not yet, but Hydra is working on it. ;-)
Ludo’.
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: Initial cross-compilation support
2013-05-24 22:26 ` Ludovic Courtès
@ 2013-05-27 21:49 ` Ludovic Courtès
0 siblings, 0 replies; 27+ messages in thread
From: Ludovic Courtès @ 2013-05-27 21:49 UTC (permalink / raw)
To: bug-guix
Guix can now cross build Coreutils, Findutils, grep, and similar (some
of them needed to be adjusted), as well as Guile and all its
dependencies.
Speaking of which, commit d581ace changes the ABI of (gnu packages pkg-config).
Because of that, run “make clean && make” if you have a build tree with
.go files around.
There’s still a bit of work to do before we can cross-build the
bootstrap tarballs, but it’s getting closer. Your help welcome!
Ludo’.
^ permalink raw reply [flat|nested] 27+ messages in thread
end of thread, other threads:[~2013-05-27 21:49 UTC | newest]
Thread overview: 27+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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
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.