unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* i686-linux GCC package on x86_64
@ 2019-09-22 17:35 Pierre Neidhardt
  2019-10-03 12:38 ` Pierre Neidhardt
  0 siblings, 1 reply; 23+ messages in thread
From: Pierre Neidhardt @ 2019-09-22 17:35 UTC (permalink / raw)
  To: guix-devel

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

Hi!

I'm trying to define an i686-linux package of gcc.
Simply using the

--8<---------------cut here---------------start------------->8---
#:system "i686-linux"
--8<---------------cut here---------------end--------------->8---

results in a bunch of

--8<---------------cut here---------------start------------->8---
configure: error: cannot run C compiled programs.
--8<---------------cut here---------------end--------------->8---

errors.


However,

--8<---------------cut here---------------start------------->8---
guix build --system=i686-linux -e '(@@ (gnu packages gcc) gcc-9)'
--8<---------------cut here---------------end--------------->8---

works perfectly.

(Note that since recently

  guix build --system=i686-linux -e '(@@ (gnu packages gcc) gcc)'

produces a hash error.)

Any clue?

-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: i686-linux GCC package on x86_64
  2019-09-22 17:35 i686-linux GCC package on x86_64 Pierre Neidhardt
@ 2019-10-03 12:38 ` Pierre Neidhardt
  2019-10-04  6:32   ` Mathieu Othacehe
  2019-10-07 15:19   ` Ludovic Courtès
  0 siblings, 2 replies; 23+ messages in thread
From: Pierre Neidhardt @ 2019-10-03 12:38 UTC (permalink / raw)
  To: guix-devel

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

Pierre Neidhardt <mail@ambrevar.xyz> writes:

> Hi!
>
> I'm trying to define an i686-linux package of gcc.
> Simply using the
>
> --8<---------------cut here---------------start------------->8---
> #:system "i686-linux"
> --8<---------------cut here---------------end--------------->8---
>
> results in a bunch of
>
> --8<---------------cut here---------------start------------->8---
> configure: error: cannot run C compiled programs.
> --8<---------------cut here---------------end--------------->8---
>
> errors.
>
>
> However,
>
> --8<---------------cut here---------------start------------->8---
> guix build --system=i686-linux -e '(@@ (gnu packages gcc) gcc-9)'
> --8<---------------cut here---------------end--------------->8---
>
> works perfectly.
>
> (Note that since recently
>
>   guix build --system=i686-linux -e '(@@ (gnu packages gcc) gcc)'
>
> produces a hash error.)
>
> Any clue?

Friendly ping! :)

Mathieu, I think you've got experience with cross-compilation on Guix,
any clue about this?

-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: i686-linux GCC package on x86_64
  2019-10-03 12:38 ` Pierre Neidhardt
@ 2019-10-04  6:32   ` Mathieu Othacehe
  2019-10-04  8:09     ` Pierre Neidhardt
  2019-10-07 15:19   ` Ludovic Courtès
  1 sibling, 1 reply; 23+ messages in thread
From: Mathieu Othacehe @ 2019-10-04  6:32 UTC (permalink / raw)
  To: Pierre Neidhardt; +Cc: guix-devel


Hello Pierre,

>>   guix build --system=i686-linux -e '(@@ (gnu packages gcc) gcc)'
>>
>> produces a hash error.)
>>
>> Any clue?
>
> Friendly ping! :)
>
> Mathieu, I think you've got experience with cross-compilation on Guix,
> any clue about this?

I think the gcc packages defined in (gnu packages gcc) are not meant for
users. Instead running:

--8<---------------cut here---------------start------------->8---
 guix build --system=i686-linux gcc-toolchain
--8<---------------cut here---------------end--------------->8---

works for me.

