unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: Danny Milosavljevic <dannym@scratchpost.org>
Cc: guix-devel <guix-devel@gnu.org>
Subject: Re: Cross-compiling parts and not cross-compiling other parts of a package
Date: Tue, 05 Sep 2017 14:32:00 +0200	[thread overview]
Message-ID: <877exdtjgf.fsf@gnu.org> (raw)
In-Reply-To: <20170904155731.117569c4@scratchpost.org> (Danny Milosavljevic's message of "Mon, 4 Sep 2017 15:57:31 +0200")

Hi!

Danny Milosavljevic <dannym@scratchpost.org> skribis:

> I've now needed custom modifications in order to enable cross-compilation of a part of a package in two packages, sunxi-tools and rustc.
>
> Both have this part in a custom phase:
>
>              (define (cross? x)
>                (string-contains x "cross-"))
>              (setenv "CROSS_C_INCLUDE_PATH" (getenv "C_INCLUDE_PATH"))
>              (setenv "CROSS_CPLUS_INCLUDE_PATH" (getenv "CPLUS_INCLUDE_PATH"))
>              (setenv "CROSS_LIBRARY_PATH" (getenv "LIBRARY_PATH"))
>              (for-each
>               (lambda (env-name)
>                 (let* ((env-value (getenv env-name))
>                        (search-path (search-path-as-string->list env-value))
>                        (new-search-path (filter (lambda (e) (not (cross? e)))
>                                                 search-path))
>                        (new-env-value (list->search-path-as-string
>                                        new-search-path ":")))
>                   (setenv env-name new-env-value)))
>               '("C_INCLUDE_PATH" "CPLUS_INCLUDE_PATH" "LIBRARY_PATH"))
>
> Would it be possible and advisable to have this as a default phase one day?

Good question.  Probably not as a default, because in general you do
*not* want the CROSS_ search paths to be the same as the native search
paths.

Why it works at all in this case is a mystery to me.  For example, the
cross compiler probably picks up the native headers instead of the
target headers; in many cases they are the same, so that’s OK, but for
libc/Linux, they are different.  Likewise, it might be that ‘ld’ skips
incompatible libraries found in the search path, but that’s luck more
than anything else.

So it seems that this particular use case isn’t well served, but the
above snippet looks risky to me.

WDYT?

Ludo’.

      reply	other threads:[~2017-09-05 12:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-04 13:57 Cross-compiling parts and not cross-compiling other parts of a package Danny Milosavljevic
2017-09-05 12:32 ` Ludovic Courtès [this message]

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=877exdtjgf.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=dannym@scratchpost.org \
    --cc=guix-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this 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).