环境变量问题和交叉编译器安装问题。

系统安装、升级讨论
版面规则
我们都知道新人的确很菜,也喜欢抱怨,并且带有浓厚的Windows习惯,但既然在这里询问,我们就应该有责任帮助他们解决问题,而不是直接泼冷水、简单的否定或发表对解决问题没有任何帮助的帖子。乐于分享,以人为本,这正是Ubuntu的精神所在。
回复
onelook
帖子: 12
注册时间: 2013-02-24 13:58
系统: 12.04

环境变量问题和交叉编译器安装问题。

#1

帖子 onelook » 2013-02-24 14:03

最近在安装交叉编译器
在编译器目录里面输入 ./arm-linux-g++ -v 可以显示版本号,可是去掉./后就提示没有那个文件或目录。
因为对linux不熟悉,谁能告诉下原因。

还有就是环境变量问题
root@ian-MS-7693:/opt/FriendlyARM/toolschain/4.5.1# echo $PATH
”/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/FriendlyARM/toolschain/4.5.1/bin”

提示已经添加了,但是无论输入 ./arm-linux-g++ -v 还是 arm-linux-g++ -v 都无效。
taohunter
帖子: 1555
注册时间: 2012-03-31 3:29

Re: 环境变量问题和交叉编译器安装问题。

#2

帖子 taohunter » 2013-02-24 15:02

去学习一下几个基本概念如“目录”,“当前目录”,“路径”,“绝对路径”,“相对路径”,“linux命令搜索机制”。。。,以及一些与目录、环境变量操作相关的基本命令和文件吧。。。

“./”表示当前目录,当前目录下没有你要执行的命令,系统不会再去搜索,因为你已经指定了在“./"当前目录下搜索。所以属于典型的多此一举,画蛇添足;去掉“./"系统就会去搜索路径了。
三年后终于回到16.04--稳定了!
onelook
帖子: 12
注册时间: 2013-02-24 13:58
系统: 12.04

Re: 环境变量问题和交叉编译器安装问题。

#3

帖子 onelook » 2013-02-24 16:05

taohunter 写了:去学习一下几个基本概念如“目录”,“当前目录”,“路径”,“绝对路径”,“相对路径”,“linux命令搜索机制”。。。,以及一些与目录、环境变量操作相关的基本命令和文件吧。。。

“./”表示当前目录,当前目录下没有你要执行的命令,系统不会再去搜索,因为你已经指定了在“./"当前目录下搜索。所以属于典型的多此一举,画蛇添足;去掉“./"系统就会去搜索路径了。
我现在的问题是,明明是在当前路径,但是不打上./就不会有反应。我附上一段终端的显示,应该能说清楚

ian@ian-MS-7693:/opt/mini6410/qt-everywhere-opensource-src-4.7.0$ cd /opt/FriendlyARM/toolschain/4.5.1/bin
ian@ian-MS-7693:/opt/FriendlyARM/toolschain/4.5.1/bin$ ls
arm-linux-addr2line arm-none-linux-gnueabi-addr2line
arm-linux-ar arm-none-linux-gnueabi-ar
arm-linux-as arm-none-linux-gnueabi-as
arm-linux-c++ arm-none-linux-gnueabi-c++
arm-linux-cc arm-none-linux-gnueabi-cc
arm-linux-c++filt arm-none-linux-gnueabi-c++filt
arm-linux-cpp arm-none-linux-gnueabi-cpp
arm-linux-g++ arm-none-linux-gnueabi-g++
arm-linux-gcc arm-none-linux-gnueabi-gcc
arm-linux-gcc-4.5.1 arm-none-linux-gnueabi-gcc-4.5.1
arm-linux-gccbug arm-none-linux-gnueabi-gccbug
arm-linux-gcov arm-none-linux-gnueabi-gcov
arm-linux-gprof arm-none-linux-gnueabi-gprof
arm-linux-ld arm-none-linux-gnueabi-ld
arm-linux-ldd arm-none-linux-gnueabi-ldd
arm-linux-nm arm-none-linux-gnueabi-nm
arm-linux-objcopy arm-none-linux-gnueabi-objcopy
arm-linux-objdump arm-none-linux-gnueabi-objdump
arm-linux-populate arm-none-linux-gnueabi-populate
arm-linux-ranlib arm-none-linux-gnueabi-ranlib
arm-linux-readelf arm-none-linux-gnueabi-readelf
arm-linux-size arm-none-linux-gnueabi-size
arm-linux-strings arm-none-linux-gnueabi-strings
arm-linux-strip arm-none-linux-gnueabi-strip
ian@ian-MS-7693:/opt/FriendlyARM/toolschain/4.5.1/bin$ arm-linux-g++ -v
arm-linux-g++:未找到命令

