guix-devel
[Top][All Lists]
Advanced

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

Re: Cross-compiling parts and not cross-compiling other parts of a packa


From: Ludovic Courtès
Subject: Re: Cross-compiling parts and not cross-compiling other parts of a package
Date: Tue, 05 Sep 2017 14:32:00 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux)

Hi!

Danny Milosavljevic <address@hidden> 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 via email to

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