unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* GFortran can’t find system headers
@ 2013-10-15  2:59 Nikita Karetnikov
  2013-10-15 20:17 ` Ludovic Courtès
  0 siblings, 1 reply; 17+ messages in thread
From: Nikita Karetnikov @ 2013-10-15  2:59 UTC (permalink / raw)
  To: guix-devel

[-- Attachment #1: Type: text/plain, Size: 794 bytes --]

I’m trying to package APL, which requires LAPACK, which requires
Fortran.

Here’s my attempt to add the last one:

(define-public gfortran-4.8
  (package (inherit gcc-4.8)
    (name "gfortran")
    (arguments `(#:configure-flags '("--enable-languages=fortran")))))

I get the following error while trying to build it:

The directory that should contain system headers does not exist:
  /usr/include

Note that GFortran inherits GCC 4.8, which has these lines:

      (native-search-paths
       (list (search-path-specification
              (variable "CPATH")
              (directories '("include")))
             (search-path-specification
              (variable "LIBRARY_PATH")
              (directories '("lib" "lib64")))))

Then why does the error appear?

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

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

* Re: GFortran can’t find system headers
  2013-10-15  2:59 GFortran can’t find system headers Nikita Karetnikov
@ 2013-10-15 20:17 ` Ludovic Courtès
  2013-10-17 12:59   ` Nikita Karetnikov
  0 siblings, 1 reply; 17+ messages in thread
From: Ludovic Courtès @ 2013-10-15 20:17 UTC (permalink / raw)
  To: Nikita Karetnikov; +Cc: guix-devel

Nikita Karetnikov <nikita@karetnikov.org> skribis:

> I’m trying to package APL, which requires LAPACK, which requires
> Fortran.

Cool.

> Here’s my attempt to add the last one:
>
> (define-public gfortran-4.8
>   (package (inherit gcc-4.8)
>     (name "gfortran")
>     (arguments `(#:configure-flags '("--enable-languages=fortran")))))
>
> I get the following error while trying to build it:
>
> The directory that should contain system headers does not exist:
>   /usr/include

Yes, the problem is that the your ‘arguments’ field above completely
overrides that of ‘gcc-4.8’.

Instead, what should do is preserve the arguments; the value associated
with #:configure-flags should be changed to replace any
--enable-languages=.* flag with yours.  See ‘gcc-boot0’ in base.scm for
how to do that.

Alternately, you could turn the current ‘gcc-4.8’ definition into a
‘make-gcc-4.8’ procedure like this:

  (define* (make-gcc-4.8 #:key languages)
    (package
       ...

       #:configure-flags ... ,(string-join languages ",")

       ...))

  (define gcc-4.8
    (make-gcc-4.8 #:languages '("c" "c++")))

That would probably be easier to work with.

HTH,
Ludo’.

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

* Re: GFortran can’t find system headers
  2013-10-15 20:17 ` Ludovic Courtès
@ 2013-10-17 12:59   ` Nikita Karetnikov
  2013-10-17 15:29     ` Ludovic Courtès
  0 siblings, 1 reply; 17+ messages in thread
From: Nikita Karetnikov @ 2013-10-17 12:59 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel


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

> Instead, what should do is preserve the arguments; the value associated
> with #:configure-flags should be changed to replace any
> --enable-languages=.* flag with yours.  See ‘gcc-boot0’ in base.scm for
> how to do that.

Are you talking about the ‘substitute-keyword-arguments’ part?

> Alternately, you could turn the current ‘gcc-4.8’ definition into a
> ‘make-gcc-4.8’ procedure like this:

>   (define* (make-gcc-4.8 #:key languages)
>     (package
>        ...

>        #:configure-flags ... ,(string-join languages ",")

>        ...))

>   (define gcc-4.8
>     (make-gcc-4.8 #:languages '("c" "c++")))

> That would probably be easier to work with.

I don’t like the above version because it doesn’t allow to choose the
version of GCC.  I’ve attached my version, how can I make it look
better?

Also, ‘/nix/store/nxpzxlvg5z5qq10wzxrzk9hjyhxyicxq-gfortran-4.8.1/bin’
contains these programs:

c++     gcc-ranlib             i686-pc-linux-gnu-gcc-4.8.1
cpp     gcov                   i686-pc-linux-gnu-gcc-ar
g++     gfortran               i686-pc-linux-gnu-gcc-nm
gcc     i686-pc-linux-gnu-c++  i686-pc-linux-gnu-gcc-ranlib
gcc-ar  i686-pc-linux-gnu-g++  i686-pc-linux-gnu-gfortran
gcc-nm  i686-pc-linux-gnu-gcc

Are C++ and C-related programs supposed to be there?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: gcc.diff --]
[-- Type: text/x-diff, Size: 3620 bytes --]

diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm
index cececca..46c4804 100644
--- a/gnu/packages/gcc.scm
+++ b/gnu/packages/gcc.scm
@@ -47,7 +47,7 @@ where the OS part is overloaded to denote a specific ABI---into GCC
          ;; TODO: Add `armel.*gnueabi', `hf', etc.
          '())))
 
-(define-public gcc-4.7
+(define* (inherit-gcc name* version* source* #:key (languages '("c" "c++")))
   (let* ((stripped? #t)                           ; TODO: make this a parameter
          (maybe-target-tools
           (lambda ()
@@ -68,13 +68,14 @@ where the OS part is overloaded to denote a specific ABI---into GCC
             ;; contents of (maybe-target-tools).
             (list 'quasiquote
                   (append
-                   '("--enable-plugin"
-                     "--enable-languages=c,c++"
+                   `("--enable-plugin"
+                     ,(string-append "--enable-languages="
+                                     (string-join languages ","))
                      "--disable-multilib"
 
-                     "--with-local-prefix=/no-gcc-local-prefix"
+                     "--with-local-prefix=/no-gcc-local-prefix")
 
-                     ,(let ((libc (assoc-ref %build-inputs "libc")))
+                   '(,(let ((libc (assoc-ref %build-inputs "libc")))
                         (if libc
                             (string-append "--with-native-system-header-dir=" libc
                                            "/include")
@@ -88,15 +89,9 @@ where the OS part is overloaded to denote a specific ABI---into GCC
 
                    (maybe-target-tools))))))
     (package
-      (name "gcc")
-      (version "4.7.3")
-      (source (origin
-               (method url-fetch)
-               (uri (string-append "mirror://gnu/gcc/gcc-"
-                                   version "/gcc-" version ".tar.bz2"))
-               (sha256
-                (base32
-                 "1hx9h64ivarlzi4hxvq42as5m9vlr5cyzaaq4gzj4i619zmkfz1g"))))
+      (name name*)
+      (version version*)
+      (source source*)
       (build-system gnu-build-system)
       (inputs `(("gmp" ,gmp)
                 ("mpfr" ,mpfr)
@@ -200,6 +195,17 @@ Go.  It also includes standard libraries for these languages.")
       (license gpl3+)
       (home-page "http://gcc.gnu.org/"))))
 
+(define-public gcc-4.7
+  (let ((version "4.7.3"))
+    (inherit-gcc "gcc" version
+                 (origin
+                  (method url-fetch)
+                  (uri (string-append "mirror://gnu/gcc/gcc-"
+                                      version "/gcc-" version ".tar.bz2"))
+                  (sha256
+                   (base32
+                    "1hx9h64ivarlzi4hxvq42as5m9vlr5cyzaaq4gzj4i619zmkfz1g"))))))
+
 (define-public gcc-4.8
   (package (inherit gcc-4.7)
     (version "4.8.1")
@@ -211,6 +217,18 @@ Go.  It also includes standard libraries for these languages.")
               (base32
                "04sqn0ds17ys8l6zn7vyyvjz1a7hsk4zb0381vlw9wnr7az48nsl"))))))
 
+(define-public gfortran-4.8
+  (let ((version "4.8.1"))
+    (inherit-gcc "gfortran" version
+                 (origin
+                  (method url-fetch)
+                  (uri (string-append "mirror://gnu/gcc/gcc-"
+                                      version "/gcc-" version ".tar.bz2"))
+                  (sha256
+                   (base32
+                    "04sqn0ds17ys8l6zn7vyyvjz1a7hsk4zb0381vlw9wnr7az48nsl")))
+                 #:languages '("fortran"))))
+
 (define-public isl
   (package
     (name "isl")

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

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

* Re: GFortran can’t find system headers
  2013-10-17 12:59   ` Nikita Karetnikov
@ 2013-10-17 15:29     ` Ludovic Courtès
  2013-10-19  8:58       ` GCC front-ends (was: GFortran can’t find system headers) Nikita Karetnikov
  0 siblings, 1 reply; 17+ messages in thread
From: Ludovic Courtès @ 2013-10-17 15:29 UTC (permalink / raw)
  To: Nikita Karetnikov; +Cc: guix-devel

Nikita Karetnikov <nikita@karetnikov.org> skribis:

>> Instead, what should do is preserve the arguments; the value associated
>> with #:configure-flags should be changed to replace any
>> --enable-languages=.* flag with yours.  See ‘gcc-boot0’ in base.scm for
>> how to do that.
>
> Are you talking about the ‘substitute-keyword-arguments’ part?

Yes.

>> Alternately, you could turn the current ‘gcc-4.8’ definition into a
>> ‘make-gcc-4.8’ procedure like this:
>
>>   (define* (make-gcc-4.8 #:key languages)
>>     (package
>>        ...
>
>>        #:configure-flags ... ,(string-join languages ",")
>
>>        ...))
>
>>   (define gcc-4.8
>>     (make-gcc-4.8 #:languages '("c" "c++")))
>
>> That would probably be easier to work with.
>
> I don’t like the above version because it doesn’t allow to choose the
> version of GCC.

Just add a ‘gcc’ parameter.

> Also, ‘/nix/store/nxpzxlvg5z5qq10wzxrzk9hjyhxyicxq-gfortran-4.8.1/bin’
> contains these programs:
>
> c++     gcc-ranlib             i686-pc-linux-gnu-gcc-4.8.1
> cpp     gcov                   i686-pc-linux-gnu-gcc-ar
> g++     gfortran               i686-pc-linux-gnu-gcc-nm
> gcc     i686-pc-linux-gnu-c++  i686-pc-linux-gnu-gcc-ranlib
> gcc-ar  i686-pc-linux-gnu-g++  i686-pc-linux-gnu-gfortran
> gcc-nm  i686-pc-linux-gnu-gcc
>
> Are C++ and C-related programs supposed to be there?

Yes, the C and C++ front-ends are always compiled.

> -(define-public gcc-4.7
> +(define* (inherit-gcc name* version* source* #:key (languages '("c" "c++")))

I would really ‘make-gcc’, or maybe ‘custom-gcc’.

Good news: the stars in these parameter names are no longer needed
(commit 59fbeb8).

>    (let* ((stripped? #t)                           ; TODO: make this a parameter
>           (maybe-target-tools
>            (lambda ()
> @@ -68,13 +68,14 @@ where the OS part is overloaded to denote a specific ABI---into GCC
>              ;; contents of (maybe-target-tools).
>              (list 'quasiquote
>                    (append
> -                   '("--enable-plugin"
> -                     "--enable-languages=c,c++"
> +                   `("--enable-plugin"
> +                     ,(string-append "--enable-languages="
> +                                     (string-join languages ","))
>                       "--disable-multilib"
>  
> -                     "--with-local-prefix=/no-gcc-local-prefix"
> +                     "--with-local-prefix=/no-gcc-local-prefix")
>  
> -                     ,(let ((libc (assoc-ref %build-inputs "libc")))
> +                   '(,(let ((libc (assoc-ref %build-inputs "libc")))

I guess this line shouldn’t have changed.

> @@ -200,6 +195,17 @@ Go.  It also includes standard libraries for these languages.")
>        (license gpl3+)
>        (home-page "http://gcc.gnu.org/"))))
>  
> +(define-public gcc-4.7
> +  (let ((version "4.7.3"))
> +    (inherit-gcc "gcc" version
> +                 (origin
> +                  (method url-fetch)
> +                  (uri (string-append "mirror://gnu/gcc/gcc-"
> +                                      version "/gcc-" version ".tar.bz2"))
> +                  (sha256
> +                   (base32
> +                    "1hx9h64ivarlzi4hxvq42as5m9vlr5cyzaaq4gzj4i619zmkfz1g"))))))

I guess this triggers a complete rebuild, right?  (That means it would
go in ‘core-updates’.)

Using the ‘substitute-keyword-arguments’ hack as in base.scm would allow
you to avoid that.

Also, the ‘origin’ thing should be factorized:

  (define (gcc-source version)
    (origin ...))

It’s good that you’re tackling this!  Then we can also build the
Objective-C front-end, and then start GNUstepping.

Thanks,
Ludo’.

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

* GCC front-ends (was: GFortran can’t find system headers)
  2013-10-17 15:29     ` Ludovic Courtès
@ 2013-10-19  8:58       ` Nikita Karetnikov
  2013-10-26 20:08         ` GCC front-ends Ludovic Courtès
  0 siblings, 1 reply; 17+ messages in thread
From: Nikita Karetnikov @ 2013-10-19  8:58 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel


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

> I guess this triggers a complete rebuild, right?  (That means it would
> go in ‘core-updates’.)

> Using the ‘substitute-keyword-arguments’ hack as in base.scm would allow
> you to avoid that.

> Also, the ‘origin’ thing should be factorized:

>   (define (gcc-source version)
>     (origin ...))

> It’s good that you’re tackling this!  Then we can also build the
> Objective-C front-end, and then start GNUstepping.

What do you think about the attached diff?  Is there a way to avoid
multiple ‘map’s?

What about the names of the packages?  For example, ‘gcc-fortran’ is
usually called ‘gfortran’, ‘gcc-go’ is called ‘gccgo’, etc.  Should we
use these names?  How should we call ‘gcc-objc’, then?

If you want to test any of the front-ends, don’t forget to set
LIBRARY_PATH and LD_LIBRARY_PATH, like so:

$ export LIBRARY_PATH=/nix/store/wmaxqx3p658v2yqjv00mss2shvn23h7a-glibc-2.18/lib
$ export LD_LIBRARY_PATH=/nix/store/kvhg0fszagsx5y80sq79bkmb7yqvjfmd-gcc-go-4.8.1/lib

Notes:

1. The Go front-end requires ‘-g’ (see [1]).

2. “GFORTRAN guesses the source code formatting based on the file
   extension. For .f90 files, it will assume it's working with FORTRAN
   90 source code and use free formatting rules. For .f and .for files,
   it will assume the file is F77 source code and use fixed formatting
   rules.” [2]

3. If you want to compile Objective-C or Objective-C++, pass ‘-x <lang>’
   to ‘gcc’.

4. The Ada front-end requires GNAT [3] (see [4]).

5. Not sure why the Java front-end fails:

   libtool: link: ( cd ".libs" && rm -f "libquadmath.la" && ln -s "../libquadmath.la" "libquadmath.la" )
   make[3]: Leaving directory `/tmp/nix-build-gcc-java-4.8.1.drv-0/build/i686-pc-linux-gnu/libquadmath'
   make[2]: Leaving directory `/tmp/nix-build-gcc-java-4.8.1.drv-0/build/i686-pc-linux-gnu/libquadmath'
   make[1]: Leaving directory `/tmp/nix-build-gcc-java-4.8.1.drv-0/build'
   make: *** [all] Error 2
   phase `build' failed after 2229 seconds
   note: keeping build directory `/tmp/nix-build-gcc-java-4.8.1.drv-0'
   builder for `/nix/store/wlqwyy9k9mbl3wpy9jq08k91qq23f4kp-gcc-java-4.8.1.drv' failed with exit code 1
   @ build-failed /nix/store/wlqwyy9k9mbl3wpy9jq08k91qq23f4kp-gcc-java-4.8.1.drv - 1 builder for `/nix/store/wlqwyy9k9mbl3wpy9jq08k91qq23f4kp-gcc-java-4.8.1.drv' failed with exit code 1
   guix build: error: build failed: build of `/nix/store/wlqwyy9k9mbl3wpy9jq08k91qq23f4kp-gcc-java-4.8.1.drv' failed

[1] http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57194
[2] http://ubuntuforums.org/showthread.php?t=853105
[3] https://www.gnu.org/software/gnat/
[4] http://gcc.gnu.org/ml/gcc/2007-11/msg00091.html


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: gcc.diff --]
[-- Type: text/x-diff, Size: 1715 bytes --]

diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm
index cececca..c2742fb 100644
--- a/gnu/packages/gcc.scm
+++ b/gnu/packages/gcc.scm
@@ -26,6 +26,7 @@
   #:use-module (gnu packages texinfo)
   #:use-module (guix packages)
   #:use-module (guix download)
+  #:use-module (guix utils)
   #:use-module (guix build-system gnu)
   #:use-module (ice-9 regex))
 
@@ -211,6 +212,41 @@ Go.  It also includes standard libraries for these languages.")
               (base32
                "04sqn0ds17ys8l6zn7vyyvjz1a7hsk4zb0381vlw9wnr7az48nsl"))))))
 
+(define (custom-gcc gcc name languages)
+  (package (inherit gcc)
+    (name name)
+    (arguments
+     (substitute-keyword-arguments (package-arguments gcc)
+       ((#:configure-flags flags)
+        (map (lambda (x)
+               (if (list? x)
+                   (map (lambda (y)
+                          (if (equal? "--enable-languages=c,c++" y)
+                              (string-append "--enable-languages="
+                                             languages)
+                              y))
+                        x)
+                   x))
+             flags))))))
+
+;; (define-public gcc-ada-4.8
+;;   (custom-gcc gcc-4.8 "gcc-ada" "ada"))
+
+(define-public gcc-fortran-4.8
+  (custom-gcc gcc-4.8 "gcc-fortran" "fortran"))
+
+(define-public gcc-go-4.8
+  (custom-gcc gcc-4.8 "gcc-go" "go"))
+
+;; (define-public gcc-java-4.8
+;;   (custom-gcc gcc-4.8 "gcc-java" "java"))
+
+(define-public gcc-objc-4.8
+  (custom-gcc gcc-4.8 "gcc-objc" "objc"))
+
+(define-public gcc-objc++-4.8
+  (custom-gcc gcc-4.8 "gcc-objc++" "obj-c++"))
+
 (define-public isl
   (package
     (name "isl")

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

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

* Re: GCC front-ends
  2013-10-19  8:58       ` GCC front-ends (was: GFortran can’t find system headers) Nikita Karetnikov
@ 2013-10-26 20:08         ` Ludovic Courtès
  2013-10-27 10:39           ` Andreas Enge
                             ` (2 more replies)
  0 siblings, 3 replies; 17+ messages in thread
From: Ludovic Courtès @ 2013-10-26 20:08 UTC (permalink / raw)
  To: Nikita Karetnikov; +Cc: guix-devel

Nikita Karetnikov <nikita@karetnikov.org> skribis:

>> I guess this triggers a complete rebuild, right?  (That means it would
>> go in ‘core-updates’.)
>
>> Using the ‘substitute-keyword-arguments’ hack as in base.scm would allow
>> you to avoid that.
>
>> Also, the ‘origin’ thing should be factorized:
>
>>   (define (gcc-source version)
>>     (origin ...))
>
>> It’s good that you’re tackling this!  Then we can also build the
>> Objective-C front-end, and then start GNUstepping.
>
> What do you think about the attached diff?  Is there a way to avoid
> multiple ‘map’s?

See below.

> What about the names of the packages?  For example, ‘gcc-fortran’ is
> usually called ‘gfortran’, ‘gcc-go’ is called ‘gccgo’, etc.  Should we
> use these names?  How should we call ‘gcc-objc’, then?

I’d say ‘gfortran’ and ‘gccgo’, and perhaps ‘gcc-objective-c’?

> If you want to test any of the front-ends, don’t forget to set
> LIBRARY_PATH and LD_LIBRARY_PATH, like so:
>
> $ export LIBRARY_PATH=/nix/store/wmaxqx3p658v2yqjv00mss2shvn23h7a-glibc-2.18/lib
> $ export LD_LIBRARY_PATH=/nix/store/kvhg0fszagsx5y80sq79bkmb7yqvjfmd-gcc-go-4.8.1/lib

I guess that’s unnecessary when using ‘ld-wrapper’.

> Notes:
>
> 1. The Go front-end requires ‘-g’ (see [1]).

That’s a bug, which may have been fixed in 4.8.2 no?  I’d rather not
workaround that if it’s been/being fixed.

> 4. The Ada front-end requires GNAT [3] (see [4]).
>
> 5. Not sure why the Java front-end fails:

GNAT and GCJ are definitely trickier, so I’d suggest to leave them for now.

> +(define (custom-gcc gcc name languages)
> +  (package (inherit gcc)
> +    (name name)
> +    (arguments
> +     (substitute-keyword-arguments (package-arguments gcc)
> +       ((#:configure-flags flags)
> +        (map (lambda (x)
> +               (if (list? x)
> +                   (map (lambda (y)
> +                          (if (equal? "--enable-languages=c,c++" y)
> +                              (string-append "--enable-languages="
> +                                             languages)
> +                              y))
> +                        x)
> +                   x))
> +             flags))))))

That’s unreliable because FLAGS is actually a quoted expression, like

  '(cons "--with-foo" (list "--with-bar"))

So the mapping has to be done in builder-side code, not in host-side
code, like ‘gcc-cross-boot0’ does.

Something like:

  `(cons "--enable-languages=" ,(string-join languages ",")
         (remove (cut string-match "--enable-languages.*" <>) ,flags))

(Note that “c,c++” can be omitted since it’s always enabled.)

Thanks,
Ludo’.

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

* Re: GCC front-ends
  2013-10-26 20:08         ` GCC front-ends Ludovic Courtès
@ 2013-10-27 10:39           ` Andreas Enge
  2013-10-28 13:07             ` Ludovic Courtès
  2013-10-28 23:23           ` Nikita Karetnikov
  2013-10-31 20:13           ` [PATCH] gnu: Add GCC front ends for Fortran, Go, Objective C, and Objective C++ Nikita Karetnikov
  2 siblings, 1 reply; 17+ messages in thread
From: Andreas Enge @ 2013-10-27 10:39 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

On Sat, Oct 26, 2013 at 10:08:04PM +0200, Ludovic Courtès wrote:
> That’s a bug, which may have been fixed in 4.8.2 no?  I’d rather not
> workaround that if it’s been/being fixed.

Speaking of which, should we maybe switch to 4.8.2 for building the
distribution? Now would be the right time to update core-updates.
Mark also suggested a new set of bootstrap-tarballs with a common date
and common versions of all programs for all architectures, including mips.

Andreas

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

* Re: GCC front-ends
  2013-10-27 10:39           ` Andreas Enge
@ 2013-10-28 13:07             ` Ludovic Courtès
  2013-10-29  8:39               ` Andreas Enge
  0 siblings, 1 reply; 17+ messages in thread
From: Ludovic Courtès @ 2013-10-28 13:07 UTC (permalink / raw)
  To: Andreas Enge; +Cc: guix-devel

Andreas Enge <andreas@enge.fr> skribis:

> On Sat, Oct 26, 2013 at 10:08:04PM +0200, Ludovic Courtès wrote:
>> That’s a bug, which may have been fixed in 4.8.2 no?  I’d rather not
>> workaround that if it’s been/being fixed.
>
> Speaking of which, should we maybe switch to 4.8.2 for building the
> distribution? Now would be the right time to update core-updates.

Yes, definitely.

I wanted to test 4.8.2 in master first, but for that I was waiting for
Nikita’s work to avoid any disruption.

> Mark also suggested a new set of bootstrap-tarballs with a common date
> and common versions of all programs for all architectures, including
> mips.

Probably a good idea.

I wonder if this would also be an opportunity to do that fixed-point
thing while we’re at rebuilding everything.  Or is it too ambitious?

Ludo’.

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

* Re: GCC front-ends
  2013-10-26 20:08         ` GCC front-ends Ludovic Courtès
  2013-10-27 10:39           ` Andreas Enge
@ 2013-10-28 23:23           ` Nikita Karetnikov
  2013-10-28 23:23             ` Ludovic Courtès
  2013-10-31 20:13           ` [PATCH] gnu: Add GCC front ends for Fortran, Go, Objective C, and Objective C++ Nikita Karetnikov
  2 siblings, 1 reply; 17+ messages in thread
From: Nikita Karetnikov @ 2013-10-28 23:23 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 2277 bytes --]

> That’s a bug, which may have been fixed in 4.8.2 no?  I’d rather not
> workaround that if it’s been/being fixed.

No, it has not been fixed.  Well, the previous patch didn’t contain any
workarounds.  However, users would have to pass ‘-g’ each time they
decide to compile anything.  Otherwise, their binaries will not work.
Can we do anything about it?

> GNAT and GCJ are definitely trickier, so I’d suggest to leave them for now.

OK.

> So the mapping has to be done in builder-side code, not in host-side
> code, like ‘gcc-cross-boot0’ does.

> Something like:

>   `(cons "--enable-languages=" ,(string-join languages ",")
>          (remove (cut string-match "--enable-languages.*" <>) ,flags))

(define (custom-gcc gcc name languages)
  (package (inherit gcc)
    (name name)
    (arguments
     (substitute-keyword-arguments (package-arguments gcc)
       ((#:configure-flags flags)
        `(cons "--enable-languages=" ,(string-join languages ",")
               (remove (cut string-match "--enable-languages.*" <>)
                       ,flags)))
       ((#:modules _)
        '((guix build gnu-build-system)
          (guix build utils)
          (srfi srfi-1)))))))

(define-public gfortran-4.8
  (custom-gcc gcc-4.8 "gfortran" '("fortran")))

The above code fails.

Backtrace:
In ice-9/boot-9.scm:
 157: 14 [catch #t #<catch-closure 8ab5bf0> ...]
In unknown file:
   ?: 13 [apply-smob/1 #<catch-closure 8ab5bf0>]
In ice-9/boot-9.scm:
  63: 12 [call-with-prompt prompt0 ...]
In ice-9/eval.scm:
 432: 11 [eval # #]
In ice-9/boot-9.scm:
2320: 10 [save-module-excursion #<procedure 8acdde0 at ice-9/boot-9.scm:3961:3 ()>]
3966: 9 [#<procedure 8acdde0 at ice-9/boot-9.scm:3961:3 ()>]
1645: 8 [%start-stack load-stack ...]
1650: 7 [#<procedure 8ad0df8 ()>]
In unknown file:
   ?: 6 [primitive-load "/nix/store/m8axi2v9cbj2s0kfpifxp874sxplwwwg-gfortran-4.8.2-guile-builder"]
In ice-9/eval.scm:
 387: 5 [eval # ()]
 387: 4 [eval # ()]
 387: 3 [eval # ()]
 386: 2 [eval # ()]
 393: 1 [eval #<memoized remove> ()]
In unknown file:
   ?: 0 [memoize-variable-access! #<memoized remove> #<directory # 8a43630>]

ERROR: In procedure memoize-variable-access!:
ERROR: Unbound variable: remove

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

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

* Re: GCC front-ends
  2013-10-28 23:23           ` Nikita Karetnikov
@ 2013-10-28 23:23             ` Ludovic Courtès
  2013-10-28 23:38               ` Nikita Karetnikov
  0 siblings, 1 reply; 17+ messages in thread
From: Ludovic Courtès @ 2013-10-28 23:23 UTC (permalink / raw)
  To: Nikita Karetnikov; +Cc: guix-devel

Nikita Karetnikov <nikita@karetnikov.org> skribis:

>> That’s a bug, which may have been fixed in 4.8.2 no?  I’d rather not
>> workaround that if it’s been/being fixed.
>
> No, it has not been fixed.  Well, the previous patch didn’t contain any
> workarounds.  However, users would have to pass ‘-g’ each time they
> decide to compile anything.  Otherwise, their binaries will not work.
> Can we do anything about it?

I’d say that it’s not our business (above all, I’m surprised the Go
front-end is this broken.)

>> So the mapping has to be done in builder-side code, not in host-side
>> code, like ‘gcc-cross-boot0’ does.
>
>> Something like:
>
>>   `(cons "--enable-languages=" ,(string-join languages ",")
>>          (remove (cut string-match "--enable-languages.*" <>) ,flags))
>
> (define (custom-gcc gcc name languages)
>   (package (inherit gcc)
>     (name name)
>     (arguments
>      (substitute-keyword-arguments (package-arguments gcc)
>        ((#:configure-flags flags)
>         `(cons "--enable-languages=" ,(string-join languages ",")
>                (remove (cut string-match "--enable-languages.*" <>)
>                        ,flags)))
>        ((#:modules _)
>         '((guix build gnu-build-system)
>           (guix build utils)
>           (srfi srfi-1)))))))
>
> (define-public gfortran-4.8
>   (custom-gcc gcc-4.8 "gfortran" '("fortran")))
>
> The above code fails.

Argh, you also need (srfi srfi-26) for ‘cut’, sorry about that.

HTH,
Ludo’.

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

* Re: GCC front-ends
  2013-10-28 23:23             ` Ludovic Courtès
@ 2013-10-28 23:38               ` Nikita Karetnikov
  0 siblings, 0 replies; 17+ messages in thread
From: Nikita Karetnikov @ 2013-10-28 23:38 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 135 bytes --]

> Argh, you also need (srfi srfi-26) for ‘cut’, sorry about that.

Hm, I’ve added the module, but I still get the same error.

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

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

* Re: GCC front-ends
  2013-10-28 13:07             ` Ludovic Courtès
@ 2013-10-29  8:39               ` Andreas Enge
  2013-10-29 10:32                 ` Ludovic Courtès
  0 siblings, 1 reply; 17+ messages in thread
From: Andreas Enge @ 2013-10-29  8:39 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

On Mon, Oct 28, 2013 at 02:07:45PM +0100, Ludovic Courtès wrote:
> I wonder if this would also be an opportunity to do that fixed-point
> thing while we’re at rebuilding everything.  Or is it too ambitious?

Only you can tell, as you have been doing a lot of work on it! Why not
give it a try?

Andreas

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

* Re: GCC front-ends
  2013-10-29  8:39               ` Andreas Enge
@ 2013-10-29 10:32                 ` Ludovic Courtès
  0 siblings, 0 replies; 17+ messages in thread
From: Ludovic Courtès @ 2013-10-29 10:32 UTC (permalink / raw)
  To: Andreas Enge; +Cc: guix-devel

Andreas Enge <andreas@enge.fr> skribis:

> On Mon, Oct 28, 2013 at 02:07:45PM +0100, Ludovic Courtès wrote:
>> I wonder if this would also be an opportunity to do that fixed-point
>> thing while we’re at rebuilding everything.  Or is it too ambitious?
>
> Only you can tell, as you have been doing a lot of work on it! Why not
> give it a try?

Right, let’s try, and consider it an optional goal for 0.5.

Ludo’.

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

* [PATCH] gnu: Add GCC front ends for Fortran, Go, Objective C, and Objective C++.
  2013-10-26 20:08         ` GCC front-ends Ludovic Courtès
  2013-10-27 10:39           ` Andreas Enge
  2013-10-28 23:23           ` Nikita Karetnikov
@ 2013-10-31 20:13           ` Nikita Karetnikov
  2013-10-31 22:19             ` Ludovic Courtès
  2 siblings, 1 reply; 17+ messages in thread
From: Nikita Karetnikov @ 2013-10-31 20:13 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel


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

>> If you want to test any of the front-ends, don’t forget to set
>> LIBRARY_PATH and LD_LIBRARY_PATH, like so:
>>
>> $ export LIBRARY_PATH=/nix/store/wmaxqx3p658v2yqjv00mss2shvn23h7a-glibc-2.18/lib
>> $ export LD_LIBRARY_PATH=/nix/store/kvhg0fszagsx5y80sq79bkmb7yqvjfmd-gcc-go-4.8.1/lib

> I guess that’s unnecessary when using ‘ld-wrapper’.

I know nothing about it.  Could you elaborate?

I tested each front end using the “hello, world” program.  Is it enough?

It was necessary to set some environment variables.  An example for
Fortran:

LIBRARY_PATH=/nix/var/nix/profiles/default/guix-profile/lib
LD_LIBRARY_PATH=/nix/store/jh5shyx6pg7m0dibdgl202pj7ryp5nvq-gfortran-4.8.2/lib
CPATH=/nix/var/nix/profiles/default/guix-profile/include
PATH=/nix/var/nix/profiles/default/guix-profile/bin:$PATH

May I push this patch to ‘master’?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-gnu-Add-GCC-front-ends-for-Fortran-Go-Objective-C-an.patch --]
[-- Type: text/x-diff, Size: 2204 bytes --]

From be260e7d9d4a7592129c0369eee52b156170d1cf Mon Sep 17 00:00:00 2001
From: Nikita Karetnikov <nikita@karetnikov.org>
Date: Thu, 31 Oct 2013 19:54:36 +0000
Subject: [PATCH] gnu: Add GCC front ends for Fortran, Go, Objective C, and
 Objective C++.

* gnu/packages/gcc.scm (custom-gcc, gfortran-4.8, gccgo-4.8)
  (gcc-objc-4.8, gcc-objc++-4.8): New variables.
---
 gnu/packages/gcc.scm |   29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm
index dde0f0d..60bc5bb 100644
--- a/gnu/packages/gcc.scm
+++ b/gnu/packages/gcc.scm
@@ -27,6 +27,7 @@
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix build-system gnu)
+  #:use-module (guix utils)
   #:use-module (ice-9 regex))
 
 (define %gcc-infrastructure
@@ -211,6 +212,34 @@ Go.  It also includes standard libraries for these languages.")
               (base32
                "1j6dwgby4g3p3lz7zkss32ghr45zpdidrg8xvazvn91lqxv25p09"))))))
 
+(define (custom-gcc gcc name languages)
+  (package (inherit gcc)
+    (name name)
+    (arguments
+     (substitute-keyword-arguments `(#:modules ((guix build gnu-build-system)
+                                                (guix build utils)
+                                                (ice-9 regex)
+                                                (srfi srfi-1)
+                                                (srfi srfi-26))
+                                               ,@(package-arguments gcc))
+       ((#:configure-flags flags)
+        `(cons (string-append "--enable-languages="
+                              ,(string-join languages ","))
+               (remove (cut string-match "--enable-languages.*" <>)
+                       ,flags)))))))
+
+(define-public gfortran-4.8
+  (custom-gcc gcc-4.8 "gfortran" '("fortran")))
+
+(define-public gccgo-4.8
+  (custom-gcc gcc-4.8 "gccgo" '("go")))
+
+(define-public gcc-objc-4.8
+  (custom-gcc gcc-4.8 "gcc-objc" '("objc")))
+
+(define-public gcc-objc++-4.8
+  (custom-gcc gcc-4.8 "gcc-objc++" '("obj-c++")))
+
 (define-public isl
   (package
     (name "isl")
-- 
1.7.9.5


[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

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

* Re: [PATCH] gnu: Add GCC front ends for Fortran, Go, Objective C, and Objective C++.
  2013-10-31 20:13           ` [PATCH] gnu: Add GCC front ends for Fortran, Go, Objective C, and Objective C++ Nikita Karetnikov
@ 2013-10-31 22:19             ` Ludovic Courtès
  2013-11-01 21:00               ` Nikita Karetnikov
  0 siblings, 1 reply; 17+ messages in thread
From: Ludovic Courtès @ 2013-10-31 22:19 UTC (permalink / raw)
  To: Nikita Karetnikov; +Cc: guix-devel

Nikita Karetnikov <nikita@karetnikov.org> skribis:

>>> If you want to test any of the front-ends, don’t forget to set
>>> LIBRARY_PATH and LD_LIBRARY_PATH, like so:
>>>
>>> $ export LIBRARY_PATH=/nix/store/wmaxqx3p658v2yqjv00mss2shvn23h7a-glibc-2.18/lib
>>> $ export LD_LIBRARY_PATH=/nix/store/kvhg0fszagsx5y80sq79bkmb7yqvjfmd-gcc-go-4.8.1/lib
>
>> I guess that’s unnecessary when using ‘ld-wrapper’.
>
> I know nothing about it.  Could you elaborate?

‘ld-wrapper’ is a wrapper around the linker that adds a -rpath argument
for each -l argument (see the top of ld-wrapper.scm), such that all the
needed libraries are in the resulting binary’s RUNPATH.

> I tested each front end using the “hello, world” program.  Is it enough?

Yes.

> From be260e7d9d4a7592129c0369eee52b156170d1cf Mon Sep 17 00:00:00 2001
> From: Nikita Karetnikov <nikita@karetnikov.org>
> Date: Thu, 31 Oct 2013 19:54:36 +0000
> Subject: [PATCH] gnu: Add GCC front ends for Fortran, Go, Objective C, and
>  Objective C++.
>
> * gnu/packages/gcc.scm (custom-gcc, gfortran-4.8, gccgo-4.8)
>   (gcc-objc-4.8, gcc-objc++-4.8): New variables.
> ---
>  gnu/packages/gcc.scm |   29 +++++++++++++++++++++++++++++
>  1 file changed, 29 insertions(+)
>
> diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm
> index dde0f0d..60bc5bb 100644
> --- a/gnu/packages/gcc.scm
> +++ b/gnu/packages/gcc.scm
> @@ -27,6 +27,7 @@
>    #:use-module (guix packages)
>    #:use-module (guix download)
>    #:use-module (guix build-system gnu)
> +  #:use-module (guix utils)
>    #:use-module (ice-9 regex))
>  
>  (define %gcc-infrastructure
> @@ -211,6 +212,34 @@ Go.  It also includes standard libraries for these languages.")
>                (base32
>                 "1j6dwgby4g3p3lz7zkss32ghr45zpdidrg8xvazvn91lqxv25p09"))))))
>  
> +(define (custom-gcc gcc name languages)

Please add a docstring here, and then OK to push.

Thank you!

Ludo’.

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

* Re: [PATCH] gnu: Add GCC front ends for Fortran, Go, Objective C, and Objective C++.
  2013-10-31 22:19             ` Ludovic Courtès
@ 2013-11-01 21:00               ` Nikita Karetnikov
  2013-11-01 22:41                 ` Ludovic Courtès
  0 siblings, 1 reply; 17+ messages in thread
From: Nikita Karetnikov @ 2013-11-01 21:00 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 387 bytes --]

> ‘ld-wrapper’ is a wrapper around the linker that adds a -rpath argument
> for each -l argument (see the top of ld-wrapper.scm), such that all the
> needed libraries are in the resulting binary’s RUNPATH.

Could you show how it helps to avoid the need to set environment
variables?

> Please add a docstring here, and then OK to push.

I’ve just pushed.  Please test.

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

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

* Re: [PATCH] gnu: Add GCC front ends for Fortran, Go, Objective C, and Objective C++.
  2013-11-01 21:00               ` Nikita Karetnikov
@ 2013-11-01 22:41                 ` Ludovic Courtès
  0 siblings, 0 replies; 17+ messages in thread
From: Ludovic Courtès @ 2013-11-01 22:41 UTC (permalink / raw)
  To: Nikita Karetnikov; +Cc: guix-devel

Nikita Karetnikov <nikita@karetnikov.org> skribis:

>> ‘ld-wrapper’ is a wrapper around the linker that adds a -rpath argument
>> for each -l argument (see the top of ld-wrapper.scm), such that all the
>> needed libraries are in the resulting binary’s RUNPATH.
>
> Could you show how it helps to avoid the need to set environment
> variables?

In the general case, you wouldn’t want to type:

  export LD_LIBRARY_PATH=/nix/store/foo:/nix/store/bar:...

More importantly, you could easily get it wrong, leading to crashes or
random behavior.

Setting RUNPATH at build time allows us to live our computing life in
peace and harmony.

HTH.  :-)

Ludo’.

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

end of thread, other threads:[~2013-11-01 22:41 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-15  2:59 GFortran can’t find system headers Nikita Karetnikov
2013-10-15 20:17 ` Ludovic Courtès
2013-10-17 12:59   ` Nikita Karetnikov
2013-10-17 15:29     ` Ludovic Courtès
2013-10-19  8:58       ` GCC front-ends (was: GFortran can’t find system headers) Nikita Karetnikov
2013-10-26 20:08         ` GCC front-ends Ludovic Courtès
2013-10-27 10:39           ` Andreas Enge
2013-10-28 13:07             ` Ludovic Courtès
2013-10-29  8:39               ` Andreas Enge
2013-10-29 10:32                 ` Ludovic Courtès
2013-10-28 23:23           ` Nikita Karetnikov
2013-10-28 23:23             ` Ludovic Courtès
2013-10-28 23:38               ` Nikita Karetnikov
2013-10-31 20:13           ` [PATCH] gnu: Add GCC front ends for Fortran, Go, Objective C, and Objective C++ Nikita Karetnikov
2013-10-31 22:19             ` Ludovic Courtès
2013-11-01 21:00               ` Nikita Karetnikov
2013-11-01 22:41                 ` Ludovic Courtès

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