unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* collect2: fatal error: cannot find 'ld'
@ 2019-02-09 12:38 znavko
  2019-02-09 14:35 ` Ricardo Wurmus
  0 siblings, 1 reply; 14+ messages in thread
From: znavko @ 2019-02-09 12:38 UTC (permalink / raw)
  To: Help Guix

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

Hi! I compile this https://stackoverflow.com/questions/6161823/dd-how-to-calculate-optimal-blocksize <https://stackoverflow.com/questions/6161823/dd-how-to-calculate-optimal-blocksize>

and get this:

$ gcc c.c
collect2: fatal error: cannot find 'ld'
compilation terminated.

$ whereis ld
ld:

$ gcc --version
gcc (GCC) 8.2.0

How to solve this?

[-- Attachment #2: Type: text/html, Size: 992 bytes --]

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

* Re: collect2: fatal error: cannot find 'ld'
  2019-02-09 12:38 collect2: fatal error: cannot find 'ld' znavko
@ 2019-02-09 14:35 ` Ricardo Wurmus
  2019-02-09 15:50   ` vikram sai balaji ulaganathan
                     ` (3 more replies)
  0 siblings, 4 replies; 14+ messages in thread
From: Ricardo Wurmus @ 2019-02-09 14:35 UTC (permalink / raw)
  To: znavko; +Cc: Help Guix


znavko@tutanota.com writes:

> Hi! I compile this https://stackoverflow.com/questions/6161823/dd-how-to-calculate-optimal-blocksize <https://stackoverflow.com/questions/6161823/dd-how-to-calculate-optimal-blocksize>
>
> and get this:
>
> $ gcc c.c
> collect2: fatal error: cannot find 'ld'
> compilation terminated.
>
> $ whereis ld
> ld:
>
> $ gcc --version
> gcc (GCC) 8.2.0
>
> How to solve this?

I’m assuming that you installed the “gcc” package.  Don’t do that.
Install “gcc-toolchain” instead.

   guix package -r gcc -i gcc-toolchain

-- 
Ricardo

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

* Re: collect2: fatal error: cannot find 'ld'
  2019-02-09 14:35 ` Ricardo Wurmus
@ 2019-02-09 15:50   ` vikram sai balaji ulaganathan
  2019-02-10 10:28   ` znavko
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 14+ messages in thread
From: vikram sai balaji ulaganathan @ 2019-02-09 15:50 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: help-guix

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

I am using Gentoo and I am seeing this over there as well. Upon researching
if the program uses sed to perform any substitution, there could be an
issue. Thanks

On Sat, Feb 9, 2019, 10:21 AM Ricardo Wurmus <rekado@elephly.net wrote:

>
> znavko@tutanota.com writes:
>
> > Hi! I compile this
> https://stackoverflow.com/questions/6161823/dd-how-to-calculate-optimal-blocksize
> <
> https://stackoverflow.com/questions/6161823/dd-how-to-calculate-optimal-blocksize
> >
> >
> > and get this:
> >
> > $ gcc c.c
> > collect2: fatal error: cannot find 'ld'
> > compilation terminated.
> >
> > $ whereis ld
> > ld:
> >
> > $ gcc --version
> > gcc (GCC) 8.2.0
> >
> > How to solve this?
>
> I’m assuming that you installed the “gcc” package.  Don’t do that.
> Install “gcc-toolchain” instead.
>
>    guix package -r gcc -i gcc-toolchain
>
> --
> Ricardo
>
>
>

[-- Attachment #2: Type: text/html, Size: 1599 bytes --]

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

* Re: collect2: fatal error: cannot find 'ld'
  2019-02-09 14:35 ` Ricardo Wurmus
  2019-02-09 15:50   ` vikram sai balaji ulaganathan
@ 2019-02-10 10:28   ` znavko
       [not found]   ` <<87wom9kp1q.fsf@elephly.net>
  2019-02-11 11:40   ` zimoun
  3 siblings, 0 replies; 14+ messages in thread
From: znavko @ 2019-02-10 10:28 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: Help Guix

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

Installation of gcc-toolchain did not help.

$ guix package -I |grep gcc
gcc-toolchain    8.2.0    out    /gnu/store/xwk99qi92pm3zqd95mvjx4mkdmg8plpk-gcc-toolchain-8.2.0

$ gcc c
c: file not recognized: file format not recognized
collect2: error: ld returned 1 exit status

$ cat c
#include <sys/stat.h>
#include <stdio.h>

int main(void)
{
    struct stat stats;

    if (!stat("/", &stats))
    {
        printf("%u\n", stats.st_blksize);
    }
}



Feb 9, 2019, 2:35 PM by rekado@elephly.net <mailto:rekado@elephly.net>:

