Fix for libgccjit

OpenSubmitted by Formbi.
Details
4 participants
  • Formbi
  • Ludovic Courtès
  • Mathieu Othacehe
  • Maxim Cournoyer
Owner
unassigned
Severity
normal
F
F
Formbi wrote on 21 Mar 2020 14:13
(name . guix-patches@gnu.org)(address . guix-patches@gnu.org)
A0eOzVzqqzOM7JTk9Sak8YwMXwnh3tzC3lhGpAbnHcMdHPjKblcF3AA_28bvTWp1tZiRUI5eUHPY68mzGjQcPfjlzHpea18N5VQpoVzRSxQ=@protonmail.com
Empty Message
From 51511978f7e41392d9ed4d49f08c7ce154ff18d2 Mon Sep 17 00:00:00 2001
From: Formbi <formbi@protonmail.com>
Date: Sat, 21 Mar 2020 14:10:01 +0100
Subject: [PATCH] fix libgccjit

---
gnu/packages/gcc.scm | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)

Toggle diff (25 lines)
diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm
index 08afd80358..2c9a8ba9df 100644
--- a/gnu/packages/gcc.scm
+++ b/gnu/packages/gcc.scm
@@ -716,7 +716,17 @@ as the 'native-search-paths' field."
                (for-each delete-file
                          (find-files (string-append (assoc-ref outputs "out") "/bin")
                                      ".*(c\\+\\+|cpp|g\\+\\+|gcov|gcc|gcc-.*)"))
