cling: missing some system header files

  • Open
  • quality assurance status badge
Details
5 participants
  • Liliana Marie Prikler
  • Maxim Cournoyer
  • Maxime Devos
  • Gang Liang
  • zimoun
Owner
unassigned
Submitted by
Gang Liang
Severity
normal
G
G
Gang Liang wrote on 10 Aug 2022 00:32
(address . bug-guix@gnu.org)
CACs1p2QLBLbzXX8+hpEY-9yDi5d4zTNaj6i0HwRHEBr_ZJ8GBA@mail.gmail.com
I had a fresh installation of cling from guix, and got the following
error. Seems some system headers are missing.

Tried it on two machines, and both had the same problem.

****************** CLING ******************
* Type C++ code and press enter to run it *
* Type .q to exit *
*******************************************
[cling]$ #include <iostream>
In file included from input_line_3:1:
In file included from
/gnu/store/069aq2v993kpc41yabp5b6vm4wb9jkhg-gcc-10.3.0/include/c++/iostream:39:
In file included from
/gnu/store/069aq2v993kpc41yabp5b6vm4wb9jkhg-gcc-10.3.0/include/c++/ostream:38:
In file included from
/gnu/store/069aq2v993kpc41yabp5b6vm4wb9jkhg-gcc-10.3.0/include/c++/ios:42:
In file included from
/gnu/store/069aq2v993kpc41yabp5b6vm4wb9jkhg-gcc-10.3.0/include/c++/bits/ios_base.h:41:
In file included from
/gnu/store/069aq2v993kpc41yabp5b6vm4wb9jkhg-gcc-10.3.0/include/c++/bits/locale_classes.h:40:
In file included from
/gnu/store/069aq2v993kpc41yabp5b6vm4wb9jkhg-gcc-10.3.0/include/c++/string:55:
In file included from
/gnu/store/069aq2v993kpc41yabp5b6vm4wb9jkhg-gcc-10.3.0/include/c++/bits/basic_string.h:6545:
In file included from
/gnu/store/069aq2v993kpc41yabp5b6vm4wb9jkhg-gcc-10.3.0/include/c++/ext/string_conversions.h:44:
In file included from
/gnu/store/069aq2v993kpc41yabp5b6vm4wb9jkhg-gcc-10.3.0/include/c++/cerrno:42:
In file included from
/gnu/store/5h2w4qi9hk1qzzgi1w83220ydslinr4s-glibc-2.33/include/errno.h:28:
/gnu/store/5h2w4qi9hk1qzzgi1w83220ydslinr4s-glibc-2.33/include/bits/errno.h:26:11:
fatal error: 'linux/errno.h' file not found
# include <linux/errno.h>
^~~~~~~~~~~~~~~
L
L
Liliana Marie Prikler wrote on 11 Aug 2022 08:17
ee4d0f60c6063a52406a386667b019e6f5462105.camel@ist.tugraz.at
Am Dienstag, dem 09.08.2022 um 15:32 -0700 schrieb Gang Liang:
Toggle quote (2 lines)
> I had a fresh installation of cling from guix, and got the following
> error. Seems some system headers are missing.
You probably need gcc-toolchain installed alongside cling.

HTH
M
M
Maxim Cournoyer wrote on 3 Sep 2022 06:25
Re: bug#57116: cling: missing some system header files
(name . Liliana Marie Prikler)(address . liliana.prikler@ist.tugraz.at)
87bkrx6q59.fsf@gmail.com
Hello,

Liliana Marie Prikler <liliana.prikler@ist.tugraz.at> writes:

Toggle quote (5 lines)
> Am Dienstag, dem 09.08.2022 um 15:32 -0700 schrieb Gang Liang:
>> I had a fresh installation of cling from guix, and got the following
>> error. Seems some system headers are missing.
> You probably need gcc-toolchain installed alongside cling.

Indeed:

$ guix shell --pure cling -- cling '#include <iostream>'
In file included from input_line_3:1:
In file included from /gnu/store/069aq2v993kpc41yabp5b6vm4wb9jkhg-gcc-10.3.0/include/c++/iostream:39:
In file included from /gnu/store/069aq2v993kpc41yabp5b6vm4wb9jkhg-gcc-10.3.0/include/c++/ostream:38:
In file included from /gnu/store/069aq2v993kpc41yabp5b6vm4wb9jkhg-gcc-10.3.0/include/c++/ios:42:
In file included from /gnu/store/069aq2v993kpc41yabp5b6vm4wb9jkhg-gcc-10.3.0/include/c++/bits/ios_base.h:41:
In file included from /gnu/store/069aq2v993kpc41yabp5b6vm4wb9jkhg-gcc-10.3.0/include/c++/bits/locale_classes.h:40:
In file included from /gnu/store/069aq2v993kpc41yabp5b6vm4wb9jkhg-gcc-10.3.0/include/c++/string:55:
In file included from /gnu/store/069aq2v993kpc41yabp5b6vm4wb9jkhg-gcc-10.3.0/include/c++/bits/basic_string.h:6545:
In file included from /gnu/store/069aq2v993kpc41yabp5b6vm4wb9jkhg-gcc-10.3.0/include/c++/ext/string_conversions.h:44:
In file included from /gnu/store/069aq2v993kpc41yabp5b6vm4wb9jkhg-gcc-10.3.0/include/c++/cerrno:42:
In file included from /gnu/store/5h2w4qi9hk1qzzgi1w83220ydslinr4s-glibc-2.33/include/errno.h:28:
/gnu/store/5h2w4qi9hk1qzzgi1w83220ydslinr4s-glibc-2.33/include/bits/errno.h:26:11: fatal error: 'linux/errno.h' file not found
# include <linux/errno.h>
^~~~~~~~~~~~~~~

