unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
* bug#57116: cling: missing some system header files
@ 2022-08-09 22:32 Gang Liang
  2022-08-11  6:17 ` Liliana Marie Prikler
  0 siblings, 1 reply; 6+ messages in thread
From: Gang Liang @ 2022-08-09 22:32 UTC (permalink / raw)
  To: 57116

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>
          ^~~~~~~~~~~~~~~




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

* bug#57116: cling: missing some system header files
  2022-08-09 22:32 bug#57116: cling: missing some system header files Gang Liang
@ 2022-08-11  6:17 ` Liliana Marie Prikler
  2022-09-03  4:25   ` Maxim Cournoyer
  0 siblings, 1 reply; 6+ messages in thread
From: Liliana Marie Prikler @ 2022-08-11  6:17 UTC (permalink / raw)
  To: Gang Liang, 57116

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.

HTH




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

* bug#57116: cling: missing some system header files
  2022-08-11  6:17 ` Liliana Marie Prikler
@ 2022-09-03  4:25   ` Maxim Cournoyer
  2022-09-03  9:43     ` zimoun
  0 siblings, 1 reply; 6+ messages in thread
From: Maxim Cournoyer @ 2022-09-03  4:25 UTC (permalink / raw)
  To: Liliana Marie Prikler; +Cc: Gang Liang, 57116

Hello,

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

> 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:

--8<---------------cut here---------------start------------->8---
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
--8<---------------cut here---------------end--------------->8---

but it gave:

--8<---------------cut here---------------start------------->8---
/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>
--8<---------------cut here---------------end--------------->8---

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




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

* bug#57116: cling: missing some system header files
  2022-09-03  4:25   ` Maxim Cournoyer
@ 2022-09-03  9:43     ` zimoun
  2022-09-03 18:12       ` Maxime Devos
  0 siblings, 1 reply; 6+ messages in thread
From: zimoun @ 2022-09-03  9:43 UTC (permalink / raw)
  To: Maxim Cournoyer, Liliana Marie Prikler; +Cc: Gang Liang, 57116

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


Cheers,
simon




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

* bug#57116: cling: missing some system header files
  2022-09-03  9:43     ` zimoun
@ 2022-09-03 18:12       ` Maxime Devos
  2022-09-06 11:48         ` Maxim Cournoyer
  0 siblings, 1 reply; 6+ messages in thread
From: Maxime Devos @ 2022-09-03 18:12 UTC (permalink / raw)
  To: zimoun, Maxim Cournoyer, Liliana Marie Prikler; +Cc: Gang Liang, 57116


[-- Attachment #1.1.1: Type: text/plain, Size: 1611 bytes --]


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.

Greetings,
Maxime.


[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 929 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

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

* bug#57116: cling: missing some system header files
  2022-09-03 18:12       ` Maxime Devos
@ 2022-09-06 11:48         ` Maxim Cournoyer
  0 siblings, 0 replies; 6+ messages in thread
From: Maxim Cournoyer @ 2022-09-06 11:48 UTC (permalink / raw)
  To: Maxime Devos; +Cc: Liliana Marie Prikler, Gang Liang, 57116, zimoun

Hi,

Maxime Devos <maximedevos@telenet.be> writes:

> 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




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

end of thread, other threads:[~2022-09-06 12:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-09 22:32 bug#57116: cling: missing some system header files Gang Liang
2022-08-11  6:17 ` Liliana Marie Prikler
2022-09-03  4:25   ` Maxim Cournoyer
2022-09-03  9:43     ` zimoun
2022-09-03 18:12       ` Maxime Devos
2022-09-06 11:48         ` Maxim Cournoyer

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