根据手册: 4.6.1 交叉编译 jpeg $ tar -xvf Helper2416/sources/depends/jpegsrc.v6b.tar.gz -C /home/fedora/workspace/ $ cd ~/workspace/jpeg-6b/ $ ./configure --enable-shared --enable-static --prefix=/opt/toolchains/arm-jyxtec-linux-gnueabi/arm-jyxtec-linux-gnueabi/sysroot/ --build=i386 --host=arm-linux 然后修改生成的 Makefile,如下 CC= gcc 改为:CC= arm-linux-gcc AR= ar rc 改为:AR= arm-linux-ar rc AR2= ranlib 改为:AR2= arm-linux-ranlib $ make $ sudo make install-lib
对我的环境来说, 我的编译器的库文件所在目录是/home/ballack/workspace/arm-jyxtec-linux-gnueabi/sysboot/ 当我执行到 $ ./configure --enable-shared --enable-static --prefix=/home/ballack/workspace/arm-jyxtec-linux-gnueabi/sysboot/ --build=i386 --host=arm-linux 的时候发现出现一个问题: checking for gcc... 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... yes
checking how to run the C preprocessor... gcc -E
checking for function prototypes... yes
checking for stddef.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for size_t... yes
checking for type unsigned char... yes
checking for type unsigned short... yes
checking for type void... yes
checking for working const... yes
checking for inline... __inline__
checking for broken incomplete types... ok
checking for short external names... ok
checking to see if char is signed... yes
checking to see if right shift is signed... yes
checking to see if fopen accepts b spec... yes
checking for a BSD compatible install... /usr/bin/install -c
checking for ranlib... ranlib
checking host system type... x86_64-unknown-linux-gnu
checking for ranlib... ranlib
checking for gcc... gcc
checking whether we are using GNU C... yes
checking for gcc option to produce PIC... -fPIC
checking if gcc PIC flag -fPIC works... yes
checking if gcc static flag -static works... -static
checking whether ln -s works... yes
checking for ld used by GCC... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking whether the linker (/usr/bin/ld) supports shared libraries... yes
checking for BSD-compatible nm... /usr/bin/nm -B
checking command to parse /usr/bin/nm -B output... yes
checking how to hardcode library paths into programs... immediate
checking for /usr/bin/ld option to reload object files... -r
checking dynamic linker characteristics... Linux ld.so
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking for objdir... .libs
creating libtool
checking libjpeg version number... 62
creating ./config.status
creating Makefile
creating jconfig.h
jconfig.h is unchanged
接着我在configure文件下面跟踪了下,发现是在以下地方打印出jconfig.h is unchanged 这句话的: cat >> $CONFIG_STATUS <<\EOF
rm -f conftest.frag conftest.h
echo "/* $ac_file. Generated automatically by configure. */" > conftest.h
cat conftest.in >> conftest.h
rm -f conftest.in
if cmp -s $ac_file conftest.h 2>/dev/null; then
echo "$ac_file is unchanged"
rm -f conftest.h
else
# Remove last slash and all that follows it. Not all systems have dirname.
ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
# The file is in a subdirectory.
test ! -d "$ac_dir" && mkdir "$ac_dir"
fi
rm -f $ac_file
mv conftest.h $ac_file
fi
fi; done
出现jconfig.h is unchanged
后会导致的make和后面的make install-lib出现问题。