But:

$ guix shell --pure cling gcc-toolchain -- cling '#include <iostream>'

runs fine.

I tried this:

Toggle snippet (44 lines)
modified gnu/packages/llvm.scm
@@ -79,6 +79,12 @@ (define-module (gnu packages llvm)
#:export (make-lld-wrapper
system->llvm-target))
+;;; Lazily resolve to avoid top-level cycles between modules.
+(define gcc-toolchain*
+ (delay (module-ref (resolve-interface '(gnu packages commencement))
+ 'gcc-toolchain)))
+
+
(define* (system->llvm-target #:optional
(system (or (and=> (%current-target-system)
gnu-triplet->nix-system)
@@ -2215,11 +2221,25 @@ (define-public cling
(add-after 'install 'delete-static-libraries
;; This reduces the size from 17 MiB to 5.4 MiB.
(lambda _
- (for-each delete-file (find-files #$output "\\.a$")))))))
+ (for-each delete-file (find-files #$output "\\.a$"))))
+ (add-after 'install 'wrap-cling
+ ;; Wrap the 'cling' command so that it can locate the GCC
+ ;; toolchain provided headers. Use 'suffix so as to allow users
+ ;; to override which headers are used.
+ (lambda* (#:key outputs #:allow-other-keys)
+ (define gcc-toolchain #$(this-package-input "gcc-toolchain"))
+ (wrap-program (search-input-file outputs "bin/cling")
+ `("C_INCLUDE_PATH" suffix
+ (,(string-append gcc-toolchain "/include")))
+ `("CPLUS_INCLUDE_PATH" suffix
+ (,(string-append gcc-toolchain "/include/c++")
+ ,(string-append gcc-toolchain "/include")))
+ `("LIBRARY_PATH" suffix
+ (,(string-append gcc-toolchain "/lib")))))))))
(native-inputs
(list python python-lit))
(inputs
- (list clang-cling llvm-cling))
+ (list clang-cling (force gcc-toolchain*) llvm-cling))
(home-page "https://root.cern/cling/")
(synopsis "Interactive C++ interpreter")
(description "Cling is an interactive C++17 standard compliant

but it gave:

Toggle snippet (9 lines)
/gnu/store/lpwfmh4v2w2qbpdmmva0si32c9havn95-llvm-cling-9.0.1/lib/libLLVM-9.so(_ZN4llvm3sys15PrintStackTraceERNS_11raw_ostreamE+0x1a)[0x7f76e20ea81a]
/gnu/store/lpwfmh4v2w2qbpdmmva0si32c9havn95-llvm-cling-9.0.1/lib/libLLVM-9.so(_ZN4llvm3sys17RunSignalHandlersEv+0x34)[0x7f76e20e8894]
/gnu/store/lpwfmh4v2w2qbpdmmva0si32c9havn95-llvm-cling-9.0.1/lib/libLLVM-9.so(+0x7129c2)[0x7f76e20e89c2]
/gnu/store/5h2w4qi9hk1qzzgi1w83220ydslinr4s-glibc-2.33/lib/libpthread.so.0(+0x11d80)[0x7f76e6c3fd80]
/gnu/store/094bbaq6glba86h1d4cj16xhdi6fk2jl-gcc-10.3.0-lib/lib/libstdc++.so.6(_ZTVN10__cxxabiv120__si_class_type_infoE+0x10)[0x7f76e19c0c78]
Stack dump:
0. Program arguments: /gnu/store/x48h88ckmkk5vh9g36d2cnmhw23x9ql5-profile/bin/cling #include <iostream>

I'm not sure why.

Should we close it as 'notabug', or persist with the attempt to wrap the
cling binary with the include paths required to ease its setup?

Thanks,

Maxim
Z
Z
zimoun wrote on 3 Sep 2022 11:43
8635d8yes8.fsf@gmail.com
Hi,

On Sat, 03 Sep 2022 at 00:25, Maxim Cournoyer <maxim.cournoyer@gmail.com> wrote:

Toggle quote (3 lines)
> Should we close it as 'notabug', or persist with the attempt to wrap the
> cling binary with the include paths required to ease its setup?

From my understanding about what cling is, we have a similar issue with
some others packages. Bigloo does not work out of the box [1]:

Toggle snippet (4 lines)
$ guix shell -C bigloo libunistring gcc-toolchain libgc pcre \
-- bigloo /tmp/myfile.scm

Idem for ghc (Haskell) which requires gcc-toolchain. And I proposed [2]
to have <X>-toolchain for a ready-to-use X compiling toolsuite where
could be cling, ghc, bigloo, etc.

For instance, Debian has haskell-platform which includes all a regular
user needs for a regular Haskell development setup. And we already
provide gcc-toolchain or clang-toolchain, or even gfortan-toolcahin,
gdc-toolchain, piet-toolchain, etc. Therefore, we could also have
the package cling-toolchain propagating all the required packages that
we currently have to manually specify i.e. gcc-toolchain.

WDYT?




Cheers,
simon
M
M
Maxime Devos wrote on 3 Sep 2022 20:12
67e36ee9-809e-9c99-b2b1-9dee65d00f62@telenet.be
On 03-09-2022 11:43, zimoun wrote:
Toggle quote (30 lines)
> Hi,
>
> On Sat, 03 Sep 2022 at 00:25, Maxim Cournoyer <maxim.cournoyer@gmail.com> wrote:
>
>> Should we close it as 'notabug', or persist with the attempt to wrap the
>> cling binary with the include paths required to ease its setup?
> From my understanding about what cling is, we have a similar issue with
> some others packages. Bigloo does not work out of the box [1]:
>
> --8<---------------cut here---------------start------------->8---
> $ guix shell -C bigloo libunistring gcc-toolchain libgc pcre \
> -- bigloo /tmp/myfile.scm
> --8<---------------cut here---------------end--------------->8---
>
> Idem for ghc (Haskell) which requires gcc-toolchain. And I proposed [2]
> to have <X>-toolchain for a ready-to-use X compiling toolsuite where
> could be cling, ghc, bigloo, etc.
>
> For instance, Debian has haskell-platform which includes all a regular
> user needs for a regular Haskell development setup. And we already
> provide gcc-toolchain or clang-toolchain, or even gfortan-toolcahin,
> gdc-toolchain, piet-toolchain, etc. Therefore, we could also have
> the package cling-toolchain propagating all the required packages that
> we currently have to manually specify i.e. gcc-toolchain.
>
> WDYT?
>
>
> 1: https://yhetil.org/guix/878rp3bs1a.fsf@gmail.com
> 2: https://yhetil.org/guix/CAJ3okZ0i0DjQMzgJ9WwzDC2tKc8WeTZxqW46KH+vq9zKbgBzhQ@mail.gmail.com
I do not see any problems with a X-toolchain (with X=cling,ghc,bigloo,
...) and they appear to be convenient.
I'd say, go for it.
Greetings,
Maxime.
Attachment: OpenPGP_signature
M
M
Maxim Cournoyer wrote on 6 Sep 2022 13:48
(name . Maxime Devos)(address . maximedevos@telenet.be)
87v8q067vv.fsf@gmail.com
Hi,

Maxime Devos <maximedevos@telenet.be> writes:

Toggle quote (37 lines)
> On 03-09-2022 11:43, zimoun wrote:
>> Hi,
>>
>> On Sat, 03 Sep 2022 at 00:25, Maxim Cournoyer <maxim.cournoyer@gmail.com> wrote:
>>
>>> Should we close it as 'notabug', or persist with the attempt to wrap the
>>> cling binary with the include paths required to ease its setup?
>> From my understanding about what cling is, we have a similar issue with
>> some others packages. Bigloo does not work out of the box [1]:
>>
>> --8<---------------cut here---------------start------------->8---
>> $ guix shell -C bigloo libunistring gcc-toolchain libgc pcre \
>> -- bigloo /tmp/myfile.scm
>> --8<---------------cut here---------------end--------------->8---
>>
>> Idem for ghc (Haskell) which requires gcc-toolchain. And I proposed [2]
>> to have <X>-toolchain for a ready-to-use X compiling toolsuite where
>> could be cling, ghc, bigloo, etc.
>>
>> For instance, Debian has haskell-platform which includes all a regular
>> user needs for a regular Haskell development setup. And we already
>> provide gcc-toolchain or clang-toolchain, or even gfortan-toolcahin,
>> gdc-toolchain, piet-toolchain, etc. Therefore, we could also have
>> the package cling-toolchain propagating all the required packages that
>> we currently have to manually specify i.e. gcc-toolchain.
>>
>> WDYT?
>>
>>
>> 1: https://yhetil.org/guix/878rp3bs1a.fsf@gmail.com
>> 2: https://yhetil.org/guix/CAJ3okZ0i0DjQMzgJ9WwzDC2tKc8WeTZxqW46KH+vq9zKbgBzhQ@mail.gmail.com
>
> I do not see any problems with a X-toolchain (with X=cling,ghc,bigloo,
> ...) and they appear to be convenient.
>
> I'd say, go for it.

In the case of cling, I'm not sure if that'd be adapted to the use case
(you don't really use cling as a toolchain, but as a REPL to try things
interactively), but otherwise I don't see any cons to being able to do
that.

Thanks,

Maxim
?