ian@ian-MS-7693:/opt/FriendlyARM/toolschain/4.5.1/bin$ ./arm-linux-g++ -v
Using built-in specs.
COLLECT_GCC=./arm-linux-g++
COLLECT_LTO_WRAPPER=/opt/FriendlyARM/toolschain/4.5.1/libexec/gcc/arm-none-linux-gnueabi/4.5.1/lto-wrapper
Target: arm-none-linux-gnueabi
Configured with: /work/toolchain/build/src/gcc-4.5.1/configure --build=i686-build_pc-linux-gnu --host=i686-build_pc-linux-gnu --target=arm-none-linux-gnueabi --prefix=/opt/FriendlyARM/toolschain/4.5.1 --with-sysroot=/opt/FriendlyARM/toolschain/4.5.1/arm-none-linux-gnueabi/sys-root --enable-languages=c,c++ --disable-multilib --with-cpu=arm1176jzf-s --with-tune=arm1176jzf-s --with-fpu=vfp --with-float=softfp --with-pkgversion=ctng-1.8.1-FA --with-bugurl=http://www.arm9.net/ --disable-sjlj-exceptions --enable-__cxa_atexit --disable-libmudflap --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --with-gmp=/work/toolchain/build/arm-none-linux-gnueabi/build/static --with-mpfr=/work/toolchain/build/arm-none-linux-gnueabi/build/static --with-ppl=/work/toolchain/build/arm-none-linux-gnueabi/build/static --with-cloog=/work/toolchain/build/arm-none-linux-gnueabi/build/static --with-mpc=/work/toolchain/build/arm-none-linux-gnueabi/build/static --with-libelf=/work/toolchain/build/arm-none-linux-gnueabi/build/static --enable-threads=posix --with-local-prefix=/opt/FriendlyARM/toolschain/4.5.1/arm-none-linux-gnueabi/sys-root --disable-nls --enable-symvers=gnu --enable-c99 --enable-long-long
Thread model: posix
gcc version 4.5.1 (ctng-1.8.1-FA)
ian@ian-MS-7693:/opt/FriendlyARM/toolschain/4.5.1/bin$
头像
懒蜗牛Gentoo
论坛版主
帖子: 7362
注册时间: 2007-03-02 17:36
系统: Linux Mint

Re: 环境变量问题和交叉编译器安装问题。

#4

帖子 懒蜗牛Gentoo » 2013-02-25 9:45

Linux默认不搜索当前路径的,所以当前路径下的可执行文件如果不输入路径系统会找不到。
虽然世上没有完美的东西,但这并不影响我们追求完美,因为只有偏执狂才TMD能成功。
10.04新手入门——笨兔兔讲述自己的故事
onelook
帖子: 12
注册时间: 2013-02-24 13:58
系统: 12.04

Re: 环境变量问题和交叉编译器安装问题。

#5

帖子 onelook » 2013-02-25 12:28

懒蜗牛Gentoo 写了:Linux默认不搜索当前路径的,所以当前路径下的可执行文件如果不输入路径系统会找不到。
请问,如果要搜索当前目录,怎么改环境变量。
头像
懒蜗牛Gentoo
论坛版主
帖子: 7362
注册时间: 2007-03-02 17:36
系统: Linux Mint

Re: 环境变量问题和交叉编译器安装问题。

#6

帖子 懒蜗牛Gentoo » 2013-02-25 12:48

把./写进PATH里
虽然世上没有完美的东西,但这并不影响我们追求完美,因为只有偏执狂才TMD能成功。
10.04新手入门——笨兔兔讲述自己的故事
onelook
帖子: 12
注册时间: 2013-02-24 13:58
系统: 12.04

Re: 环境变量问题和交叉编译器安装问题。

#7

帖子 onelook » 2013-03-01 15:27

懒蜗牛Gentoo 写了:把./写进PATH里
非常感谢
回复