Mathieu

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: i686-linux GCC package on x86_64
  2019-10-04  6:32   ` Mathieu Othacehe
@ 2019-10-04  8:09     ` Pierre Neidhardt
  2019-10-04 15:16       ` Mathieu Othacehe
  0 siblings, 1 reply; 23+ messages in thread
From: Pierre Neidhardt @ 2019-10-04  8:09 UTC (permalink / raw)
  To: Mathieu Othacehe; +Cc: guix-devel

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

Hello Mathieu!

> --8<---------------cut here---------------start------------->8---
>  guix build --system=i686-linux gcc-toolchain
> --8<---------------cut here---------------end--------------->8---

Works for me to, but I'd like to write a package that depends on GCC i686-linux.

-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: i686-linux GCC package on x86_64
  2019-10-04  8:09     ` Pierre Neidhardt
@ 2019-10-04 15:16       ` Mathieu Othacehe
  2019-10-04 15:46         ` Jelle Licht
  2019-10-10 13:34         ` Pierre Neidhardt
  0 siblings, 2 replies; 23+ messages in thread
From: Mathieu Othacehe @ 2019-10-04 15:16 UTC (permalink / raw)
  To: Pierre Neidhardt; +Cc: guix-devel


> Works for me to, but I'd like to write a package that depends on GCC i686-linux.

You mean a package that uses a compiler able to generate code for
i686-linux? In that case you can have a look to (gnu packages firmware),
where "cross-gcc" packages are used (ovmf-aarch64 package for instance).

You would have to write something like:

--8<---------------cut here---------------start------------->8---
    (native-inputs
     `(,@(if (not (string-prefix? "i686" (%current-system)))
           `(("cross-gcc" ,(cross-gcc "i686-unknown-linux-gnu"))
             ("cross-binutils" ,(cross-binutils "i686-unknown-linux-gnu")))
           '())))
--8<---------------cut here---------------end--------------->8---

that uses the current gcc if you're already building on an i686 system,
or define and use a cross-gcc targeting i686 systems otherwise.

Mathieu

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: i686-linux GCC package on x86_64
  2019-10-04 15:16       ` Mathieu Othacehe
@ 2019-10-04 15:46         ` Jelle Licht
  2019-10-04 16:16           ` Danny Milosavljevic
  2019-10-10 13:34         ` Pierre Neidhardt
  1 sibling, 1 reply; 23+ messages in thread
From: Jelle Licht @ 2019-10-04 15:46 UTC (permalink / raw)
  To: Mathieu Othacehe, Pierre Neidhardt; +Cc: guix-devel

Mathieu Othacehe <m.othacehe@gmail.com> writes:

>
> --8<---------------cut here---------------start------------->8---
>     (native-inputs
>      `(,@(if (not (string-prefix? "i686" (%current-system)))
>            `(("cross-gcc" ,(cross-gcc "i686-unknown-linux-gnu"))
>              ("cross-binutils" ,(cross-binutils "i686-unknown-linux-gnu")))
>            '())))
> --8<---------------cut here---------------end--------------->8---
>
> that uses the current gcc if you're already building on an i686 system,
> or define and use a cross-gcc targeting i686 systems otherwise.

This snippet might make a lot of sense to seasoned schemers/guixfolk,
with the multiple levels of (un)quoting and what not. It does not seem
like what somebody with little experience in either would think of by
themselves.

Would it make sense to have a section/stub in the cookbook about cross
compilation?

- Jelle

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: i686-linux GCC package on x86_64
  2019-10-04 15:46         ` Jelle Licht
@ 2019-10-04 16:16           ` Danny Milosavljevic
  2019-10-05  4:54             ` Chris Marusich
  0 siblings, 1 reply; 23+ messages in thread
From: Danny Milosavljevic @ 2019-10-04 16:16 UTC (permalink / raw)
  To: Jelle Licht; +Cc: guix-devel

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

Hi,

On Fri, 04 Oct 2019 17:46:43 +0200
Jelle Licht <jlicht@fsfe.org> wrote:

> Mathieu Othacehe <m.othacehe@gmail.com> writes:
> 
> >
> > --8<---------------cut here---------------start------------->8---
> >     (native-inputs
> >      `(,@(if (not (string-prefix? "i686" (%current-system)))
> >            `(("cross-gcc" ,(cross-gcc "i686-unknown-linux-gnu"))
> >              ("cross-binutils" ,(cross-binutils "i686-unknown-linux-gnu")))
> >            '())))
> > --8<---------------cut here---------------end--------------->8---
> >
> > that uses the current gcc if you're already building on an i686 system,
> > or define and use a cross-gcc targeting i686 systems otherwise.  
> 
> This snippet might make a lot of sense to seasoned schemers/guixfolk,

Basically just ignore the birdshit characters to understand what it does :)

The first unquote is to evaluate (%current-system) at the toplevel which is
what interprets the package definitions in the first place.

"`(,@" is a no-op.  Not sure why it's written like that.

>            `(("cross-gcc" ,(cross-gcc "i686-unknown-linux-gnu"))
>              ("cross-binutils" ,(cross-binutils "i686-unknown-linux-gnu")))

is like we always write inputs, but it's calling the "cross-gcc" function in the
toplevel in order to get the package to use.

> with the multiple levels of (un)quoting and what not. It does not seem
> like what somebody with little experience in either would think of by
> themselves.
> 
> Would it make sense to have a section/stub in the cookbook about cross
> compilation?

I don't think that cross-gcc is stable API that much--and it's not
common that you need it anyway.  A normal user just cross compiles
by using

   guix build --target=i686-linux pkg

or better yet, uses qemu to natively compile it for a foreign system

   guix build --system=i686-linux pkg

.

The above is only necessary when for some reason your package has
parts which only compile on one system and other parts which only
compile on another system--that's very rare.

Nowadays, packages are supposed to be cross-platform, so using cross-gcc
directly is unnecessary, too.

Right now cross-gcc is not documented, so I guess that counts as
"not a public interface".


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: i686-linux GCC package on x86_64
  2019-10-04 16:16           ` Danny Milosavljevic
@ 2019-10-05  4:54             ` Chris Marusich
  2019-10-07 22:34               ` Ricardo Wurmus
  0 siblings, 1 reply; 23+ messages in thread
From: Chris Marusich @ 2019-10-05  4:54 UTC (permalink / raw)
  To: Danny Milosavljevic; +Cc: guix-devel

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

Danny Milosavljevic <dannym@scratchpost.org> writes:

> On Fri, 04 Oct 2019 17:46:43 +0200
> Jelle Licht <jlicht@fsfe.org> wrote:
>
>> Mathieu Othacehe <m.othacehe@gmail.com> writes:
>> 
>> >
>> > --8<---------------cut here---------------start------------->8---
>> >     (native-inputs
>> >      `(,@(if (not (string-prefix? "i686" (%current-system)))
>> >            `(("cross-gcc" ,(cross-gcc "i686-unknown-linux-gnu"))
>> >              ("cross-binutils" ,(cross-binutils "i686-unknown-linux-gnu")))
>> >            '())))
>> > --8<---------------cut here---------------end--------------->8---
>> >
>> > that uses the current gcc if you're already building on an i686 system,
>> > or define and use a cross-gcc targeting i686 systems otherwise.  
>> 
>> This snippet might make a lot of sense to seasoned schemers/guixfolk,
>
> Basically just ignore the birdshit characters to understand what it does :)
>
> The first unquote is to evaluate (%current-system) at the toplevel which is
> what interprets the package definitions in the first place.
>
> "`(,@" is a no-op.  Not sure why it's written like that.
>
>>            `(("cross-gcc" ,(cross-gcc "i686-unknown-linux-gnu"))
>>              ("cross-binutils" ,(cross-binutils "i686-unknown-linux-gnu")))
>
> is like we always write inputs, but it's calling the "cross-gcc" function in the
> toplevel in order to get the package to use.

Perhaps it's because of the "if" expression.

>> with the multiple levels of (un)quoting and what not. It does not seem
>> like what somebody with little experience in either would think of by
>> themselves.
>> 
>> Would it make sense to have a section/stub in the cookbook about cross
>> compilation?
>
> I don't think that cross-gcc is stable API that much--and it's not
> common that you need it anyway.  A normal user just cross compiles
> by using
>
>    guix build --target=i686-linux pkg
>
> or better yet, uses qemu to natively compile it for a foreign system
>
>    guix build --system=i686-linux pkg
>
> .
>
> The above is only necessary when for some reason your package has
> parts which only compile on one system and other parts which only
> compile on another system--that's very rare.
>
> Nowadays, packages are supposed to be cross-platform, so using cross-gcc
> directly is unnecessary, too.
>
> Right now cross-gcc is not documented, so I guess that counts as
> "not a public interface".

Yeah.  I'm inclined to agree with Danny.  With Guix, it is best to
cross-compile in the way Danny is suggesting.  If there are projects
that require other tricks to cross-compile, perhaps they would be
interesting to discuss.  I feel like there may be a lot of "quick and
dirty" projects with non-standard build logic that can't easily be
packaged into Guix for cross-compilation.

That said, I am curious about something.  If I want to make a
cross-compiler available for the purpose of hacking around on some code
and cross-compiling it, is there an equivalent to "guix package -i
gcc-toolchain" which will give me a cross-compilation toolchain?  My
feeling was that Guix can create cross-compilation toolchains on demand,
but there is no UI exposed for making it available via a guix command,
since people are encouraged to just ask for the cross-built product.

-- 
Chris

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: i686-linux GCC package on x86_64
  2019-10-03 12:38 ` Pierre Neidhardt
  2019-10-04  6:32   ` Mathieu Othacehe
@ 2019-10-07 15:19   ` Ludovic Courtès
  2019-10-10 13:35     ` Pierre Neidhardt
  1 sibling, 1 reply; 23+ messages in thread
From: Ludovic Courtès @ 2019-10-07 15:19 UTC (permalink / raw)
  To: Pierre Neidhardt; +Cc: guix-devel

Hi Pierre,

Pierre Neidhardt <mail@ambrevar.xyz> skribis:

> Pierre Neidhardt <mail@ambrevar.xyz> writes:
>
>> Hi!
>>
>> I'm trying to define an i686-linux package of gcc.
>> Simply using the
>>
>> --8<---------------cut here---------------start------------->8---
>> #:system "i686-linux"
>> --8<---------------cut here---------------end--------------->8---
>>
>> results in a bunch of
>>
>> --8<---------------cut here---------------start------------->8---
>> configure: error: cannot run C compiled programs.
>> --8<---------------cut here---------------end--------------->8---
>>
>> errors.
>>
>>
>> However,
>>
>> --8<---------------cut here---------------start------------->8---
>> guix build --system=i686-linux -e '(@@ (gnu packages gcc) gcc-9)'
>> --8<---------------cut here---------------end--------------->8---
>>
>> works perfectly.
>>
>> (Note that since recently
>>
>>   guix build --system=i686-linux -e '(@@ (gnu packages gcc) gcc)'
>>
>> produces a hash error.)
>>
>> Any clue?
>
> Friendly ping! :)
>
> Mathieu, I think you've got experience with cross-compilation on Guix,
> any clue about this?

Note that this is not cross-compilation, and indeed, if you’re on
x86_64, you don’t need to cross-compile since you can natively run i686
code.

I think you can do something like:

  (define gcc/i686
    (package
      (inherit gcc)
      (arguments `(#:system "i686-linux"
                   ,@(package-arguments gcc)))))

and that should give you the i686-linux GCC package, regardless of what
platform you’re on (use with care!).

Is it what you tried?

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: i686-linux GCC package on x86_64
  2019-10-05  4:54             ` Chris Marusich
@ 2019-10-07 22:34               ` Ricardo Wurmus
  2019-10-08  2:36                 ` Chris Marusich
  0 siblings, 1 reply; 23+ messages in thread
From: Ricardo Wurmus @ 2019-10-07 22:34 UTC (permalink / raw)
  To: Chris Marusich; +Cc: guix-devel


Chris Marusich <cmmarusich@gmail.com> writes:

> That said, I am curious about something.  If I want to make a
> cross-compiler available for the purpose of hacking around on some code
> and cross-compiling it, is there an equivalent to "guix package -i
> gcc-toolchain" which will give me a cross-compilation toolchain?  My
> feeling was that Guix can create cross-compilation toolchains on demand,
> but there is no UI exposed for making it available via a guix command,
> since people are encouraged to just ask for the cross-built product.

Both avr-toolchain and arm-none-eabi-toolchain-6 (among others) are
examples of cross toolchains that can be installed on one type of system
to build binaries for another architecture.

--
Ricardo

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: i686-linux GCC package on x86_64
  2019-10-07 22:34               ` Ricardo Wurmus
@ 2019-10-08  2:36                 ` Chris Marusich
  0 siblings, 0 replies; 23+ messages in thread
From: Chris Marusich @ 2019-10-08  2:36 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel

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

Ricardo Wurmus <rekado@elephly.net> writes:

> Chris Marusich <cmmarusich@gmail.com> writes:
>
>> That said, I am curious about something.  If I want to make a
>> cross-compiler available for the purpose of hacking around on some code
>> and cross-compiling it, is there an equivalent to "guix package -i
>> gcc-toolchain" which will give me a cross-compilation toolchain?  My
>> feeling was that Guix can create cross-compilation toolchains on demand,
>> but there is no UI exposed for making it available via a guix command,
>> since people are encouraged to just ask for the cross-built product.
>
> Both avr-toolchain and arm-none-eabi-toolchain-6 (among others) are
> examples of cross toolchains that can be installed on one type of system
> to build binaries for another architecture.

Thank you for the tip!  I never knew we had such packages!

-- 
Chris

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: i686-linux GCC package on x86_64
  2019-10-04 15:16       ` Mathieu Othacehe
  2019-10-04 15:46         ` Jelle Licht
@ 2019-10-10 13:34         ` Pierre Neidhardt
  2019-10-11  8:12           ` Mathieu Othacehe
  1 sibling, 1 reply; 23+ messages in thread
From: Pierre Neidhardt @ 2019-10-10 13:34 UTC (permalink / raw)
  To: Mathieu Othacehe; +Cc: guix-devel

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

Mathieu Othacehe <m.othacehe@gmail.com> writes:

> --8<---------------cut here---------------start------------->8---
>     (native-inputs
>      `(,@(if (not (string-prefix? "i686" (%current-system)))
>            `(("cross-gcc" ,(cross-gcc "i686-unknown-linux-gnu"))
>              ("cross-binutils" ,(cross-binutils "i686-unknown-linux-gnu")))
>            '())))
> --8<---------------cut here---------------end--------------->8---

Thanks!

This works but cross-gcc only delivers GCC and the libc.
The "lib" output of the regular GCC is missing.

In particular, I'd need libstdc++.so.

-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: i686-linux GCC package on x86_64
  2019-10-07 15:19   ` Ludovic Courtès
@ 2019-10-10 13:35     ` Pierre Neidhardt
  2019-10-10 15:00       ` Ludovic Courtès
  0 siblings, 1 reply; 23+ messages in thread
From: Pierre Neidhardt @ 2019-10-10 13:35 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

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

Hi Ludo,

Yes, this is what I had tried.  Sadly it works for all packages that I know of
except GCC.  Maybe a bug?


-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: i686-linux GCC package on x86_64
  2019-10-10 13:35     ` Pierre Neidhardt
@ 2019-10-10 15:00       ` Ludovic Courtès
  0 siblings, 0 replies; 23+ messages in thread
From: Ludovic Courtès @ 2019-10-10 15:00 UTC (permalink / raw)
  To: Pierre Neidhardt; +Cc: guix-devel

Hi,

Pierre Neidhardt <mail@ambrevar.xyz> skribis:

> Yes, this is what I had tried.  Sadly it works for all packages that I know of
> except GCC.  Maybe a bug?

Oh, there may be confusion as to which GCC you’re targeting.  That is,
the #:system argument is presumably passed to the “leaf” GCC, but not to
the ones that appear in (gnu packages commencement).

This would need closer investigation, for example by printing the value
of (package-arguments p) for ‘p’ in each of the GCCs you’re interested in.

(Of course this is left as an exercise to the reader.  :-))

HTH,
Ludo’.

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: i686-linux GCC package on x86_64
  2019-10-10 13:34         ` Pierre Neidhardt
@ 2019-10-11  8:12           ` Mathieu Othacehe
  2019-10-11  9:30             ` Pierre Neidhardt
  0 siblings, 1 reply; 23+ messages in thread
From: Mathieu Othacehe @ 2019-10-11  8:12 UTC (permalink / raw)
  To: Pierre Neidhardt; +Cc: guix-devel


> This works but cross-gcc only delivers GCC and the libc.
> The "lib" output of the regular GCC is missing.
>
> In particular, I'd need libstdc++.so.

Then, that should be fine:

--8<---------------cut here---------------start------------->8---
    (native-inputs
     `(,@(if (not (string-prefix? "i686" (%current-system)))
           `(("cross-gcc" ,(cross-gcc "i686-unknown-linux-gnu"
                                      #:libc (cross-libc "i686-unknown-linux-gnu")))
             ("cross-binutils" ,(cross-binutils "i686-unknown-linux-gnu")))
           '())))
--8<---------------cut here---------------end--------------->8---

By default the #:libc field of cross-gcc is #f which seems to be the
issue for you.

Mathieu

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: i686-linux GCC package on x86_64
  2019-10-11  8:12           ` Mathieu Othacehe
@ 2019-10-11  9:30             ` Pierre Neidhardt
  2019-10-11 10:07               ` Mathieu Othacehe
  0 siblings, 1 reply; 23+ messages in thread
From: Pierre Neidhardt @ 2019-10-11  9:30 UTC (permalink / raw)
  To: Mathieu Othacehe; +Cc: guix-devel

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

Mathieu Othacehe <m.othacehe@gmail.com> writes:

> --8<---------------cut here---------------start------------->8---
>     (native-inputs
>      `(,@(if (not (string-prefix? "i686" (%current-system)))
>            `(("cross-gcc" ,(cross-gcc "i686-unknown-linux-gnu"
>                                       #:libc (cross-libc "i686-unknown-linux-gnu")))
>              ("cross-binutils" ,(cross-binutils "i686-unknown-linux-gnu")))
>            '())))
> --8<---------------cut here---------------end--------------->8---
>
> By default the #:libc field of cross-gcc is #f which seems to be the
> issue for you.

This worked, fantastic!

Now the only issue is that the libc is placed in a
"/gnu/store/...-gcc-cross-i686-unknown-linux-gnu-5.5.0/i686-unknown-linux-gnu"
subfolder.
I wonder why.  How are dependencies supposed to find the libs in there?

Is it possible to move the libs to the usual "lib" folder at the root?

Cheers!

-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: i686-linux GCC package on x86_64
  2019-10-11  9:30             ` Pierre Neidhardt
@ 2019-10-11 10:07               ` Mathieu Othacehe
  2019-10-14 13:35                 ` Pierre Neidhardt
  0 siblings, 1 reply; 23+ messages in thread
From: Mathieu Othacehe @ 2019-10-11 10:07 UTC (permalink / raw)
  To: Pierre Neidhardt; +Cc: guix-devel


> Now the only issue is that the libc is placed in a
> "/gnu/store/...-gcc-cross-i686-unknown-linux-gnu-5.5.0/i686-unknown-linux-gnu"
> subfolder.
> I wonder why.  How are dependencies supposed to find the libs in there?
>
> Is it possible to move the libs to the usual "lib" folder at the root?

The gcc and glibc includes and libraries and add to CPATH and
LIBRARY_PATH env variables respectively. That's how they are found
during build.

Mathieu

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: i686-linux GCC package on x86_64
  2019-10-11 10:07               ` Mathieu Othacehe
@ 2019-10-14 13:35                 ` Pierre Neidhardt
  2019-10-14 14:21                   ` Jelle Licht
  2019-10-14 14:54                   ` Mathieu Othacehe
  0 siblings, 2 replies; 23+ messages in thread
From: Pierre Neidhardt @ 2019-10-14 13:35 UTC (permalink / raw)
  To: Mathieu Othacehe; +Cc: guix-devel

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

Mathieu Othacehe <m.othacehe@gmail.com> writes:

>> Is it possible to move the libs to the usual "lib" folder at the root?
>
> The gcc and glibc includes and libraries and add to CPATH and
> LIBRARY_PATH env variables respectively. That's how they are found
> during build.

Alright, thanks!

There one last thing that puzzles me: the following package fails to be
found by guix command line:

--8<---------------cut here---------------start------------->8---
(define-public cross-gcc
  (package
    (inherit ((@@ (gnu packages cross-base) cross-gcc)
              "i686-unknown-linux-gnu"
              #:libc (cross-libc "i686-unknown-linux-gnu")))
    (name "cross-gcc")))
--8<---------------cut here---------------end--------------->8---

Then

--8<---------------cut here---------------start------------->8---
$ guix build cross-gcc
...
guix build: error: cross-gcc: unknown package
--8<---------------cut here---------------end--------------->8---

Is this expected?


-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: i686-linux GCC package on x86_64
  2019-10-14 13:35                 ` Pierre Neidhardt
@ 2019-10-14 14:21                   ` Jelle Licht
  2019-10-14 14:23                     ` Jelle Licht
  2019-10-14 14:54                   ` Mathieu Othacehe
  1 sibling, 1 reply; 23+ messages in thread
From: Jelle Licht @ 2019-10-14 14:21 UTC (permalink / raw)
  To: Pierre Neidhardt, Mathieu Othacehe; +Cc: guix-devel

Pierre Neidhardt <mail@ambrevar.xyz> writes:

>[snip]
> --8<---------------cut here---------------start------------->8---
> (define-public cross-gcc
>   (package
>     (inherit ((@@ (gnu packages cross-base) cross-gcc)
>               "i686-unknown-linux-gnu"
>               #:libc (cross-libc "i686-unknown-linux-gnu")))
>     (name "cross-gcc")))
> --8<---------------cut here---------------end--------------->8---
>
> Then
>
> --8<---------------cut here---------------start------------->8---
> $ guix build cross-gcc
> ...
> guix build: error: cross-gcc: unknown package
> --8<---------------cut here---------------end--------------->8---
>
> Is this expected?
Would `guix build cross-gcc-i686-unknown-linux-gnu' work?

I *think* the guix command line interface uses the package's name field
to resolve the right package objects, not the guile variable name.

In `(gnu packages cross-base)' -> `cross-gcc':

--8<---------------cut here---------------start------------->8---
(name (string-append "gcc-cross-"
                         (if libc "" "sans-libc-")
                         target))
--8<---------------cut here---------------end--------------->8---

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: i686-linux GCC package on x86_64
  2019-10-14 14:21                   ` Jelle Licht
@ 2019-10-14 14:23                     ` Jelle Licht
  0 siblings, 0 replies; 23+ messages in thread
From: Jelle Licht @ 2019-10-14 14:23 UTC (permalink / raw)
  To: Pierre Neidhardt, Mathieu Othacehe; +Cc: guix-devel

Jelle Licht <jlicht@fsfe.org> writes:
> Would `guix build cross-gcc-i686-unknown-linux-gnu' work?
>

My mail reader did not expand your snippet fully, I overlooked the fact
that you already overrode the name field. Sorry for the noise!

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: i686-linux GCC package on x86_64
  2019-10-14 13:35                 ` Pierre Neidhardt
  2019-10-14 14:21                   ` Jelle Licht
@ 2019-10-14 14:54                   ` Mathieu Othacehe
  2019-10-14 15:44                     ` Pierre Neidhardt
  2019-10-16 16:38                     ` Alex Kost
  1 sibling, 2 replies; 23+ messages in thread
From: Mathieu Othacehe @ 2019-10-14 14:54 UTC (permalink / raw)
  To: Pierre Neidhardt; +Cc: guix-devel


Hey Pierre,

> --8<---------------cut here---------------start------------->8---
> (define-public cross-gcc
>   (package
>     (inherit ((@@ (gnu packages cross-base) cross-gcc)
>               "i686-unknown-linux-gnu"
>               #:libc (cross-libc "i686-unknown-linux-gnu")))
>     (name "cross-gcc")))
> --8<---------------cut here---------------end--------------->8---

Here if you need @@ for cross-gcc, you'll also need it for cross-libc I
guess.

But the visibility issue you have is because cross-gcc inherits from gcc
who has the property hidden? set to #t.

You can add this to your custom cross-gcc package definition:

--8<---------------cut here---------------start------------->8---
      (properties (alist-delete 'hidden? (package-properties gcc)))
--8<---------------cut here---------------end--------------->8---

Mathieu

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: i686-linux GCC package on x86_64
  2019-10-14 14:54                   ` Mathieu Othacehe
@ 2019-10-14 15:44                     ` Pierre Neidhardt
  2019-10-16 16:38                     ` Alex Kost
  1 sibling, 0 replies; 23+ messages in thread
From: Pierre Neidhardt @ 2019-10-14 15:44 UTC (permalink / raw)
  To: Mathieu Othacehe; +Cc: guix-devel

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

Fantastic, thank you for keeping up with all my annoying questions! ;)

cross-gcc and cross-libc are exported, so no need for @@.

Final answer for posterity:

--8<---------------cut here---------------start------------->8---
(define-public gcc32
  (package
    (inherit (cross-gcc "i686-unknown-linux-gnu"
              #:libc (cross-libc "i686-unknown-linux-gnu")))
    (name "gcc32")
    (properties (alist-delete 'hidden? (package-properties gcc)))))
--8<---------------cut here---------------end--------------->8---

Cheers!

-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: i686-linux GCC package on x86_64
  2019-10-14 14:54                   ` Mathieu Othacehe
  2019-10-14 15:44                     ` Pierre Neidhardt
@ 2019-10-16 16:38                     ` Alex Kost
  1 sibling, 0 replies; 23+ messages in thread
From: Alex Kost @ 2019-10-16 16:38 UTC (permalink / raw)
  To: Mathieu Othacehe; +Cc: guix-devel

Mathieu Othacehe (2019-10-14 16:54 +0200) wrote:

> Hey Pierre,
>
>> --8<---------------cut here---------------start------------->8---
>> (define-public cross-gcc
>>   (package
>>     (inherit ((@@ (gnu packages cross-base) cross-gcc)
>>               "i686-unknown-linux-gnu"
>>               #:libc (cross-libc "i686-unknown-linux-gnu")))
>>     (name "cross-gcc")))
>> --8<---------------cut here---------------end--------------->8---
>
> Here if you need @@ for cross-gcc, you'll also need it for cross-libc I
> guess.
>
> But the visibility issue you have is because cross-gcc inherits from gcc
> who has the property hidden? set to #t.

BTW, there is a "hidden" feature in Emacs-Guix: "M-: (guix-hidden-packages)".

It will not be hidden in the next Emacs-Guix release ;-)

-- 
Alex

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2019-10-16 16:38 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-22 17:35 i686-linux GCC package on x86_64 Pierre Neidhardt
2019-10-03 12:38 ` Pierre Neidhardt
2019-10-04  6:32   ` Mathieu Othacehe
2019-10-04  8:09     ` Pierre Neidhardt
2019-10-04 15:16       ` Mathieu Othacehe
2019-10-04 15:46         ` Jelle Licht
2019-10-04 16:16           ` Danny Milosavljevic
2019-10-05  4:54             ` Chris Marusich
2019-10-07 22:34               ` Ricardo Wurmus
2019-10-08  2:36                 ` Chris Marusich
2019-10-10 13:34         ` Pierre Neidhardt
2019-10-11  8:12           ` Mathieu Othacehe
2019-10-11  9:30             ` Pierre Neidhardt
2019-10-11 10:07               ` Mathieu Othacehe
2019-10-14 13:35                 ` Pierre Neidhardt
2019-10-14 14:21                   ` Jelle Licht
2019-10-14 14:23                     ` Jelle Licht
2019-10-14 14:54                   ` Mathieu Othacehe
2019-10-14 15:44                     ` Pierre Neidhardt
2019-10-16 16:38                     ` Alex Kost
2019-10-07 15:19   ` Ludovic Courtès
2019-10-10 13:35     ` Pierre Neidhardt
2019-10-10 15:00       ` Ludovic Courtès

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).