[PATCH] jit: Install jit headers in $(libsubincludedir) [PR 101491]

Lorenzo Salvadore developer@lorenzosalvadore.it
Wed Nov 16 16:03:17 GMT 2022


Hello,

I would like to submit the patch below addressing bug jit/101491.
Please note that another patch has also been submitted in the bug
report by another FreeBSD user. We worked indipendently. The two
patches look functionally equivalent but use different styles. In
particular, I followed Richard Biener's suggestion from
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101491#c5 .

Thanks,

Lorenzo Salvadore

---

>From f8e2c2ee89a7d8741bb65163d1f1c20edcd546ac Mon Sep 17 00:00:00 2001
From: Lorenzo Salvadore <developer@lorenzosalvadore.it>
Date: Wed, 16 Nov 2022 11:27:38 +0100
Subject: [PATCH] jit: Install jit headers in $(libsubincludedir) [PR 101491]

Installing jit/libgccjit.h and jit/libgccjit++.h headers in
$(includedir) can be a problem for machines where multiple versions of
GCC are required simultaneously, see for example this bug report on
FreeBSD:

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=257060

Hence,

- define $(libsubincludedir) the same way it is defined in libgomp;
- install jit/libgccjit.h and jit/libgccjit++.h in $(libsubincludedir).

The patch has already been applied successfully in the official FreeBSD
ports tree for the ports lang/gcc11 and lang/gcc12. Please see the
following commits:

https://cgit.freebsd.org/ports/commit/?id=0338e04504ee269b7a95e6707f1314bc1c4239fe
https://cgit.freebsd.org/ports/commit/?id=f1957296ed2dce8a09bb9582e9a5a715bf8b3d4d

gcc/ChangeLog:

2022-11-16  Lorenzo Salvadore  <developer@lorenzosalvadore.it>

	PR jit/101491
        * Makefile.in: Define and create $(libsubincludedir)

gcc/jit/ChangeLog:

2022-11-16  Lorenzo Salvadore  <developer@lorenzosalvadore.it>

	PR jit/101491
        * Make-lang.in: Install headers in $(libsubincludedir)
---
 gcc/Makefile.in      | 3 +++
 gcc/jit/Make-lang.in | 4 ++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index f672e6ea549..3bcf1c491ab 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -635,6 +635,8 @@ libexecdir = @libexecdir@

 # Directory in which the compiler finds libraries etc.
 libsubdir = $(libdir)/gcc/$(real_target_noncanonical)/$(version)$(accel_dir_suffix)
+# Directory in which the compiler finds headers.
+libsubincludedir = $(libdir)/gcc/$(target_alias)/$(version)/include
 # Directory in which the compiler finds executables
 libexecsubdir = $(libexecdir)/gcc/$(real_target_noncanonical)/$(version)$(accel_dir_suffix)
 # Directory in which all plugin resources are installed
@@ -3642,6 +3644,7 @@ install-cpp: installdirs cpp$(exeext)
 # $(libdir)/gcc/include isn't currently searched by cpp.
 installdirs:
 	$(mkinstalldirs) $(DESTDIR)$(libsubdir)
+	$(mkinstalldirs) $(DESTDIR)$(libsubincludedir)
 	$(mkinstalldirs) $(DESTDIR)$(libexecsubdir)
 	$(mkinstalldirs) $(DESTDIR)$(bindir)
 	$(mkinstalldirs) $(DESTDIR)$(includedir)
diff --git a/gcc/jit/Make-lang.in b/gcc/jit/Make-lang.in
index 248ec45b729..ba1b3e95da5 100644
--- a/gcc/jit/Make-lang.in
+++ b/gcc/jit/Make-lang.in
@@ -360,9 +360,9 @@ selftest-jit:
 # Install hooks:
 jit.install-headers: installdirs
 	$(INSTALL_DATA) $(srcdir)/jit/libgccjit.h \
-	  $(DESTDIR)$(includedir)/libgccjit.h
+	  $(DESTDIR)$(libsubincludedir)/libgccjit.h
 	$(INSTALL_DATA) $(srcdir)/jit/libgccjit++.h \
-	  $(DESTDIR)$(includedir)/libgccjit++.h
+	  $(DESTDIR)$(libsubincludedir)/libgccjit++.h

 ifneq (,$(findstring mingw,$(target)))
 jit.install-common: installdirs jit.install-headers
--
2.38.0




More information about the Gcc-patches mailing list