Bug 14234 - /usr/bin/ld: cannot find -lz collect2: ld returned 1 exit status
Summary: /usr/bin/ld: cannot find -lz collect2: ld returned 1 exit status
Status: RESOLVED INVALID
Alias: None
Product: binutils
Classification: Unclassified
Component: ld (show other bugs)
Version: 2.22
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-06-14 09:47 UTC by pdemil+bug
Modified: 2012-06-14 14:25 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description pdemil+bug 2012-06-14 09:47:08 UTC
I'm want to use http://sourceforge.net/projects/mspgcc/files/mspgcc/DEVEL-4.7.x/ mspgcc-20120606

I have patched and compiled binutils and gcc succesfully (bin in /usr/local/msp430/bin but the msp430-ld is not used in the compilation of gdb)


Next, I have to patch, configure and compile gdb.
Following the instructions in msp430-gdb-7.2a-20111205.patch

  tar xjf gdb-7.2a.tar.bz2
  ( cd gdb-7.2 ; patch -p1 < ../msp430-gdb-7.2a-20111205.patch )
  mkdir -p BUILD/gdb
  cd BUILD/gdb
  ../../gdb-7.2/configure \
    --target=msp430 \
    --prefix=/usr/local/msp430 \
  2>&1 | tee co
  make 2>&1 | tee mo

output make:
...
make[2]: Entering directory `/root/downloads/BUILD/gdb/sim'
make[3]: Entering directory `/root/downloads/BUILD/gdb/sim/msp430'
gcc ../../../../gdb-7.2/sim/msp430/../common/gentmap.c -o gentmap -g -O -I. -I../../../../gdb-7.2/sim/msp430 -I../common -I../../../../gdb-7.2/sim/msp430/../common -I../../include -I../../../../gdb-7.2/sim/msp430/../../include -I../../bfd -I../../../../gdb-7.2/sim/msp430/../../bfd -I../../opcodes -I../../../../gdb-7.2/sim/msp430/../../opcodes 
rm -f tmp-tvals.h tmp-tmap.c
./gentmap -h >tmp-tvals.h
/bin/bash ../../../../gdb-7.2/sim/msp430/../../move-if-change tmp-tvals.h targ-vals.h
./gentmap -c >tmp-tmap.c
/bin/bash ../../../../gdb-7.2/sim/msp430/../../move-if-change tmp-tmap.c targ-map.c
touch stamp-tvals
rm -f version.c-tmp version.c
echo '#include "version.h"' >> version.c-tmp
echo 'const char version[] = "'"`sed q ../../../../gdb-7.2/sim/msp430/../../gdb/version.in`"'";' >> version.c-tmp
mv version.c-tmp version.c
gcc -c -DHAVE_CONFIG_H     -DPROFILE=1 -DWITH_PROFILE=-1          -DDEFAULT_INLINE=0              -I. -I../../../../gdb-7.2/sim/msp430 -I../common -I../../../../gdb-7.2/sim/msp430/../common -I../../include -I../../../../gdb-7.2/sim/msp430/../../include -I../../bfd -I../../../../gdb-7.2/sim/msp430/../../bfd -I../../opcodes -I../../../../gdb-7.2/sim/msp430/../../opcodes  -g -O2 version.c
rm -f libsim.a
ar rc libsim.a callback.o syscall.o targ-map.o version.o interp.o sim-load.o
ranlib libsim.a
gcc -DHAVE_CONFIG_H     -DPROFILE=1 -DWITH_PROFILE=-1          -DDEFAULT_INLINE=0              -I. -I../../../../gdb-7.2/sim/msp430 -I../common -I../../../../gdb-7.2/sim/msp430/../common -I../../include -I../../../../gdb-7.2/sim/msp430/../../include -I../../bfd -I../../../../gdb-7.2/sim/msp430/../../bfd -I../../opcodes -I../../../../gdb-7.2/sim/msp430/../../opcodes  -g -O2  -o run \
      run.o libsim.a ../../bfd/libbfd.a ../../opcodes/libopcodes.a  ../../libiberty/libiberty.a -lnsl  -lm -lz
/usr/bin/ld: cannot find -lz
collect2: ld returned 1 exit status
make[3]: *** [run] Error 1
make[3]: Leaving directory `/root/downloads/BUILD/gdb/sim/msp430'
make[2]: *** [all] Error 1
make[2]: Leaving directory `/root/downloads/BUILD/gdb/sim'
make[1]: *** [all-sim] Error 2
make[1]: Leaving directory `/root/downloads/BUILD/gdb'
make: *** [all] Error 2


Extra info:

OS: ubuntu 12.04
Linux ubuntu 3.2.0-24-generic #37-Ubuntu SMP Wed Apr 25 08:43:22 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux


root@ubuntu:~/downloads/BUILD/gdb# /usr/bin/ld --version
GNU ld (GNU Binutils for Ubuntu) 2.22
Copyright 2011 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later version.
This program has absolutely no warranty.

I don't think that msp430-ld should be used for compiling the patched gdb.
root@ubuntu:~/downloads/BUILD/gdb# msp430-ld --version
GNU ld (GNU Binutils) 2.22 (mspgcc dev 20120606)
Copyright 2011 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later version.
This program has absolutely no warranty.
root@ubuntu:~/downloads/BUILD/gdb#

root@ubuntu:~/downloads/BUILD/gdb# env $PATH
env: /usr/gcc_4_7/bin:/usr/local/msp430/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games: No such file or directory
root@ubuntu:~/downloads/BUILD/gdb#

Any hints?
Comment 1 pdemil+bug 2012-06-14 13:08:44 UTC
 apt-get install libghc-zlib-dev 
did the trick
Comment 2 Paul Pluzhnikov 2012-06-14 14:25:36 UTC
User error.