unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
To: Liliana Marie Prikler <liliana.prikler@ist.tugraz.at>
Cc: Gang Liang <randomizedthinking@gmail.com>, 57116@debbugs.gnu.org
Subject: bug#57116: cling: missing some system header files
Date: Sat, 03 Sep 2022 00:25:06 -0400	[thread overview]
Message-ID: <87bkrx6q59.fsf@gmail.com> (raw)
In-Reply-To: <ee4d0f60c6063a52406a386667b019e6f5462105.camel@ist.tugraz.at> (Liliana Marie Prikler's message of "Thu, 11 Aug 2022 08:17:08 +0200")

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




  reply	other threads:[~2022-09-03  4:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2022-09-03  9:43     ` zimoun
2022-09-03 18:12       ` Maxime Devos
2022-09-06 11:48         ` Maxim Cournoyer

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=87bkrx6q59.fsf@gmail.com \
    --to=maxim.cournoyer@gmail.com \
    --cc=57116@debbugs.gnu.org \
    --cc=liliana.prikler@ist.tugraz.at \
    --cc=randomizedthinking@gmail.com \
    /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).