-               #t))))))))
+               #t))))))
+    (native-search-paths
+     (list (search-path-specification
+            (variable "C_INCLUDE_PATH")
+            (files '("include")))
+           (search-path-specification
+            (variable "CPLUS_INCLUDE_PATH")
+            (files '("include")))
+           (search-path-specification
+            (variable "LIBRARY_PATH")
+            (files '("lib" "lib64" "lib/gcc")))))))
 
 
 (define-public gccgo-4.9
-- 
2.25.0
F
F
Formbi wrote on 21 Mar 2020 14:18
information
(name . 40164@debbugs.gnu.org)(address . 40164@debbugs.gnu.org)
FJgz6ATrQ8GLuNSo4-eq_RFHjzWSR56bJOwbwJIUwUt3mF3TAimyXrob-lquylVxX-sol4wqqyg_7PR206bmMTy4PFyFuZbLC0Sxz_5Eeks=@protonmail.com
I forgot to say what it does - it adds «lib/gcc» to the CPATH so that we don't get errors like «ld: cannot find crtbeginS.o: No such file or directory».
F
F
Formbi wrote on 21 Mar 2020 14:21
a small correction
(name . 40164@debbugs.gnu.org)(address . 40164@debbugs.gnu.org)
uPuTXGgabzfX7f5HtrK8cBX_eMfR5v8MsIyQLWj90h0av8slOSi3mr5F8oU6w0bFBObGEpVoIEr9Ud4UPS1eejYgthXvvobVp4l5YE7sjOg=@protonmail.com
it fixes LIBRARY_PATH, not CPATH
M
M
Mathieu Othacehe wrote on 21 Mar 2020 15:48
Re: [bug#40164] Fix for libgccjit
(name . Formbi)(address . formbi@protonmail.com)(address . 40164@debbugs.gnu.org)
871rplkblo.fsf@gmail.com
Hello Formbi,

Toggle quote (2 lines)
> Empty Message

Could you explain what you are trying to fix with this patch?

Thanks,

Mathieu
L
L
Ludovic Courtès wrote on 21 Mar 2020 23:32
(name . Formbi)(address . formbi@protonmail.com)(address . 40164@debbugs.gnu.org)
87k13dwd96.fsf@gnu.org
Hello,

Formbi <formbi@protonmail.com> skribis:

Toggle quote (30 lines)
> From 51511978f7e41392d9ed4d49f08c7ce154ff18d2 Mon Sep 17 00:00:00 2001
> From: Formbi <formbi@protonmail.com>
> Date: Sat, 21 Mar 2020 14:10:01 +0100
> Subject: [PATCH] fix libgccjit
>
> ---
> gnu/packages/gcc.scm | 12 +++++++++++-
> 1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm
> index 08afd80358..2c9a8ba9df 100644
> --- a/gnu/packages/gcc.scm
> +++ b/gnu/packages/gcc.scm
> @@ -716,7 +716,17 @@ as the 'native-search-paths' field."
> (for-each delete-file
> (find-files (string-append (assoc-ref outputs "out") "/bin")
> ".*(c\\+\\+|cpp|g\\+\\+|gcov|gcc|gcc-.*)"))
> - #t))))))))
> + #t))))))
> + (native-search-paths
> + (list (search-path-specification
> + (variable "C_INCLUDE_PATH")
> + (files '("include")))
> + (search-path-specification
> + (variable "CPLUS_INCLUDE_PATH")
> + (files '("include")))
> + (search-path-specification
> + (variable "LIBRARY_PATH")
> + (files '("lib" "lib64" "lib/gcc")))))))

I think this has no effect because this ‘native-search-paths’ is already
inherited from ‘gcc-9’, which ‘libgccjit’ inherits from.

Can you confirm?

Mathieu Othacehe <m.othacehe@gmail.com> skribis:

Toggle quote (2 lines)
> Could you explain what you are trying to fix with this patch?

From a discussion on IRC, this has to do with the fact that libgccjit
needs all these search paths defined at run time.

Thanks,
Ludo’.
F
F
Formbi wrote on 22 Mar 2020 00:12
(name . 40164@debbugs.gnu.org)(address . 40164@debbugs.gnu.org)
BmwPUJ1eKwWqjtaWEiV77fZcTmeLuEUfqOCvmRIpWFiJJsjiqitBR7wqSIS7uw4DVsFjAWqPku1R6bsKsEdakqlBe7nDIPU6H2YY8ffq1B8=@protonmail.com
Toggle quote (3 lines)
> I think this has no effect because this ‘native-search-paths’ is already
> inherited from ‘gcc-9’, which ‘libgccjit’ inherits from.

Nope, it does have an effect. I added "lib/gcc" to the original paths (and that was the needed thing).

(sending again because I forgot about the debbugs e-mail)
F
F
Formbi wrote on 21 Mar 2020 23:56
(name . Ludovic Courtès)(address . ludo@gnu.org)
zQode-EomoU8GYz0NVEC1E-dBhMwLCRtt-LHk1FaBdeeAzlTsYdHrqvKiajgG5_9W4ht97afq-I5F4uac5cH7_zzY-pvcyJwe-q6jwCEPaE=@protonmail.com
Toggle quote (3 lines)
> I think this has no effect because this ‘native-search-paths’ is already
> inherited from ‘gcc-9’, which ‘libgccjit’ inherits from.

Nope, it does have an effect. I added "lib/gcc" to the original paths (and that was the needed thing).
L
L
Ludovic Courtès wrote on 22 Mar 2020 21:54
(name . Formbi)(address . formbi@protonmail.com)(address . 40164@debbugs.gnu.org)
87lfnst8k1.fsf@gnu.org
Hi,

(+Cc bug.)

Formbi <formbi@protonmail.com> skribis:

Toggle quote (5 lines)
>> I think this has no effect because this ‘native-search-paths’ is already
>> inherited from ‘gcc-9’, which ‘libgccjit’ inherits from.
>
> Nope, it does have an effect. I added "lib/gcc" to the original paths (and that was the needed thing).

In that case, could you (1) arrange to write the search path in a way
that reuses (package-native-search-paths gcc-9), and (2) add a comment
explaining why “lib/gcc” is needed (it looks unusual)?

Thanks in advance,
Ludo’.
L
L
Ludovic Courtès wrote on 25 May 2020 22:14
control message for bug #40164
(address . control@debbugs.gnu.org)
877dwzvkjw.fsf@gnu.org
tags 40164 + moreinfo
quit
M
M
Maxim Cournoyer wrote on 14 Jul 2021 14:40
Re: bug#40164: Fix for libgccjit
(name . Formbi)(address . formbi@protonmail.com)
87lf69oype.fsf_-_@gmail.com
Hi,

Ludovic Courtès <ludo@gnu.org> writes:

Toggle quote (18 lines)
> Hi,
>
> (+Cc bug.)
>
> Formbi <formbi@protonmail.com> skribis:
>
>>> I think this has no effect because this ‘native-search-paths’ is already
>>> inherited from ‘gcc-9’, which ‘libgccjit’ inherits from.
>>
>> Nope, it does have an effect. I added "lib/gcc" to the original paths (and that was the needed thing).
>
> In that case, could you (1) arrange to write the search path in a way
> that reuses (package-native-search-paths gcc-9), and (2) add a comment
> explaining why “lib/gcc” is needed (it looks unusual)?
>
> Thanks in advance,
> Ludo’.

Perhaps the original issue is the one reported/fix with a patch here [0]
? Formbi, could you share a simple reproducer so that we can test if
the patches resolve it? It seems it'd be useful to upstream as well (to
have a reproducer).

Thanks!

M
M
Maxim Cournoyer wrote on 14 Jul 2021 18:50
(name . Formbi)(address . formbi@protonmail.com)
87v95con5b.fsf_-_@gmail.com
Hello again,

Maxim Cournoyer <maxim.cournoyer@gmail.com> writes:

Toggle quote (9 lines)
> Perhaps the original issue is the one reported/fix with a patch here [0]
> ? Formbi, could you share a simple reproducer so that we can test if
> the patches resolve it? It seems it'd be useful to upstream as well (to
> have a reproducer).
>
> Thanks!
>
> [0] https://gcc.gnu.org/legacy-ml/gcc-patches/2019-03/msg01045.html

Another data point: this seems to be worked around in Nix using the fix
proposed by Formbi:

Maxim
?