>
> znavko@tutanota.com <mailto:znavko@tutanota.com>>  writes:
>
>> Hi! I compile this >> https://stackoverflow.com/questions/6161823/dd-how-to-calculate-optimal-blocksize <https://stackoverflow.com/questions/6161823/dd-how-to-calculate-optimal-blocksize>>>  <>> https://stackoverflow.com/questions/6161823/dd-how-to-calculate-optimal-blocksize <https://stackoverflow.com/questions/6161823/dd-how-to-calculate-optimal-blocksize>>> >
>>
>> and get this:
>>
>> $ gcc c.c
>> collect2: fatal error: cannot find 'ld'
>> compilation terminated.
>>
>> $ whereis ld
>> ld:
>>
>> $ gcc --version
>> gcc (GCC) 8.2.0
>>
>> How to solve this?
>>
>
> I’m assuming that you installed the “gcc” package.  Don’t do that.
> Install “gcc-toolchain” instead.
>
>  guix package -r gcc -i gcc-toolchain
>
> -- 
> Ricardo
>


[-- Attachment #2: Type: text/html, Size: 3255 bytes --]

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

* Re: collect2: fatal error: cannot find 'ld'
       [not found]     ` <LYLwvzs--3-1@tutanota.com-LYLwzou----1>
@ 2019-02-10 10:45       ` znavko
  0 siblings, 0 replies; 14+ messages in thread
From: znavko @ 2019-02-10 10:45 UTC (permalink / raw)
  To: Znavko; +Cc: Help Guix

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

Sorry. The file extension was the solution:

$ mv c c.c
$ gcc c.c
$ ./a.out
4096




Feb 10, 2019, 10:28 AM by znavko@tutanota.com:

> Installation of gcc-toolchain did not help.
>
> $ guix package -I |grep gcc
> gcc-toolchain    8.2.0    out    /gnu/store/xwk99qi92pm3zqd95mvjx4mkdmg8plpk-gcc-toolchain-8.2.0
>
> $ gcc c
> c: file not recognized: file format not recognized
> collect2: error: ld returned 1 exit status
>
> $ cat c
> #include <sys/stat.h>
> #include <stdio.h>
>
> int main(void)
> {
>     struct stat stats;
>
>     if (!stat("/", &stats))
>     {
>         printf("%u\n", stats.st_blksize);
>     }
> }
>
>
>
> Feb 9, 2019, 2:35 PM by > rekado@elephly.net <mailto:rekado@elephly.net>> :
>
>>
>> znavko@tutanota.com <mailto:znavko@tutanota.com>>>  writes:
>>
>>> Hi! I compile this >>> https://stackoverflow.com/questions/6161823/dd-how-to-calculate-optimal-blocksize <https://stackoverflow.com/questions/6161823/dd-how-to-calculate-optimal-blocksize>>>>  <>>> https://stackoverflow.com/questions/6161823/dd-how-to-calculate-optimal-blocksize <https://stackoverflow.com/questions/6161823/dd-how-to-calculate-optimal-blocksize>>>> >
>>>
>>> and get this:
>>>
>>> $ gcc c.c
>>> collect2: fatal error: cannot find 'ld'
>>> compilation terminated.
>>>
>>> $ whereis ld
>>> ld:
>>>
>>> $ gcc --version
>>> gcc (GCC) 8.2.0
>>>
>>> How to solve this?
>>>
>>
>> I’m assuming that you installed the “gcc” package.  Don’t do that.
>> Install “gcc-toolchain” instead.
>>
>> guix package -r gcc -i gcc-toolchain
>>
>> -- 
>> Ricardo
>>
>
>


[-- Attachment #2: Type: text/html, Size: 4455 bytes --]

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

* Re: collect2: fatal error: cannot find 'ld'
  2019-02-09 14:35 ` Ricardo Wurmus
                     ` (2 preceding siblings ...)
       [not found]   ` <<87wom9kp1q.fsf@elephly.net>
@ 2019-02-11 11:40   ` zimoun
  2019-02-11 12:01     ` Ricardo Wurmus
  3 siblings, 1 reply; 14+ messages in thread
From: zimoun @ 2019-02-11 11:40 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: Help Guix

Hi Ricardo,

On Sat, 9 Feb 2019 at 16:21, Ricardo Wurmus <rekado@elephly.net> wrote:
>
> I’m assuming that you installed the “gcc” package.  Don’t do that.
> Install “gcc-toolchain” instead.

Is it because of the comment in the definition of `make-gcc-toolchain'?

;; The main raison d'être of this "meta-package" is (1) to
conveniently
;; install everything that we need, and (2) to make sure ld-wrapper comes
;; before Binutils' ld in the user's profile.

Even if the section of Manual provides useful information, the (2)
point clearly explains why "what you really want is the
`gcc-toolchain' package." :-)


All the best,
simon

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

* Re: collect2: fatal error: cannot find 'ld'
  2019-02-11 11:40   ` zimoun
@ 2019-02-11 12:01     ` Ricardo Wurmus
  2019-02-11 12:07       ` zimoun
  2019-02-12 16:44       ` Ludovic Courtès
  0 siblings, 2 replies; 14+ messages in thread
From: Ricardo Wurmus @ 2019-02-11 12:01 UTC (permalink / raw)
  To: zimoun; +Cc: Help Guix


zimoun <zimon.toutoune@gmail.com> writes:

> Hi Ricardo,
>
> On Sat, 9 Feb 2019 at 16:21, Ricardo Wurmus <rekado@elephly.net> wrote:
>>
>> I’m assuming that you installed the “gcc” package.  Don’t do that.
>> Install “gcc-toolchain” instead.
>
> Is it because of the comment in the definition of `make-gcc-toolchain'?
>
> ;; The main raison d'être of this "meta-package" is (1) to
> conveniently
> ;; install everything that we need, and (2) to make sure ld-wrapper comes
> ;; before Binutils' ld in the user's profile.
>
> Even if the section of Manual provides useful information, the (2)
> point clearly explains why "what you really want is the
> `gcc-toolchain' package." :-)

Yes, this is the reason.

I still think that we should hide the plain gcc packages on the command
line.

--
Ricardo

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

* Re: collect2: fatal error: cannot find 'ld'
  2019-02-11 12:01     ` Ricardo Wurmus
@ 2019-02-11 12:07       ` zimoun
  2019-02-12 16:44       ` Ludovic Courtès
  1 sibling, 0 replies; 14+ messages in thread
From: zimoun @ 2019-02-11 12:07 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: Help Guix

> I still think that we should hide the plain gcc packages on the command
> line.

I agree.

I also fell in the trap. :-)
Installed gcc+binutils+etc. instead of gcc-toolchain and then weird
linking issue.

Thank you for your confirmation.

All the best,
simon

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

* Re: collect2: fatal error: cannot find 'ld'
  2019-02-11 12:01     ` Ricardo Wurmus
  2019-02-11 12:07       ` zimoun
@ 2019-02-12 16:44       ` Ludovic Courtès
  2019-02-12 22:23         ` Ricardo Wurmus
  1 sibling, 1 reply; 14+ messages in thread
From: Ludovic Courtès @ 2019-02-12 16:44 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: Help Guix

Ricardo Wurmus <rekado@elephly.net> skribis:

> I still think that we should hide the plain gcc packages on the command
> line.

Agreed.

Ludo’.

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

* Re: collect2: fatal error: cannot find 'ld'
  2019-02-12 16:44       ` Ludovic Courtès
@ 2019-02-12 22:23         ` Ricardo Wurmus
  2019-02-22 15:51           ` zimoun
  2019-03-11 15:53           ` Ludovic Courtès
  0 siblings, 2 replies; 14+ messages in thread
From: Ricardo Wurmus @ 2019-02-12 22:23 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: Help Guix

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


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

> Ricardo Wurmus <rekado@elephly.net> skribis:
>
>> I still think that we should hide the plain gcc packages on the command
>> line.
>
> Agreed.

Is this the right way to hide the package (see patch)?  I searched for
GCC on the command line with “guix package --search=gcc” and the results
did not include the plain gcc packages.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-gcc-4.7-Hide-package.patch --]
[-- Type: text/x-patch, Size: 22766 bytes --]

