如何在configure时,将编译参数传入,改变默认的编译器gcc成arm-linux-gcc
2011-01-23 17:35
513 查看
http://www.51zxw.net/study.asp?vip=1368926
http://blog.163.com/againinput4@yeah/blog/static/1227642712009623053497/
如何在configure时,将编译参数传入,改变默认的编译器gcc成arm-linux-gcc
【问题】
想要用交叉编译工具arm-linux-gcc去编译lrzsz,
但是在./configure的时候,无法用--host=arm-linux或--build=arm-linux或--target=arm-linux等传入此编译器参数。
【解决过程】
按照INSTALL中的介绍,也是常用的方法,在configure的时候,加上--host=arm-linux,结果没有实现我们要的效果,没有将编译器从默认的
gcc改成arm-linux-gcc,编译器还是用的默认的gcc:
[crifan@localhost lrzsz-0.12.20]$ CFLAGS=-O2 ./configure --host=arm-linux
loading cache ./config.cache
....................
checking for gcc... (cached) gcc
checking whether the C compiler (gcc -O2 ) works... yes
checking whether the C compiler (gcc -O2 ) is a cross-compiler... no
....................
后来经过多次尝试,最后受默认的
CFLAGS=-O2 ./configure
进行配置所启发,想到,是否可以将CC参数传入到configure中,
结果证实,如果没有自己的cache-file,即时加了对的CC参数,也还是无法传入:
[crifan@localhost lrzsz-0.12.20]$ CFLAGS=-O2 CC=arm-linux-gcc ./configure --host=arm-linux
loading cache ./config.cache
....................
checking for gcc... (cached) gcc
checking whether the C compiler (gcc -O2 ) works... yes
checking whether the C compiler (gcc -O2 ) is a cross-compiler... no
checking whether we are using GNU C... (cached) yes
....................
而且,如果CC参数放在configure后面:
./configure CC=arm-linux-gcc
则不能识别:
[crifan@localhost lrzsz-0.12.20]$ CFLAGS=-O2 ./configure CC=arm-linux-gcc
configure: warning: CC=arm-linux-gcc: invalid host type
....................
参数传递必须像
CFLAGS=-O2 ./configure
一样,将参数设置放在configure的前面:
CC=arm-linux-gcc./configure
才能识别的。
必须要自己制定自己的cache-file 然后用./configure进行新配置,加上CC参数,才会即时生效,编译器才可以变成我们要的arm-linux-gcc:
[crifan@localhost lrzsz-0.12.20]$ CC=arm-linux-gcc ./configure --cache-file=cache_file_0 --prefix=/usr/crifan/lrzsz
....................
checking for gcc... arm-linux-gcc
checking whether the C compiler (arm-linux-gcc ) works... yes
checking whether the C compiler (arm-linux-gcc ) is a cross-compiler... yes
checking whether we are using GNU C... yes
....................
否则,就无法将我们的CC参数传入了:
[crifan@localhost lrzsz-0.12.20]$ CC=arm-linux-gcc ./configure --prefix=/usr/crifan/lrzsz
....................
checking for gcc... (cached) gcc
checking whether the C compiler (gcc ) works... yes
checking whether the C compiler (gcc ) is a cross-compiler... no
checking whether we are using GNU C... (cached) yes
....................
[crifan@localhost lrzsz-0.12.20]$ CFLAGS=-O2 CC=arm-linux-gcc ./configure --cache-file=cache_file_0
loading cache cache_file_0
....................
checking for gcc... arm-linux-gcc
checking whether the C compiler (arm-linux-gcc -O2 ) works... yes
checking whether the C compiler (arm-linux-gcc -O2 ) is a cross-compiler... yes
checking whether we are using GNU C... yes
最好此处在加上--prefix=/usr/crifan/lrzsz,表示具体安装到哪里
[crifan@localhost lrzsz-0.12.20]$ CFLAGS=-O2 CC=arm-linux-gcc ./configure --cache-file=cache_file_0 --prefix=/usr/crifan/lrzsz
loading cache cache_file_0
....................
checking for gcc... arm-linux-gcc
checking whether the C compiler (arm-linux-gcc -O2 ) works... yes
checking whether the C compiler (arm-linux-gcc -O2 ) is a cross-compiler... yes
checking whether we are using GNU C... yes
....................
其中,/usr/crifan/lrzsz是已经建立好的,已经存在的文件夹,上面这样表示编译后,
将生成的可执行文件安装拷贝到那个目录.
【办法总结】
在./configure的时候,将CC参数放入configure之前,并且要制定cache file,才能完全即时识别编译器:
CC=arm-linux-gcc ./configure --cache-file=cache_file_0
http://blog.163.com/againinput4@yeah/blog/static/1227642712009623053497/
如何在configure时,将编译参数传入,改变默认的编译器gcc成arm-linux-gcc
【问题】
想要用交叉编译工具arm-linux-gcc去编译lrzsz,
但是在./configure的时候,无法用--host=arm-linux或--build=arm-linux或--target=arm-linux等传入此编译器参数。
【解决过程】
按照INSTALL中的介绍,也是常用的方法,在configure的时候,加上--host=arm-linux,结果没有实现我们要的效果,没有将编译器从默认的
gcc改成arm-linux-gcc,编译器还是用的默认的gcc:
[crifan@localhost lrzsz-0.12.20]$ CFLAGS=-O2 ./configure --host=arm-linux
loading cache ./config.cache
....................
checking for gcc... (cached) gcc
checking whether the C compiler (gcc -O2 ) works... yes
checking whether the C compiler (gcc -O2 ) is a cross-compiler... no
....................
后来经过多次尝试,最后受默认的
CFLAGS=-O2 ./configure
进行配置所启发,想到,是否可以将CC参数传入到configure中,
结果证实,如果没有自己的cache-file,即时加了对的CC参数,也还是无法传入:
[crifan@localhost lrzsz-0.12.20]$ CFLAGS=-O2 CC=arm-linux-gcc ./configure --host=arm-linux
loading cache ./config.cache
....................
checking for gcc... (cached) gcc
checking whether the C compiler (gcc -O2 ) works... yes
checking whether the C compiler (gcc -O2 ) is a cross-compiler... no
checking whether we are using GNU C... (cached) yes
....................
而且,如果CC参数放在configure后面:
./configure CC=arm-linux-gcc
则不能识别:
[crifan@localhost lrzsz-0.12.20]$ CFLAGS=-O2 ./configure CC=arm-linux-gcc
configure: warning: CC=arm-linux-gcc: invalid host type
....................
参数传递必须像
CFLAGS=-O2 ./configure
一样,将参数设置放在configure的前面:
CC=arm-linux-gcc./configure
才能识别的。
必须要自己制定自己的cache-file 然后用./configure进行新配置,加上CC参数,才会即时生效,编译器才可以变成我们要的arm-linux-gcc:
[crifan@localhost lrzsz-0.12.20]$ CC=arm-linux-gcc ./configure --cache-file=cache_file_0 --prefix=/usr/crifan/lrzsz
....................
checking for gcc... arm-linux-gcc
checking whether the C compiler (arm-linux-gcc ) works... yes
checking whether the C compiler (arm-linux-gcc ) is a cross-compiler... yes
checking whether we are using GNU C... yes
....................
否则,就无法将我们的CC参数传入了:
[crifan@localhost lrzsz-0.12.20]$ CC=arm-linux-gcc ./configure --prefix=/usr/crifan/lrzsz
....................
checking for gcc... (cached) gcc
checking whether the C compiler (gcc ) works... yes
checking whether the C compiler (gcc ) is a cross-compiler... no
checking whether we are using GNU C... (cached) yes
....................
[crifan@localhost lrzsz-0.12.20]$ CFLAGS=-O2 CC=arm-linux-gcc ./configure --cache-file=cache_file_0
loading cache cache_file_0
....................
checking for gcc... arm-linux-gcc
checking whether the C compiler (arm-linux-gcc -O2 ) works... yes
checking whether the C compiler (arm-linux-gcc -O2 ) is a cross-compiler... yes
checking whether we are using GNU C... yes
最好此处在加上--prefix=/usr/crifan/lrzsz,表示具体安装到哪里
[crifan@localhost lrzsz-0.12.20]$ CFLAGS=-O2 CC=arm-linux-gcc ./configure --cache-file=cache_file_0 --prefix=/usr/crifan/lrzsz
loading cache cache_file_0
....................
checking for gcc... arm-linux-gcc
checking whether the C compiler (arm-linux-gcc -O2 ) works... yes
checking whether the C compiler (arm-linux-gcc -O2 ) is a cross-compiler... yes
checking whether we are using GNU C... yes
....................
其中,/usr/crifan/lrzsz是已经建立好的,已经存在的文件夹,上面这样表示编译后,
将生成的可执行文件安装拷贝到那个目录.
【办法总结】
在./configure的时候,将CC参数放入configure之前,并且要制定cache file,才能完全即时识别编译器:
CC=arm-linux-gcc ./configure --cache-file=cache_file_0
相关文章推荐
- 【Linux开发】如何在./configure的时候将编译参数传入,改变默认的编译器gcc成arm-linux-gcc
- 如何在configure时,将编译参数传入,改变默认的编译器gcc成arm-linux-gcc 【转】
- arm-linux-gcc在编译应用程序时,如何查找默认的头文件路径
- gcc 和 arm-linux-gcc 编译器的默认搜索头文件路径
- ubuntu下如何更换arm-linux-gcc编译器
- configure中arm-linux-gcc编译器使用
- 如何查看程序被哪个版本编译器编译的linux-gcc
- Linux内核移植 part1:arm gcc 编译与链接参数
- 如何将arm-linux-gcc编译的动态链接helloworld在Android上运行
- eclipse下如何配置arm-linux-gcc编译器
- 编译通过的U-boot和使用的arm-linux-gcc编译器
- 如何编译arm-linux-gcc交叉编译工具
- 如何交叉编译Python到ARM-Linux平台(转)
- 嵌入式 Linux下GCC编译时如何指定链接库
- ubuntu下交叉编译环境构建(arm-linux-gcc-3.4.1.tar.bz2 )
- 如何查看arm-linux-gcc某个版本支持的-mcpu,-march可选值
- Ubuntu嵌入式交叉编译环境arm-linux-gcc
- ubuntu16.4 64bit系统安装arm-linux-gcc 4.5.1交叉编译环境
- 建立arm-linux-gcc交叉编译环境
- LINUX下如何用GCC编译动态库