unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Building clang with gcc-toolchain@11
@ 2022-02-28 16:36 Greg Hogan
  2022-03-07 10:18 ` Ludovic Courtès
  0 siblings, 1 reply; 3+ messages in thread
From: Greg Hogan @ 2022-02-28 16:36 UTC (permalink / raw)
  To: guix-devel

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

When creating a profile containing both clang-toolchain and gcc-toolchain I
see the same issue as in #43023; however, if I specify the default
gcc-toolchain (currently gcc-toolchain@10) then clang and gcc work just
fine together.

--8<---------------cut here---------------start------------->8---
$ guix time-machine --commit=0dc99fd1 -- shell --container gcc-toolchain@10
clang-toolchain coreutils grep
$ env | grep CPLUS_INCLUDE_PATH
CPLUS_INCLUDE_PATH=/gnu/store/4nd3abfcmf1zdqgrvi94ymwwijad9rkq-profile/include/c++:/gnu/store/4nd3abfcmf1zdqgrvi94ymwwijad9rkq-profile/include
$ g++ hello.cpp && ./a.out
Hello World!
$ clang++ hello.cpp && ./a.out
Hello World!
--8<---------------cut here---------------end--------------->8---

This is nice, but necessitates use of an old version of GCC until such time
as core-updates is updated then eventually merged.

I'd like to instead use the latest gcc-toolchain (currently gcc-toolchain@11)
and have clang-toolchain built with that gcc-toolchain. No matter what
I offer in the "--with-c-toolchain" or "--with-input" options I always see
the following error regarding '(assoc-ref %build-inputs "libc")' evaluating
as false, even when specifying "--with-c-toolchain=clang=gcc-toolchain@10"
that should currently be in use by default. Any ideas for fixing this?

Thanks,
Greg


--8<---------------cut here---------------start------------->8---
$ ./pre-inst-env guix build clang --with-c-toolchain=clang=gcc-toolchain@11
The following derivation will be built:
   /gnu/store/7da3w2r437f78q22rqxnqzpcv13fhrfb-clang-13.0.1.drv
building /gnu/store/7da3w2r437f78q22rqxnqzpcv13fhrfb-clang-13.0.1.drv...
Backtrace:
          14 (primitive-load "/gnu/store/8qmqddxxzgfvvslwffm9xwfay7a?")
In ice-9/eval.scm:
   214:21 13 (_ #f)
   217:50 12 (lp (#<procedure 7ffff4bff920 at ice-9/eval.scm:282:?> ?))
   217:50 11 (lp (#<procedure 7ffff4bff900 at ice-9/eval.scm:282:?> ?))
   217:50 10 (lp (#<procedure 7ffff4bff8a0 at ice-9/eval.scm:649:?> ?))
   217:50  9 (lp (#<procedure 7ffff4bff880 at ice-9/eval.scm:282:?> ?))
   217:50  8 (lp (#<procedure 7ffff4bff820 at ice-9/eval.scm:649:?> ?))
   217:50  7 (lp (#<procedure 7ffff4bff800 at ice-9/eval.scm:282:?> ?))
   217:50  6 (lp (#<procedure 7ffff4bff7e0 at ice-9/eval.scm:282:?> ?))
   217:50  5 (lp (#<procedure 7ffff4bff7c0 at ice-9/eval.scm:282:?> ?))
   217:50  4 (lp (#<procedure 7ffff4bff580 at ice-9/eval.scm:649:?> ?))
   217:50  3 (lp (#<procedure 7ffff4bff560 at ice-9/eval.scm:282:?> ?))
   217:33  2 (lp (#<procedure 7ffff4b91660 at ice-9/eval.scm:202:?> ?))
   202:51  1 (_ #f)
In unknown file:
           0 (string-append "-DC_INCLUDE_DIRS=" #f "/include")

ERROR: In procedure string-append:
In procedure string-append: Wrong type (expecting string): #f
builder for `/gnu/store/7da3w2r437f78q22rqxnqzpcv13fhrfb-clang-13.0.1.drv'
failed with exit code 1
build of /gnu/store/7da3w2r437f78q22rqxnqzpcv13fhrfb-clang-13.0.1.drv failed
View build log at
'/var/log/guix/drvs/7d/a3w2r437f78q22rqxnqzpcv13fhrfb-clang-13.0.1.drv.gz'.
guix build: error: build of
`/gnu/store/7da3w2r437f78q22rqxnqzpcv13fhrfb-clang-13.0.1.drv' failed
--8<---------------cut here---------------end--------------->8---

[-- Attachment #2: Type: text/html, Size: 3963 bytes --]

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

* Re: Building clang with gcc-toolchain@11
  2022-02-28 16:36 Building clang with gcc-toolchain@11 Greg Hogan
@ 2022-03-07 10:18 ` Ludovic Courtès
  2022-03-07 21:10   ` Greg Hogan
  0 siblings, 1 reply; 3+ messages in thread
From: Ludovic Courtès @ 2022-03-07 10:18 UTC (permalink / raw)
  To: Greg Hogan; +Cc: guix-devel

Hi,

Greg Hogan <code@greghogan.com> skribis:

> I'd like to instead use the latest gcc-toolchain (currently gcc-toolchain@11)
> and have clang-toolchain built with that gcc-toolchain. No matter what
> I offer in the "--with-c-toolchain" or "--with-input" options I always see
> the following error regarding '(assoc-ref %build-inputs "libc")' evaluating
> as false, even when specifying "--with-c-toolchain=clang=gcc-toolchain@10"
> that should currently be in use by default. Any ideas for fixing this?

The ‘clang’ definition reads:

             ;; Use a sane default include directory.
             (string-append "-DC_INCLUDE_DIRS="
                            (assoc-ref %build-inputs "libc")
                            "/include")

What happens if we don’t pass that option, or if we pass
“-DC_INCLUDE_DIRS=/no-such-directory”?

It might work because C_INCLUDE_PATH already contains libc’s include
directory; that way, we’d no longer rely on the “libc” label, which is
what prevents use of ‘--with-c-toolchain’ here.

HTH,
Ludo’.


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

* Re: Building clang with gcc-toolchain@11
  2022-03-07 10:18 ` Ludovic Courtès