From 8cbb0b446930264b7f2a771cc95534e14dde9edd Mon Sep 17 00:00:00 2001
From: Ricardo Wurmus <rekado@elephly.net>
Date: Tue, 12 Feb 2019 23:21:48 +0100
Subject: [PATCH] gnu: gcc-4.7: Hide package.

* gnu/packages/gcc.scm (gcc-4.7): Wrap in "hidden-package" expression.
---
 gnu/packages/gcc.scm | 409 ++++++++++++++++++++++---------------------
 1 file changed, 205 insertions(+), 204 deletions(-)

diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm
index 1f1e80dde..7f6000f03 100644
--- a/gnu/packages/gcc.scm
+++ b/gnu/packages/gcc.scm
@@ -139,220 +139,221 @@ where the OS part is overloaded to denote a specific ABI---into GCC
                      (gcc-configure-flags-for-triplet triplet))
 
                    (maybe-target-tools))))))
-    (package
-      (name "gcc")
-      (version "4.7.4")
-      (source (origin
-               (method url-fetch)
-               (uri (string-append "mirror://gnu/gcc/gcc-"
-                                   version "/gcc-" version ".tar.bz2"))
-               (sha256
-                (base32
-                 "10k2k71kxgay283ylbbhhs51cl55zn2q38vj5pk4k950qdnirrlj"))
-               (patches (search-patches "gcc-4-compile-with-gcc-5.patch"
-                                        "gcc-fix-texi2pod.patch"))))
-      (build-system gnu-build-system)
-
-      ;; Separate out the run-time support libraries because all the
-      ;; dynamic-linked objects depend on it.
-      (outputs '("out"                    ;commands, etc. (60+ MiB)
-                 "lib"                    ;libgcc_s, libgomp, etc. (15+ MiB)
-                 "debug"))                ;debug symbols of run-time libraries
-
-      (inputs `(("gmp" ,gmp)
-                ("mpfr" ,mpfr)
-                ("mpc" ,mpc)
-                ("libelf" ,libelf)
-                ("zlib" ,zlib)))
-
-      ;; GCC < 5 is one of the few packages that doesn't ship .info files.
-      ;; Newer texinfos fail to build the manual, so we use an older one.
-      (native-inputs `(("perl" ,perl)   ;for manpages
-                       ("texinfo" ,texinfo-5)))
-
-      (arguments
-       `(#:out-of-source? #t
-         #:configure-flags ,(configure-flags)
-         #:make-flags
-         ;; None of the flags below are needed when doing a Canadian cross.
-         ;; TODO: Simplify this.
-         ,(if (%current-target-system)
-              (if stripped?
-                  ''("CFLAGS=-g0 -O2")
-                  ''())
-              `(let* ((libc        (assoc-ref %build-inputs "libc"))
-                      (libc-native (or (assoc-ref %build-inputs "libc-native")
-                                       libc)))
-                 `(,@(if libc
-                         (list (string-append "LDFLAGS_FOR_TARGET="
-                                              "-B" libc "/lib "
-                                              "-Wl,-dynamic-linker "
-                                              "-Wl," libc
-                                              ,(glibc-dynamic-linker)))
-                         '())
-
-                   ;; Native programs like 'genhooks' also need that right.
-                   ,(string-append "LDFLAGS="
-                                   "-Wl,-rpath=" libc-native "/lib "
-                                   "-Wl,-dynamic-linker "
-                                   "-Wl," libc-native ,(glibc-dynamic-linker))
-                   ,(string-append "BOOT_CFLAGS=-O2 "
-                                   ,(if stripped? "-g0" "-g")))))
-
-         #:tests? #f
-
-         #:phases
-         (modify-phases %standard-phases
-           (add-before 'configure 'pre-configure
-             (lambda* (#:key inputs outputs #:allow-other-keys)
-               (let ((libdir ,(libdir))
-                     (libc   (assoc-ref inputs "libc")))
-                 (when libc
-                       ;; The following is not performed for `--without-headers'
-                       ;; cross-compiler builds.
-
-                       ;; Join multi-line definitions of GLIBC_DYNAMIC_LINKER* into a
-                       ;; single line, to allow the next step to work properly.
-                       (for-each
-                        (lambda (x)
-                          (substitute* (find-files "gcc/config"
-                                                   "^(linux|gnu|sysv4)(64|-elf|-eabi)?\\.h$")
-                            (("(#define (GLIBC|GNU_USER)_DYNAMIC_LINKER.*)\\\\\n$" _ line)
-                             line)))
-                        '(1 2 3))
-
-                       ;; Fix the dynamic linker's file name.
+    (hidden-package
+     (package
+       (name "gcc")
+       (version "4.7.4")
+       (source (origin
+                 (method url-fetch)
+                 (uri (string-append "mirror://gnu/gcc/gcc-"
+                                     version "/gcc-" version ".tar.bz2"))
+                 (sha256
+                  (base32
+                   "10k2k71kxgay283ylbbhhs51cl55zn2q38vj5pk4k950qdnirrlj"))
+                 (patches (search-patches "gcc-4-compile-with-gcc-5.patch"
+                                          "gcc-fix-texi2pod.patch"))))
+       (build-system gnu-build-system)
+
+       ;; Separate out the run-time support libraries because all the
+       ;; dynamic-linked objects depend on it.
+       (outputs '("out"                    ;commands, etc. (60+ MiB)
+                  "lib"                    ;libgcc_s, libgomp, etc. (15+ MiB)
+                  "debug"))                ;debug symbols of run-time libraries
+
+       (inputs `(("gmp" ,gmp)
+                 ("mpfr" ,mpfr)
+                 ("mpc" ,mpc)
+                 ("libelf" ,libelf)
+                 ("zlib" ,zlib)))
+
+       ;; GCC < 5 is one of the few packages that doesn't ship .info files.
+       ;; Newer texinfos fail to build the manual, so we use an older one.
+       (native-inputs `(("perl" ,perl)   ;for manpages
+                        ("texinfo" ,texinfo-5)))
+
+       (arguments
+        `(#:out-of-source? #t
+          #:configure-flags ,(configure-flags)
+          #:make-flags
+          ;; None of the flags below are needed when doing a Canadian cross.
+          ;; TODO: Simplify this.
+          ,(if (%current-target-system)
+               (if stripped?
+                   ''("CFLAGS=-g0 -O2")
+                   ''())
+               `(let* ((libc        (assoc-ref %build-inputs "libc"))
+                       (libc-native (or (assoc-ref %build-inputs "libc-native")
+                                        libc)))
+                  `(,@(if libc
+                          (list (string-append "LDFLAGS_FOR_TARGET="
+                                               "-B" libc "/lib "
+                                               "-Wl,-dynamic-linker "
+                                               "-Wl," libc
+                                               ,(glibc-dynamic-linker)))
+                          '())
+
+                    ;; Native programs like 'genhooks' also need that right.
+                    ,(string-append "LDFLAGS="
+                                    "-Wl,-rpath=" libc-native "/lib "
+                                    "-Wl,-dynamic-linker "
+                                    "-Wl," libc-native ,(glibc-dynamic-linker))
+                    ,(string-append "BOOT_CFLAGS=-O2 "
+                                    ,(if stripped? "-g0" "-g")))))
+
+          #:tests? #f
+
+          #:phases
+          (modify-phases %standard-phases
+            (add-before 'configure 'pre-configure
+              (lambda* (#:key inputs outputs #:allow-other-keys)
+                (let ((libdir ,(libdir))
+                      (libc   (assoc-ref inputs "libc")))
+                  (when libc
+                    ;; The following is not performed for `--without-headers'
+                    ;; cross-compiler builds.
+
+                    ;; Join multi-line definitions of GLIBC_DYNAMIC_LINKER* into a
+                    ;; single line, to allow the next step to work properly.
+                    (for-each
+                     (lambda (x)
                        (substitute* (find-files "gcc/config"
                                                 "^(linux|gnu|sysv4)(64|-elf|-eabi)?\\.h$")
-                         (("#define (GLIBC|GNU_USER)_DYNAMIC_LINKER([^ \t]*).*$"
-                           _ gnu-user suffix)
-                          (format #f "#define ~a_DYNAMIC_LINKER~a \"~a\"~%"
-                                  gnu-user suffix
-                                  (string-append libc ,(glibc-dynamic-linker)))))
-
-                       ;; Tell where to find libstdc++, libc, and `?crt*.o', except
-                       ;; `crt{begin,end}.o', which come with GCC.
-                       (substitute* (find-files "gcc/config"
-                                                "^gnu-user.*\\.h$")
-                         (("#define GNU_USER_TARGET_LIB_SPEC (.*)$" _ suffix)
-                          ;; Help libgcc_s.so be found (see also below.)  Always use
-                          ;; '-lgcc_s' so that libgcc_s.so is always found by those
-                          ;; programs that use 'pthread_cancel' (glibc dlopens
-                          ;; libgcc_s.so when pthread_cancel support is needed, but
-                          ;; having it in the application's RUNPATH isn't enough; see
-                          ;; <http://sourceware.org/ml/libc-help/2013-11/msg00023.html>.)
-                          ;;
-                          ;; NOTE: The '-lgcc_s' added below needs to be removed in a
-                          ;; later phase of %gcc-static.  If you change the string
-                          ;; below, make sure to update the relevant code in
-                          ;; %gcc-static package as needed.
-                          (format #f "#define GNU_USER_TARGET_LIB_SPEC \
+                         (("(#define (GLIBC|GNU_USER)_DYNAMIC_LINKER.*)\\\\\n$" _ line)
+                          line)))
+                     '(1 2 3))
+
+                    ;; Fix the dynamic linker's file name.
+                    (substitute* (find-files "gcc/config"
+                                             "^(linux|gnu|sysv4)(64|-elf|-eabi)?\\.h$")
+                      (("#define (GLIBC|GNU_USER)_DYNAMIC_LINKER([^ \t]*).*$"
+                        _ gnu-user suffix)
+                       (format #f "#define ~a_DYNAMIC_LINKER~a \"~a\"~%"
+                               gnu-user suffix
+                               (string-append libc ,(glibc-dynamic-linker)))))
+
+                    ;; Tell where to find libstdc++, libc, and `?crt*.o', except
+                    ;; `crt{begin,end}.o', which come with GCC.
+                    (substitute* (find-files "gcc/config"
+                                             "^gnu-user.*\\.h$")
+                      (("#define GNU_USER_TARGET_LIB_SPEC (.*)$" _ suffix)
+                       ;; Help libgcc_s.so be found (see also below.)  Always use
+                       ;; '-lgcc_s' so that libgcc_s.so is always found by those
+                       ;; programs that use 'pthread_cancel' (glibc dlopens
+                       ;; libgcc_s.so when pthread_cancel support is needed, but
+                       ;; having it in the application's RUNPATH isn't enough; see
+                       ;; <http://sourceware.org/ml/libc-help/2013-11/msg00023.html>.)
+                       ;;
+                       ;; NOTE: The '-lgcc_s' added below needs to be removed in a
+                       ;; later phase of %gcc-static.  If you change the string
+                       ;; below, make sure to update the relevant code in
+                       ;; %gcc-static package as needed.
+                       (format #f "#define GNU_USER_TARGET_LIB_SPEC \
 \"-L~a/lib %{!static:-rpath=~a/lib %{!static-libgcc:-rpath=~a/lib -lgcc_s}} \" ~a"
-                                  libc libc libdir suffix))
-                         (("#define GNU_USER_TARGET_STARTFILE_SPEC.*$" line)
-                          (format #f "#define STANDARD_STARTFILE_PREFIX_1 \"~a/lib\"
+                               libc libc libdir suffix))
+                      (("#define GNU_USER_TARGET_STARTFILE_SPEC.*$" line)
+                       (format #f "#define STANDARD_STARTFILE_PREFIX_1 \"~a/lib\"
 #define STANDARD_STARTFILE_PREFIX_2 \"\"
 ~a"
-                                  libc line)))
-
-                       ;; The rs6000 (a.k.a. powerpc) config in GCC does not use
-                       ;; GNU_USER_* defines.  Do the above for this case.
-                       (substitute*
-                           "gcc/config/rs6000/sysv4.h"
-                         (("#define LIB_LINUX_SPEC (.*)$" _ suffix)
-                          (format #f "#define LIB_LINUX_SPEC \
+                               libc line)))
+
+                    ;; The rs6000 (a.k.a. powerpc) config in GCC does not use
+                    ;; GNU_USER_* defines.  Do the above for this case.
+                    (substitute*
+                        "gcc/config/rs6000/sysv4.h"
+                      (("#define LIB_LINUX_SPEC (.*)$" _ suffix)
+                       (format #f "#define LIB_LINUX_SPEC \
 \"-L~a/lib %{!static:-rpath=~a/lib %{!static-libgcc:-rpath=~a/lib -lgcc_s}} \" ~a"
-                                  libc libc libdir suffix))
-                         (("#define	STARTFILE_LINUX_SPEC.*$" line)
-                          (format #f "#define STANDARD_STARTFILE_PREFIX_1 \"~a/lib\"
+                               libc libc libdir suffix))
+                      (("#define	STARTFILE_LINUX_SPEC.*$" line)
+                       (format #f "#define STANDARD_STARTFILE_PREFIX_1 \"~a/lib\"
 #define STANDARD_STARTFILE_PREFIX_2 \"\"
 ~a"
-                                  libc line))))
-
-                 ;; Don't retain a dependency on the build-time sed.
-                 (substitute* "fixincludes/fixincl.x"
-                   (("static char const sed_cmd_z\\[\\] =.*;")
-                    "static char const sed_cmd_z[] = \"sed\";"))
-
-                 ;; Aarch64 support didn't land in GCC until the 4.8 series.
-                 (when (file-exists? "gcc/config/aarch64")
-                       ;; Force Aarch64 libdir to be /lib and not /lib64
-                       (substitute* "gcc/config/aarch64/t-aarch64-linux"
-                         (("lib64") "lib")))
-
-                 (when (file-exists? "libbacktrace")
-                       ;; GCC 4.8+ comes with libbacktrace.  By default it builds
-                       ;; with -Werror, which fails with a -Wcast-qual error in glibc
-                       ;; 2.21's stdlib-bsearch.h.  Remove -Werror.
-                       (substitute* "libbacktrace/configure"
-                         (("WARN_FLAGS=(.*)-Werror" _ flags)
-                          (string-append "WARN_FLAGS=" flags)))
-
-                       (when (file-exists? "libsanitizer/libbacktrace")
-                             ;; Same in libsanitizer's bundled copy (!) found in 4.9+.
-                             (substitute* "libsanitizer/libbacktrace/Makefile.in"
-                               (("-Werror")
-                                ""))))
-
-                 ;; Add a RUNPATH to libstdc++.so so that it finds libgcc_s.
-                 ;; See <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=32354>
-                 ;; and <http://bugs.gnu.org/20358>.
-                 (substitute* "libstdc++-v3/src/Makefile.in"
-                   (("^OPT_LDFLAGS = ")
-                    "OPT_LDFLAGS = -Wl,-rpath=$(libdir) "))
-
-                 ;; Move libstdc++*-gdb.py to the "lib" output to avoid a
-                 ;; circularity between "out" and "lib".  (Note:
-                 ;; --with-python-dir is useless because it imposes $(prefix) as
-                 ;; the parent directory.)
-                 (substitute* "libstdc++-v3/python/Makefile.in"
-                   (("pythondir = .*$")
-                    (string-append "pythondir = " libdir "/share"
-                                   "/gcc-$(gcc_version)/python\n")))
-
-                 ;; Avoid another circularity between the outputs: this #define
-                 ;; ends up in auto-host.h in the "lib" output, referring to
-                 ;; "out".  (This variable is used to augment cpp's search path,
-                 ;; but there's nothing useful to look for here.)
-                 (substitute* "gcc/config.in"
-                   (("PREFIX_INCLUDE_DIR")
-                    "PREFIX_INCLUDE_DIR_isnt_necessary_here"))
-                 #t)))
-
-           (add-after 'configure 'post-configure
-             (lambda _
-               ;; Don't store configure flags, to avoid retaining references to
-               ;; build-time dependencies---e.g., `--with-ppl=/gnu/store/xxx'.
-               (substitute* "Makefile"
-                 (("^TOPLEVEL_CONFIGURE_ARGUMENTS=(.*)$" _ rest)
-                  "TOPLEVEL_CONFIGURE_ARGUMENTS=\n"))
-               #t)))))
-
-      (native-search-paths
-       ;; Use the language-specific variables rather than 'CPATH' because they
-       ;; are equivalent to '-isystem' whereas 'CPATH' is equivalent to '-I'.
-       ;; The intent is to allow headers that are in the search path to be
-       ;; treated as "system headers" (headers exempt from warnings) just like
-       ;; the typical /usr/include headers on an FHS system.
-       (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")))))
-
-      (properties `((gcc-libc . ,(assoc-ref inputs "libc"))))
-      (synopsis "GNU Compiler Collection")
-      (description
-       "GCC is the GNU Compiler Collection.  It provides compiler front-ends
+                               libc line))))
+
+                  ;; Don't retain a dependency on the build-time sed.
+                  (substitute* "fixincludes/fixincl.x"
+                    (("static char const sed_cmd_z\\[\\] =.*;")
+                     "static char const sed_cmd_z[] = \"sed\";"))
+
+                  ;; Aarch64 support didn't land in GCC until the 4.8 series.
+                  (when (file-exists? "gcc/config/aarch64")
+                    ;; Force Aarch64 libdir to be /lib and not /lib64
+                    (substitute* "gcc/config/aarch64/t-aarch64-linux"
+                      (("lib64") "lib")))
+
+                  (when (file-exists? "libbacktrace")
+                    ;; GCC 4.8+ comes with libbacktrace.  By default it builds
+                    ;; with -Werror, which fails with a -Wcast-qual error in glibc
+                    ;; 2.21's stdlib-bsearch.h.  Remove -Werror.
+                    (substitute* "libbacktrace/configure"
+                      (("WARN_FLAGS=(.*)-Werror" _ flags)
+                       (string-append "WARN_FLAGS=" flags)))
+
+                    (when (file-exists? "libsanitizer/libbacktrace")
+                      ;; Same in libsanitizer's bundled copy (!) found in 4.9+.
+                      (substitute* "libsanitizer/libbacktrace/Makefile.in"
+                        (("-Werror")
+                         ""))))
+
+                  ;; Add a RUNPATH to libstdc++.so so that it finds libgcc_s.
+                  ;; See <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=32354>
+                  ;; and <http://bugs.gnu.org/20358>.
+                  (substitute* "libstdc++-v3/src/Makefile.in"
+                    (("^OPT_LDFLAGS = ")
+                     "OPT_LDFLAGS = -Wl,-rpath=$(libdir) "))
+
+                  ;; Move libstdc++*-gdb.py to the "lib" output to avoid a
+                  ;; circularity between "out" and "lib".  (Note:
+                  ;; --with-python-dir is useless because it imposes $(prefix) as
+                  ;; the parent directory.)
+                  (substitute* "libstdc++-v3/python/Makefile.in"
+                    (("pythondir = .*$")
+                     (string-append "pythondir = " libdir "/share"
+                                    "/gcc-$(gcc_version)/python\n")))
+
+                  ;; Avoid another circularity between the outputs: this #define
+                  ;; ends up in auto-host.h in the "lib" output, referring to
+                  ;; "out".  (This variable is used to augment cpp's search path,
+                  ;; but there's nothing useful to look for here.)
+                  (substitute* "gcc/config.in"
+                    (("PREFIX_INCLUDE_DIR")
+                     "PREFIX_INCLUDE_DIR_isnt_necessary_here"))
+                  #t)))
+
+            (add-after 'configure 'post-configure
+              (lambda _
+                ;; Don't store configure flags, to avoid retaining references to
+                ;; build-time dependencies---e.g., `--with-ppl=/gnu/store/xxx'.
+                (substitute* "Makefile"
+                  (("^TOPLEVEL_CONFIGURE_ARGUMENTS=(.*)$" _ rest)
+                   "TOPLEVEL_CONFIGURE_ARGUMENTS=\n"))
+                #t)))))
+
+       (native-search-paths
+        ;; Use the language-specific variables rather than 'CPATH' because they
+        ;; are equivalent to '-isystem' whereas 'CPATH' is equivalent to '-I'.
+        ;; The intent is to allow headers that are in the search path to be
+        ;; treated as "system headers" (headers exempt from warnings) just like
+        ;; the typical /usr/include headers on an FHS system.
+        (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")))))
+
+       (properties `((gcc-libc . ,(assoc-ref inputs "libc"))))
+       (synopsis "GNU Compiler Collection")
+       (description
+        "GCC is the GNU Compiler Collection.  It provides compiler front-ends
 for several languages, including C, C++, Objective-C, Fortran, Java, Ada, and
 Go.  It also includes runtime support libraries for these languages.")
-      (license gpl3+)
-      (supported-systems (delete "aarch64-linux" %supported-systems))
-      (home-page "https://gcc.gnu.org/"))))
+       (license gpl3+)
+       (supported-systems (delete "aarch64-linux" %supported-systems))
+       (home-page "https://gcc.gnu.org/")))))
 
 (define-public gcc-4.8
   (package (inherit gcc-4.7)
-- 
2.20.1


[-- Attachment #3: Type: text/plain, Size: 13 bytes --]


-- 
Ricardo

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

* Re: collect2: fatal error: cannot find 'ld'
  2019-02-12 22:23         ` Ricardo Wurmus
@ 2019-02-22 15:51           ` zimoun
  2019-02-22 15:55             ` Ricardo Wurmus
  2019-03-11 15:53           ` Ludovic Courtès
  1 sibling, 1 reply; 14+ messages in thread
From: zimoun @ 2019-02-22 15:51 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: Help Guix

Hi Ricardo,

On Tue, 12 Feb 2019 at 23:24, Ricardo Wurmus <rekado@elephly.net> wrote:

> Is this the right way to hide the package (see patch)?  I searched for
> GCC on the command line with “guix package --search=gcc” and the results
> did not include the plain gcc packages.

The `hidden-package` function, is it documented somewhere?
I mean more than the docstring in packages.scm. ;-)

Thank you in advance for any pointer.

All the best,
simon

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

* Re: collect2: fatal error: cannot find 'ld'
  2019-02-22 15:51           ` zimoun
@ 2019-02-22 15:55             ` Ricardo Wurmus
  0 siblings, 0 replies; 14+ messages in thread
From: Ricardo Wurmus @ 2019-02-22 15:55 UTC (permalink / raw)
  To: zimoun; +Cc: Help Guix


Hi Simon,

> On Tue, 12 Feb 2019 at 23:24, Ricardo Wurmus <rekado@elephly.net> wrote:
>
>> Is this the right way to hide the package (see patch)?  I searched for
>> GCC on the command line with “guix package --search=gcc” and the results
>> did not include the plain gcc packages.
>
> The `hidden-package` function, is it documented somewhere?
> I mean more than the docstring in packages.scm. ;-)

I don’t think it is documented elsewhere.  It’s purpose is to hide the
package from the command line interface.

-- 
Ricardo

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

* Re: collect2: fatal error: cannot find 'ld'
  2019-02-12 22:23         ` Ricardo Wurmus
  2019-02-22 15:51           ` zimoun
@ 2019-03-11 15:53           ` Ludovic Courtès
  2019-05-09 21:20             ` Ricardo Wurmus
  1 sibling, 1 reply; 14+ messages in thread
From: Ludovic Courtès @ 2019-03-11 15:53 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: Help Guix

Hello!

Ricardo Wurmus <rekado@elephly.net> skribis:

> Ludovic Courtès <ludo@gnu.org> writes:
>
>> Ricardo Wurmus <rekado@elephly.net> skribis:
>>
>>> I still think that we should hide the plain gcc packages on the command
>>> line.
>>
>> Agreed.
>
> Is this the right way to hide the package (see patch)?  I searched for
> GCC on the command line with “guix package --search=gcc” and the results
> did not include the plain gcc packages.

It still includes the ‘gcc-toolchain’ packages, right?

> From 8cbb0b446930264b7f2a771cc95534e14dde9edd Mon Sep 17 00:00:00 2001
> From: Ricardo Wurmus <rekado@elephly.net>
> Date: Tue, 12 Feb 2019 23:21:48 +0100
> Subject: [PATCH] gnu: gcc-4.7: Hide package.
>
> * gnu/packages/gcc.scm (gcc-4.7): Wrap in "hidden-package" expression.

Alternately you could simply add a ‘properties’ field (with a comment),
which would make the diff smaller.

Go for it!

Thanks,
Ludo’.

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

* Re: collect2: fatal error: cannot find 'ld'
  2019-03-11 15:53           ` Ludovic Courtès
@ 2019-05-09 21:20             ` Ricardo Wurmus
  0 siblings, 0 replies; 14+ messages in thread
From: Ricardo Wurmus @ 2019-05-09 21:20 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: Help Guix


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

> Hello!
>
> Ricardo Wurmus <rekado@elephly.net> skribis:
>
>> Ludovic Courtès <ludo@gnu.org> writes:
>>
>>> Ricardo Wurmus <rekado@elephly.net> skribis:
>>>
>>>> I still think that we should hide the plain gcc packages on the command
>>>> line.
>>>
>>> Agreed.
>>
>> Is this the right way to hide the package (see patch)?  I searched for
>> GCC on the command line with “guix package --search=gcc” and the results
>> did not include the plain gcc packages.
>
> It still includes the ‘gcc-toolchain’ packages, right?

Yes.

> Go for it!

Done!

-- 
Ricardo

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

end of thread, other threads:[~2019-05-09 21:20 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-09 12:38 collect2: fatal error: cannot find 'ld' znavko
2019-02-09 14:35 ` Ricardo Wurmus
2019-02-09 15:50   ` vikram sai balaji ulaganathan
2019-02-10 10:28   ` znavko
     [not found]   ` <<87wom9kp1q.fsf@elephly.net>
     [not found]     ` <LYLwvzs--3-1@tutanota.com-LYLwzou----1>
2019-02-10 10:45       ` znavko
2019-02-11 11:40   ` zimoun
2019-02-11 12:01     ` Ricardo Wurmus
2019-02-11 12:07       ` zimoun
2019-02-12 16:44       ` Ludovic Courtès
2019-02-12 22:23         ` Ricardo Wurmus
2019-02-22 15:51           ` zimoun
2019-02-22 15:55             ` Ricardo Wurmus
2019-03-11 15:53           ` Ludovic Courtès
2019-05-09 21:20             ` Ricardo Wurmus

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