在我编译的过程中,我得到了“未找到命令”。错误

时间:2017-05-31 20:12:04

标签: linux ubuntu-16.04

我正在尝试将C文件编译为Rolling Spider。但我得到了错误。

Drone: Trying to pack autogenerated code using PackEmbeddedCode...
C-files are being packed...
C-files packed and ready to be built! 
Drone: Autogenerated code using PackEmbeddedCode packed!
Drone: Trying to build code...
/opt/arm-2012.03/bin/arm-none-linux-gnueabi-gcc -c -fPIC -Wall -Werror -o Drone_Compensator.o ../Drone_Compensator.c -lm
make: /opt/arm-2012.03/bin/arm-none-linux-gnueabi-gcc: Command not found
Makefile:4: recipe for target 'all' failed
make: *** [all] Error 127

以下是代码' DroneUploadEmbeddedCode.sh'

#!/bin/bash

# 1. change folder to where this script is
cd `dirname $0`
SCRIPTPATH=$(pwd)

# 1.2 Exit the script if a command fails
set -e

# 2. Pack autogenerated c-code
echo "Drone: Trying to pack autogenerated code using PackEmbeddedCode..."
cd utils/
./PackEmbeddedCode
cd ..
echo "Drone: Autogenerated code using PackEmbeddedCode packed!"

# 3. Build code
echo "Drone: Trying to build code..."
cd ../trunk/embcode/build_arm
make
cd $SCRIPTPATH
echo "Drone: Code built!"

# 4. ftp into the drone and upload the shared library
echo "Drone: Trying to upload shared library..."

echo "> Drone: FTP into the drone"
/usr/bin/expect <<SCRIPT
set timeout -1;
spawn ftp 192.168.1.1;
expect "(192.168.1.1:$USER):";
send "\r";
expect "ftp>";
send "put ../DroneExchange/librsedu.so librsedu.so\r";
expect "ftp>";
send "exit\r";
expect eof
SCRIPT

echo "Drone: Shared library uploaded!"

此外,这是&#39; Makefile&#39;代码

CC=/opt/arm-2012.03/bin/arm-none-linux-gnueabi-gcc

all:
    $(CC) -c -fPIC -Wall -Werror -o Drone_Compensator.o ../Drone_Compensator.c -lm
    #$(CC) -c -fPIC -Wall -Werror -o Drone_Compensator_capi.o ../Drone_Compensator_capi.c -lm
    $(CC) -c -DDELOS -DDELOS_EDU -fPIC -Wall -Werror -o rsedu_control.o ../rsedu_control.c  -lm
    $(CC) -c -DDELOS -DDELOS_EDU -fPIC -Wall -Werror -o rsedu_vis_helpers.o ../rsedu_vis_helpers.c  -lm
    $(CC) -c -DDELOS -DDELOS_EDU -fPIC -Wall -Werror -o rsedu_vis.o ../rsedu_vis.c  -lm
    $(CC) -c -DDELOS -DDELOS_EDU -fPIC -Wall -Werror -o rsedu_of.o ../rsedu_of.c  -lm
    $(CC) -c -fPIC  -Wall -Werror -o rtGetInf.o ../rtGetInf.c
    $(CC) -c -fPIC  -Wall -Werror -o rtGetNaN.o ../rtGetNaN.c  
    $(CC) -c -fPIC -Wall -Werror -o rt_nonfinite.o ../rt_nonfinite.c
    $(CC) -c -fPIC -Wall -Werror -DDEFAULT_BUFFER_SIZE=4600 -o rt_logging.o ../rt_logging.c 
    #$(CC) -c -fPIC -Wall -Werror -o rt_logging_mmi.o ../rt_logging_mmi.c
    #$(CC) -c -fPIC -Wall -Werror -o rtw_modelmap_utils.o ../rtw_modelmap_utils.c

    #
    $(CC) rsedu_control.o  rsedu_vis_helpers.o rsedu_vis.o rsedu_of.o Drone_Compensator.o rtGetInf.o rtGetNaN.o rt_nonfinite.o rt_logging.o -lm -DDELOS -DDELOS_EDU -fPIC -shared -o ../../../DroneExchange/librsedu.so -I./ 

所以,我试着关注这些文件。我找到了#arm; none-linux-gnueabi-gcc&#39;文件正确的文件夹。另外,我可以在终端上看到。

> ~/Downloads/RollingSpiderEdu-master/MIT_MatlabToolbox/libs/gcc-arm-Toolchain/opt/arm-2012.03/bin$
> ls arm-none-linux-gnueabi-addr2line  arm-none-linux-gnueabi-gdbtui
> arm-none-linux-gnueabi-ar         arm-none-linux-gnueabi-gprof
> arm-none-linux-gnueabi-as         arm-none-linux-gnueabi-ld
> arm-none-linux-gnueabi-c++        arm-none-linux-gnueabi-nm
> arm-none-linux-gnueabi-c++filt    arm-none-linux-gnueabi-objcopy
> arm-none-linux-gnueabi-cpp        arm-none-linux-gnueabi-objdump
> arm-none-linux-gnueabi-elfedit    arm-none-linux-gnueabi-ranlib
> arm-none-linux-gnueabi-g++        arm-none-linux-gnueabi-readelf
> arm-none-linux-gnueabi-gcc        arm-none-linux-gnueabi-size
> arm-none-linux-gnueabi-gcc-4.6.3  arm-none-linux-gnueabi-sprite
> arm-none-linux-gnueabi-gcov       arm-none-linux-gnueabi-strings
> arm-none-linux-gnueabi-gdb        arm-none-linux-gnueabi-strip

这是文件属性

 file -L arm-none-linux-gnuea
bi-gcc
arm-none-linux-gnueabi-gcc: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, for GNU/Linux 2.2.5, stripped

这是我的电脑

 ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=504637666875a5d526ef51acfe601c99efc99114, stripped

这是什么问题?这个问题是因为32位和64位之间的区别吗?

1 个答案:

答案 0 :(得分:0)

您需要替换Makefile中的行

CC=

使用您想要使用的编译器的正确路径。

从你的帖子看来,这似乎是

~/Downloads/RollingSpiderEdu-master/MIT_MatlabToolbox/libs/gcc-arm-Toolchain/opt/arm-2012.03/bin/arm-none-linux-gnueabi-gcc