为arm-unknown-linux-gnueabi-gcc工具链添加常用库(zlib、libpng、libjpeg、libtiff、libtool)
主机环境:
RHEL6.0
kernel 2.6.32-220.2.1.el6.i686
gcc-4.4.6
1.zlib
cd zlib-1.2.5
./configure -shared
make LDSHARED="arm-unknown-linux-gnueabi-gcc -shared -Wl,-soname,libz.so.1" CC_FOR_BUILD="arm-unknown-linux-gnueabi-gcc" CC="arm-unknown-linux-gnueabi-gcc" LD="arm-unknown-linux-gnueabi-ld" CPP="arm-unknown-linux-gnueabi-g++ -E" AR="arm-unknown-linux-gnueabi-ar rc"
make
sudo cp -rf libz.s* /work/rhel/gcc-4.4.6-glibc-2.9/arm-unknown-linux-gnueabi/sysroot/usr/lib/
sudo cp -rf zlib.h /work/rhel/gcc-4.4.6-glibc-2.9/arm-unknown-linux-gnueabi/sysroot/usr/include
2.libpng
cd libpng-1.2.46
./configure CC=arm-unknown-linux-gnueabi-gcc --build=i686-redhat-linux --target=arm-unknown-linux-gnueabi --host=arm-unknown-linux-gnueabi --prefix=/work/rhel/gcc-4.4.6-glibc-2.9/arm-unknown-linux-gnueabi/sysroot/usr
make
sudo make install
sudo cp -rf png.h pngconf.h /work/rhel/gcc-4.4.6-glibc-2.9/arm-unknown-linux-gnueabi/sysroot/usr/include
3.libjpeg
cd jpeg-6b/
./configure CC=arm-unknown-linux-gnueabi-gcc --build=i686-redhat-linux --target=arm-unknown-linux-gnueabi --host=arm-unknown-linux-gnueabi --enable-shared --enable-static --prefix=/work/rhel/gcc-4.4.6-glibc-2.9/arm-unknown-linux-gnueabi/sysroot/usr
修改Makefile:
# library (.a) file creation command
AR= ar rc
# second step in .a creation (use "touch" if not needed)
AR2= ranlib
为:
# library (.a) file creation command
AR= arm-unknown-linux-gnueabi-ar rc
# second step in .a creation (use "touch" if not needed)
AR2= arm-unknown-linux-gnueabi-ranlib
#make: ./libtool: Command not found解决办法
#1拷贝libpng-1.2.46/libtool 到jpeg-6b/下
#2交叉编译libtool,并把bin/libtool拷贝到jpeg-6b/下
make
sudo make install
4.libtiff
ftp://ftp.remotesensing.org/libtiff/tiff-4.0.0.tar.gz
cd tiff-4.0.0
./configure CC=arm-unknown-linux-gnueabi-gcc CXX=arm-unknown-linux-gnueabi-g++ --build=i686-redhat-linux --target=arm-unknown-linux-gnueabi --host=arm-unknown-linux-gnueabi --prefix=/work/rhel/gcc-4.4.6-glibc-2.9/arm-unknown-linux-gnueabi/sysroot/usr
make
sudo make install
#编译libpng和libjpeg都出现了
./libtool: line 947: arm-unknown-linux-gnueabi-ranlib: command not found
#编译libtiff出现了arm-unknown-linux-gnueabi-g++: command not found
解决办法:
执行make install不要用sudo,先用su进入root用户再执行make install,再退出root用户
附libtool交叉编译方法
cd libtool-2.4.2/
./configure CC=arm-unknown-linux-gnueabi-gcc CXX=arm-unknown-linux-gnueabi-g++ FC=arm-unknown-linux-gnueabi-gfortran --build=i686-redhat-linux --target=arm-unknown-linux-gnueabi --host=arm-unknown-linux-gnueabi --prefix=/work/rhel/gcc-4.4.6-glibc-2.9/arm-unknown-linux-gnueabi/sysroot/usr
make
sudo make install
注:执行make install要用管理员权限的原因是我的工具链里面是只读权限,没有写权限
阅读(2070) | 评论(0) | 转发(1) |