unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / Atom feed
From: Ekaitz Zarraga <ekaitz@elenq.tech>
To: "guix-devel\\@gnu.org" <guix-devel@gnu.org>
Subject: GCC:  Canadian Cross + Dynamic linker issues
Date: Thu, 18 Mar 2021 11:45:56 +0000	[thread overview]
Message-ID: <_AbV1fmXZO2t0n9rEa7I0GVYI1tA0xCD5LM38VFA4-MeleekWvU1iPVJ_vgegmIBQ4LpwRFKzMKS2SY5_oXp6GbpnbaowL_MX5lwZNk61FI=@elenq.tech> (raw)

Hi,

I've been struggling with GCC package definition for a while and I hope someone
can help me solve or improve what I think are issues in its definition.

I'm working on a R7RS-Small Scheme implementation that compiles to RISC-V
assembly and I'm finding many issues to create a RISC-V cross compiler.

Consider the following manifest file for my project, where I need a GCC for
a 32 bit RISC-V machine:


``` scheme
(use-modules (gnu packages cross-base)
             (gnu packages gcc)
             (gnu packages embedded))

(packages->manifest
  (let* ((triplet "riscv32-unknown-elf")
         (binutils (cross-binutils triplet)))
        (list
          binutils
          (cross-gcc triplet
                     #:xbinutils binutils
                     #:libc #f))))
```

The call to cross-gcc fails to find a dynamic linker and the installation
fails.

This happens because GCC package definition calls to the function
`glibc-dynamic-linker` in `gnu/packages/bootstrap.scm`, that contains a list of
possible triplets with their associated dynamic linker file name.

I don't really understand why does a generic GCC package need to call a
function from the bootstrap module by default. I can see why GCC takes a huge
part on the bootstrapping process of Guix but I think that kind of coupling is
compromising the flexibility of the generic GCC package. Please, correct me if
I'm wrong.

That said, in the past, I sent a patch[^patch] as a workaround because I saw
some references to AVR on the `glibc-dynamic-linker` that also used a fake
dynamic linker to avoid the function to fail but I got no response so I'm not
sure if the change makes any sense.

Digging further on the GCC package definition I found a note that says:

> ;; None of the flags below are needed when doing a Canadian cross.
> ;; TODO: Simplify this.

So I wonder if that's the source of the problems I'm finding here.

The `glibc-dynamic-linker` function is being used twice in the block preceded
by that comment and only once more below, in some patches we are applying on
top of the source code.

At this level I'm not sure if there's any way to "fix" GCC package definition
to be able to create cross-compilers or if I should create a separate package
for my specific use-case and forget about all this.

I would love to take part and try to simplify the GCC package description, but
as it is a fundamental package looks like a huge responsibility so I'd like to
have some guidance first.

Thanks,

Ekaitz

[^patch]: https://issues.guix.gnu.org/46059



             reply	other threads:[~2021-03-18 14:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-18 11:45 Ekaitz Zarraga [this message]
2021-04-07 10:48 ` Ekaitz Zarraga

Reply instructions:

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

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

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

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

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

  git send-email \
    --in-reply-to='_AbV1fmXZO2t0n9rEa7I0GVYI1tA0xCD5LM38VFA4-MeleekWvU1iPVJ_vgegmIBQ4LpwRFKzMKS2SY5_oXp6GbpnbaowL_MX5lwZNk61FI=@elenq.tech' \
    --to=ekaitz@elenq.tech \
    --cc=guix-devel@gnu.org \
    --subject='Re: GCC:  Canadian Cross + Dynamic linker issues' \
    /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

unofficial mirror of guix-devel@gnu.org 

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://yhetil.org/guix-devel/0 guix-devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 guix-devel guix-devel/ https://yhetil.org/guix-devel \
		guix-devel@gnu.org
	public-inbox-index guix-devel

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.yhetil.org/yhetil.gnu.guix.devel
	nntp://news.gmane.io/gmane.comp.gnu.guix.devel


AGPL code for this site: git clone http://ou63pmih66umazou.onion/public-inbox.git