Find the answer to your Linux question:
Results 1 to 9 of 9
Hey. I have a problem with compiling anything, ie "int main(void) { return 0; }" will give Code: $ gcc -o test test.c collect2: cannot find 'ld' ld is there ...
  1. #1
    Just Joined!
    Join Date
    Jul 2008
    Location
    Ipswich, UK
    Posts
    5

    Unhappy [SOLVED] Collect2: cannot find ld

    Hey.
    I have a problem with compiling anything, ie "int main(void) { return 0; }" will give
    Code:
    $ gcc -o test test.c
    collect2: cannot find 'ld'
    ld is there and working (as far as i can tell)
    Code:
    $ whereis ld
    ld: /usr/bin/ld /usr/share/man/man1/ld.1.gz
    $ ld
    ld: no input files
    Im running a fresh install of Ubuntu 8.04.1 on a Acer Travelmate TE351 laptop and I cant compile anything

    Help?
    Last edited by sam159; 07-17-2008 at 12:43 AM. Reason: Solved problem

  2. #2
    Linux Guru smolloy's Avatar
    Join Date
    Apr 2005
    Location
    CA, but from N.Ireland
    Posts
    2,413
    Hmmmm...... Have you installed build-essentials?
    Code:
    sudo apt-get install build-essentials
    It looks like you have, since you have gcc and ld, but maybe there's something else missing.

    *scratches head*
    Registered Linux user #388328 || Registered LFS user #15880
    AMD 64 X2 4600+ :: 2X1GB DDR2 800 :: GeForce 9400 GT 512MB :: ASUS M2N32 Deluxe :: 4X250GB SATAII
    Need instant help? Try us on IRC -- #linuxforums on freenode

  3. #3
    Just Joined!
    Join Date
    Jul 2008
    Location
    Ipswich, UK
    Posts
    5
    build-essentials is installed...

  4. #4
    Linux Guru smolloy's Avatar
    Join Date
    Apr 2005
    Location
    CA, but from N.Ireland
    Posts
    2,413
    From this link

    There's a bug in some versions of gcc that if "." is in your path, collect2
    will ignore $PATH when looking for ld because the FSF thinks it knows better
    than you do in that case.
    Could that be it?
    Registered Linux user #388328 || Registered LFS user #15880
    AMD 64 X2 4600+ :: 2X1GB DDR2 800 :: GeForce 9400 GT 512MB :: ASUS M2N32 Deluxe :: 4X250GB SATAII
    Need instant help? Try us on IRC -- #linuxforums on freenode

  5. #5
    Just Joined!
    Join Date
    Jul 2008
    Location
    Ipswich, UK
    Posts
    5
    Code:
    $ echo $PATH
    /home/sam/bin:/home/sam/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
    so *should* be fine...

  6. #6
    Just Joined!
    Join Date
    Jul 2008
    Location
    Ipswich, UK
    Posts
    5
    Ok, its working now, turns out that the dropbear ssh server was the trouble, so im now running openssh-server and collect2 works fine.
    How strange....
    Last edited by sam159; 07-17-2008 at 12:38 AM. Reason: typo

  7. #7
    Linux Guru smolloy's Avatar
    Join Date
    Apr 2005
    Location
    CA, but from N.Ireland
    Posts
    2,413
    So you've logged on to your server and are trying to compile stuff, but it doesn't work when the server is running dropbear?

    Or you're trying to compile this while sitting (locally) at the ssh server?
    Registered Linux user #388328 || Registered LFS user #15880
    AMD 64 X2 4600+ :: 2X1GB DDR2 800 :: GeForce 9400 GT 512MB :: ASUS M2N32 Deluxe :: 4X250GB SATAII
    Need instant help? Try us on IRC -- #linuxforums on freenode

  8. #8
    Just Joined!
    Join Date
    Jul 2008
    Location
    Ipswich, UK
    Posts
    5
    I was using it over ssh, went to use it directly and compiling worked.
    didn't work when connected through dropbear.
    Last edited by sam159; 07-17-2008 at 01:05 AM. Reason: Clarified

  9. #9
    Linux Guru smolloy's Avatar
    Join Date
    Apr 2005
    Location
    CA, but from N.Ireland
    Posts
    2,413
    Weird. Dropbear musn't be passing some critical information that openssh does.

    Glad you got it sorted
    Registered Linux user #388328 || Registered LFS user #15880
    AMD 64 X2 4600+ :: 2X1GB DDR2 800 :: GeForce 9400 GT 512MB :: ASUS M2N32 Deluxe :: 4X250GB SATAII
    Need instant help? Try us on IRC -- #linuxforums on freenode

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...