all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#28226] Build go with gccgo
@ 2017-08-24 20:51 Efraim Flashner
  2017-09-12  9:59 ` Catonano
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Efraim Flashner @ 2017-08-24 20:51 UTC (permalink / raw)
  To: 28226


[-- Attachment #1.1: Type: text/plain, Size: 493 bytes --]

I need some help testing this on x86_64, I did all the building and
testing on aarch64. It turns out there's a known issues in the cgo
implementation that causes the test suite to fail on aarch64. With this
patch set I was able to build gccgo@7 -> go@1.7 -> lfam's syncthing.

-- 
Efraim Flashner   <efraim@flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted

[-- Attachment #1.2: 0001-gnu-custom-gcc-Add-flag-to-optionally-not-remove-con.patch --]
[-- Type: text/plain, Size: 1926 bytes --]

From 83bfb82f4da6fb23d3b64c7e23f9db001c85b283 Mon Sep 17 00:00:00 2001
From: Efraim Flashner <efraim@flashner.co.il>
Date: Mon, 7 Aug 2017 22:56:57 +0300
Subject: [PATCH 1/3] gnu: custom-gcc: Add flag to optionally not remove
 conflicting files.

* gnu/packages/gcc.scm (custom-gcc): Add flag to optionally keep the
files that would conflict with gcc.
---
 gnu/packages/gcc.scm | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm
index bb8570bec..a22bb3c25 100644
--- a/gnu/packages/gcc.scm
+++ b/gnu/packages/gcc.scm
@@ -485,7 +485,8 @@ using compilers other than GCC."
 (define* (custom-gcc gcc name languages
                      #:optional
                      (search-paths (package-native-search-paths gcc))
-                     #:key (separate-lib-output? #t))
+                     #:key (separate-lib-output? #t)
+                     (remove-conflicting-files? #t))
   "Return a custom version of GCC that supports LANGUAGES.  Use SEARCH-PATHS
 as the 'native-search-paths' field."
   (package (inherit gcc)
@@ -508,12 +509,14 @@ as the 'native-search-paths' field."
                        ,flags)))
        ((#:phases phases)
         `(modify-phases ,phases
-           (add-after 'install 'remove-broken-or-conflicting-files
+          ,@(if remove-conflicting-files?
+           `((add-after 'install 'remove-broken-or-conflicting-files
              (lambda* (#:key outputs #:allow-other-keys)
                (for-each delete-file
                          (find-files (string-append (assoc-ref outputs "out") "/bin")
                                      ".*(c\\+\\+|cpp|g\\+\\+|gcov|gcc.*)"))
-               #t))))))))
+               #t)))
+           '())))))))
 
 (define %generic-search-paths
   ;; This is the language-neutral search path for GCC.  Entries in $CPATH are
-- 
2.14.0


[-- Attachment #1.3: 0002-gnu-Add-gccgo-7.patch --]
[-- Type: text/plain, Size: 3756 bytes --]

From fbdf746826b308a9d23644fbb5bea93dee5e85e9 Mon Sep 17 00:00:00 2001
From: Efraim Flashner <efraim@flashner.co.il>
Date: Mon, 7 Aug 2017 22:59:22 +0300
Subject: [PATCH 2/3] gnu: Add gccgo@7.

* gnu/packages/gcc.scm (gccgo@7): New variable.
* gnu/packages/gcc.scm (gcc@7)[source]: Add patch.
* gnu/packages/patches/gcc-7.1-go-runpath.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register it.
---
 gnu/local.mk                                  |  1 +
 gnu/packages/gcc.scm                          | 15 ++++++++++++++-
 gnu/packages/patches/gcc-7.1-go-runpath.patch | 10 ++++++++++
 3 files changed, 25 insertions(+), 1 deletion(-)
 create mode 100644 gnu/packages/patches/gcc-7.1-go-runpath.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 8c00b0020..ee9429770 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -623,6 +623,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/gcc-5-source-date-epoch-2.patch		\
   %D%/packages/patches/gcc-6-arm-none-eabi-multilib.patch	\
   %D%/packages/patches/gcc-6-cross-environment-variables.patch	\
+  %D%/packages/patches/gcc-7.1-go-runpath.patch		\
   %D%/packages/patches/gcr-disable-failing-tests.patch		\
   %D%/packages/patches/gcr-fix-collection-tests-to-work-with-gpg-21.patch	\
   %D%/packages/patches/gdk-pixbuf-list-dir.patch		\
diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm
index a22bb3c25..9cf347f76 100644
--- a/gnu/packages/gcc.scm
+++ b/gnu/packages/gcc.scm
@@ -414,7 +414,8 @@ Go.  It also includes runtime support libraries for these languages.")
                (base32
                 "05xwps0ci7wgxh50askpa2r9p8518qxdgh6ad7pnyk7n6p13d0ca"))
               (patches (search-patches "gcc-strmov-store-file-names.patch"
-                                       "gcc-5.0-libvtv-runpath.patch"))))))
+                                       "gcc-5.0-libvtv-runpath.patch"
+                                       "gcc-7.1-go-runpath.patch"))))))
 
 ;; Note: When changing the default gcc version, update
 ;;       the gcc-toolchain-* definitions and the gfortran definition
@@ -565,6 +566,18 @@ as the 'native-search-paths' field."
               ;; a cyclic dependency.  <http://debbugs.gnu.org/18101>
               #:separate-lib-output? #f))
 
+(define-public gccgo-7
+  (custom-gcc gcc-7 "gccgo" '("go")
+              %generic-search-paths
+              ;; Suppress the separate "lib" output, because otherwise the
+              ;; "lib" and "out" outputs would refer to each other, creating
+              ;; a cyclic dependency.  <http://debbugs.gnu.org/18101>
+              #:separate-lib-output? #f
+              ;; When building go, it is expected to use the same GCC output
+              ;; for gcc and for gccgo, so we compile go with the gcc from
+              ;; this build.
+              #:remove-conflicting-files? #f))
+
 (define-public gcc-objc-4.8
   (custom-gcc gcc-4.8 "gcc-objc" '("objc")
               (list (search-path-specification
diff --git a/gnu/packages/patches/gcc-7.1-go-runpath.patch b/gnu/packages/patches/gcc-7.1-go-runpath.patch
new file mode 100644
index 000000000..d7d91301e
--- /dev/null
+++ b/gnu/packages/patches/gcc-7.1-go-runpath.patch
@@ -0,0 +1,10 @@
+--- gcc-7.1.0/gotools/Makefile.in
++++ gcc-7.1.0/gotools/Makefile.in
+@@ -258,6 +258,6 @@
+ # Use the compiler we just built.
+ @NATIVE_TRUE@GOCOMPILER = $(GOC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET)
+ GOCOMPILE = $(GOCOMPILER) $(GOCFLAGS)
+-AM_LDFLAGS = -L $(libgodir) -L $(libgodir)/.libs
++AM_LDFLAGS = -Wl,-rpath=$(libdir) -L $(libgodir) -L $(libgodir)/.libs
+ GOLINK = $(GOCOMPILER) $(GOCFLAGS) $(AM_GOCFLAGS) $(LDFLAGS) $(AM_LDFLAGS) -o $@
+ cmdsrcdir = $(srcdir)/../libgo/go/cmd
-- 
2.14.0


[-- Attachment #1.4: 0003-gnu-go-Build-with-gccgo-7.patch --]
[-- Type: text/plain, Size: 2055 bytes --]

From 5b3e3ed9e8fddb36b7d884ab5d2dd6f0a4ad5220 Mon Sep 17 00:00:00 2001
From: Efraim Flashner <efraim@flashner.co.il>
Date: Mon, 7 Aug 2017 23:09:29 +0300
Subject: [PATCH 3/3] gnu: go: Build with gccgo@7.

* gnu/packages/golang.scm (go@1.8)[inputs]: Remove gcc-lib.
[native-inputs]: Remove go@1.4, add gccgo@7.
---
 gnu/packages/golang.scm | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm
index 70cae6d87..3dee1d72b 100644
--- a/gnu/packages/golang.scm
+++ b/gnu/packages/golang.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2016, 2017 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2016 Matthew Jordan <matthewjordandevops@yandex.com>
 ;;; Copyright © 2016 Andy Wingo <wingo@igalia.com>
 ;;; Copyright © 2016 Ludovic Courtès <ludo@gnu.org>
@@ -219,7 +219,7 @@ sequential processes (CSP) concurrent programming features added.")
            (replace 'prebuild
              ;; TODO: Most of this could be factorized with Go 1.4.
              (lambda* (#:key inputs outputs #:allow-other-keys)
-               (let* ((gcclib (string-append (assoc-ref inputs "gcc:lib") "/lib"))
+               (let* ((gcclib (string-append (assoc-ref inputs "go") "/lib"))
                       (ld (string-append (assoc-ref inputs "libc") "/lib"))
                       (loader (car (find-files ld "^ld-linux.+")))
                       (net-base (assoc-ref inputs "net-base"))
@@ -362,8 +362,11 @@ sequential processes (CSP) concurrent programming features added.")
                     "LICENSE" "VERSION" "CONTRIBUTING.md" "robots.txt"))
 
                  (copy-recursively "../" output))))))))
+    (inputs
+     `(("tzdata" ,tzdata)
+       ("pcre" ,pcre)))
     (native-inputs
-     `(("go" ,go-1.4)
+     `(("go" ,gccgo-7)
        ,@(package-native-inputs go-1.4)))))
 
 (define-public go go-1.8)
-- 
2.14.0


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2021-08-05 23:06 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-24 20:51 [bug#28226] Build go with gccgo Efraim Flashner
2017-09-12  9:59 ` Catonano
2017-09-12 10:44   ` Efraim Flashner
2017-09-12 12:54     ` Catonano
2020-06-05 23:58 ` [bug#28226] go with gccgo still relevant? Jack Hill
2020-06-07  7:34   ` Efraim Flashner
2021-08-05 23:05 ` bug#28226: Build go with gccgo Sarah Morgensen

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.