bug-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Initial cross-compilation support


From: Ludovic Courtès
Subject: Re: Initial cross-compilation support
Date: Fri, 29 Mar 2013 22:39:29 +0100
User-agent: Gnus/5.130005 (Ma Gnus v0.5) Emacs/24.3 (gnu/linux)

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]