![msp430/bin/ld:找不到 -lc](https://linux22.com/image/1041971/msp430%2Fbin%2Fld%EF%BC%9A%E6%89%BE%E4%B8%8D%E5%88%B0%20-lc.png)
我成功安装了 msp430-gcc 4.7.0 编译器。在链接过程的最后阶段,编译器向我显示了 Ubuntu 12.04 的以下错误。
msp430-gcc -mmcu=msp430f1611 -Wl,-Map=contiki-sky.map
-Wl,--gc-sections,--undefined=_reset_vector__,--undefined=InterruptVectors,--undefined=_copy_data_init__,--undefined=_clear_bss_init__,--undefined=_end_of_init__
hello-world.co obj_sky/contiki-sky-main.o contiki-sky.a -o hello-world.sky
/opt/mspgccx/lib/gcc/msp430/4.7.0/../../../../msp430/bin/ld: cannot find -lc
collect2: error: ld returned 1 exit status
make: *** [hello-world.sky] Error 1
我扩展了搜索路径,因为 msp430-gcc 4.7 安装在/opt
at 下~/.bashrc
以包含/opt
目录。
msp430-gcc --version
msp430-gcc (GCC) 4.7.0 20120322 (mspgcc dev 20120911)
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
mswarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.
msp430-ld -version
GNU ld (GNU Binutils) 2.22 (mspgcc dev 20120911)
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.
$ gcc -v
Using built-in specs.
could not find specs file msp430mcu.spec
COLLECT_GCC=gcc
Target: msp430
Configured with: ../gcc-4.7.0/configure --target=msp430
--enable-languages=c --program-prefix=msp430- --prefix=/opt/mspgccx
Thread model: single
gcc version 4.7.0 20120322 (mspgcc dev 20120911) (GCC)
$ld -v
GNU ld (GNU Binutils for Ubuntu) 2.22
uname -a
Linux px 3.5.0-32-generic #53~precise1-Ubuntu SMP Wed May 29 20:35:31 UTC 2013 i686 i686 i386 GNU/Linux
我试过:
sudo apt-get install libcv-dev libcvaux-dev libhighgui-dev
sudo apt-get install glibc-static
sudo apt-get install build-essential
sudo apt-get update && sudo apt-get install libc6-dev
有什么建议么?
答案1
我遇到了同样的问题。并使用 contiki 脚本在 ubuntu 1204LTS 上进行了干净的 mspgcc 安装。但首先,安装了这些包
sudo apt-get install ncurses-dev flex libgmp3-dev libmpfr-dev bison libmpc-dev texinfo zlib1g-dev automake build-essential patch
然后我执行了修改后的脚本康蒂基(如下所列)。不要忘记将 /usr/local/bin 添加到 PATH
INSTALL_PREFIX="/usr/local/msp430"
echo The installatoin prefix:$INSTALL_PREFIX
# Switch to the tmp directory
mkdir tmp
cd tmp
# Getting
wget http://sourceforge.net/projects/mspgcc/files/mspgcc/DEVEL-4.7.x/mspgcc-20120911.tar.bz2
wget http://sourceforge.net/projects/mspgcc/files/msp430mcu/msp430mcu-20130321.tar.bz2
wget http://sourceforge.net/projects/mspgcc/files/msp430-libc/msp430-libc-20120716.tar.bz2
wget http://ftpmirror.gnu.org/binutils/binutils-2.22.tar.bz2
wget http://mirror.ibcp.fr/pub/gnu/gcc/gcc-4.7.0/gcc-4.7.0.tar.bz2
# Unpacking the tars
tar xvfj binutils-2.22.tar.bz2
tar xvfj gcc-4.7.0.tar.bz2
tar xvfj mspgcc-20120911.tar.bz2
tar xvfj msp430mcu-20130321.tar.bz2
tar xvfj msp430-libc-20120716.tar.bz2
# 1) Incorporating the changes contained in the patch delievered in mspgcc-20120911
cd binutils-2.22
patch -p1<../mspgcc-20120911/msp430-binutils-2.22-20120911.patch
cd ..
# 2) Incorporating the changes contained in the patch delievered in mspgcc-20120911
cd gcc-4.7.0
patch -p1<../mspgcc-20120911/msp430-gcc-4.7.0-20120911.patch
cd ..
# 3) Creating new directories
mkdir binutils-2.22-msp430
mkdir gcc-4.7.0-msp430
# 4) installing binutils in INSTALL_PREFIX
cd binutils-2.22-msp430/
../binutils-2.22/configure --target=msp430 --program-prefix="msp430-" --prefix=$INSTALL_PREFIX
make
make install
# 5) Download the prerequisites
cd ../gcc-4.7.0
./contrib/download_prerequisites
# 6) compiling gcc-4.7.0 in INSTALL_PREFIX
cd ../gcc-4.7.0-msp430
../gcc-4.7.0/configure --target=msp430 --enable-languages=c --program-prefix="msp430-" --prefix=$INSTALL_PREFIX
make
make install
# 7) compiping msp430mcu in INSTALL_PREFIX
cd ../msp430mcu-20130321
MSP430MCU_ROOT=`pwd` ./scripts/install.sh ${INSTALL_PREFIX}/
# 8) compiling the msp430 lib in INSTALL_PREFIX
cd ../msp430-libc-20120716
cd src
PATH=${INSTALL_PREFIX}/bin:$PATH
make
make PREFIX=$INSTALL_PREFIX install
# cleanup
# no need since every thing created in tmp
echo Reminder: remove tmp