@ 2022-03-07 21:10   ` Greg Hogan
  0 siblings, 0 replies; 3+ messages in thread
From: Greg Hogan @ 2022-03-07 21:10 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

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

On Mon, Mar 7, 2022 at 5:18 AM Ludovic Courtès <ludo@gnu.org> wrote:

> The ‘clang’ definition reads:
>
>              ;; Use a sane default include directory.
>              (string-append "-DC_INCLUDE_DIRS="
>                             (assoc-ref %build-inputs "libc")
>                             "/include")
>
> What happens if we don’t pass that option, or if we pass
> “-DC_INCLUDE_DIRS=/no-such-directory”?
>
> It might work because C_INCLUDE_PATH already contains libc’s include
> directory; that way, we’d no longer rely on the “libc” label, which is
> what prevents use of ‘--with-c-toolchain’ here.
>

"libc" is also referenced in the set-glibc-file-names phase.

Why, even when using a different version of the same toolchain, is "libc"
not available in %build-inputs?

Shouldn't the following "--with-c-toolchain" leave the build unmodified
(with gcc@10 currently the default compiler)? Yet I still see the same
error as when switching the gcc-toolchain version.

--8<---------------cut here---------------start------------->8---
$ ./pre-inst-env guix build clang --with-c-toolchain=clang=gcc-toolchain@10
substitute: updating substitutes from 'https://ci.guix.gnu.org'... 100.0%
The following derivation will be built:
   /gnu/store/h7dw73yclv6i5wi9pf7gw44lnkvzwgp3-clang-13.0.1.drv
building /gnu/store/h7dw73yclv6i5wi9pf7gw44lnkvzwgp3-clang-13.0.1.drv...
Backtrace:
          14 (primitive-load "/gnu/store/5sw2i4ljmsdg7nsscihb7i32mm8?")
In ice-9/eval.scm:
   214:21 13 (_ #f)
   217:50 12 (lp (#<procedure 7ffff57dc260 at ice-9/eval.scm:282:?> ?))
   217:50 11 (lp (#<procedure 7ffff57dc240 at ice-9/eval.scm:282:?> ?))
   217:50 10 (lp (#<procedure 7ffff57dc1e0 at ice-9/eval.scm:649:?> ?))
   217:50  9 (lp (#<procedure 7ffff57dc1c0 at ice-9/eval.scm:282:?> ?))
   217:50  8 (lp (#<procedure 7ffff57dc160 at ice-9/eval.scm:649:?> ?))
   217:50  7 (lp (#<procedure 7ffff57dc140 at ice-9/eval.scm:282:?> ?))
   217:50  6 (lp (#<procedure 7ffff57dc120 at ice-9/eval.scm:282:?> ?))
   217:50  5 (lp (#<procedure 7ffff57dc100 at ice-9/eval.scm:282:?> ?))
   217:50  4 (lp (#<procedure 7ffff57faec0 at ice-9/eval.scm:649:?> ?))
   217:50  3 (lp (#<procedure 7ffff57faea0 at ice-9/eval.scm:282:?> ?))
   217:33  2 (lp (#<procedure 7ffff5b5c480 at ice-9/eval.scm:202:?> ?))
   202:51  1 (_ #f)
In unknown file:
           0 (string-append "-DC_INCLUDE_DIRS=" #f "/include")

ERROR: In procedure string-append:
In procedure string-append: Wrong type (expecting string): #f
builder for `/gnu/store/h7dw73yclv6i5wi9pf7gw44lnkvzwgp3-clang-13.0.1.drv'
failed with exit code 1
build of /gnu/store/h7dw73yclv6i5wi9pf7gw44lnkvzwgp3-clang-13.0.1.drv failed
View build log at
'/var/log/guix/drvs/h7/dw73yclv6i5wi9pf7gw44lnkvzwgp3-clang-13.0.1.drv.bz2'.
guix build: error: build of
`/gnu/store/h7dw73yclv6i5wi9pf7gw44lnkvzwgp3-clang-13.0.1.drv' failed
--8<---------------cut here---------------end--------------->8---

[-- Attachment #2: Type: text/html, Size: 3776 bytes --]

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

end of thread, other threads:[~2022-03-07 21:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-28 16:36 Building clang with gcc-toolchain@11 Greg Hogan
2022-03-07 10:18 ` Ludovic Courtès
2022-03-07 21:10   ` Greg Hogan

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