在使用 MingW 交叉编译 GObject Introspection 库,版本 1.31.22 时,我似乎遇到了一个问题。配置库似乎很顺利,但是当我开始构建它时,make 文件很快就会终止:
CC libgirepository_1_0_la-gdump.lo
: No such file or directory:
: No such file or directory:
make[2]: *** [libgirepository_1_0_la-gdump.lo] Error 1
查看详细输出(make V=1)会发现以下内容:
make all-recursive
make[1]: Entering directory `/opt/build/opensource/gobject-introspection-1.31.22'
Making all in .
make[2]: Entering directory `/opt/build/opensource/gobject-introspection-1.31.22'
/bin/bash ./libtool --tag=CC --mode=compile i686-w64-mingw32-gcc -DHAVE_CONFIG_H -I. -mms-bitfields -I/opt/build/windows/include/glib-2.0 -I/opt/build/windows/lib/glib-2.0/include -I/opt/build/windows/lib/libffi-3.0.12/include -I./girepository -DG_IREPOSITORY_COMPILATION -I/opt/build/windows/include -I/usr/i686-w64-mingw32/include -I/opt/build/windows/include/glib-2.0 -I/opt/build/windows/lib/glib-2.0/include/ -fno-strict-aliasing -Wsign-compare -Wcast-align -Wpointer-arith -Wnested-externs -Wmissing-prototypes -Wmissing-declarations -Wchar-subscripts -Wall -I/opt/build/windows/include -I/usr/i686-w64-mingw32/include -I/opt/build/windows/include/glib-2.0 -I/opt/build/windows/lib/glib-2.0/include/ -MT libgirepository_1_0_la-gdump.lo -MD -MP -MF .deps/libgirepository_1_0_la-gdump.Tpo -c -o libgirepository_1_0_la-gdump.lo `test -f 'girepository/gdump.c' || echo './'`girepository/gdump.c
libtool: compile: i686-w64-mingw32-gcc -DHAVE_CONFIG_H -I. -mms-bitfields -I/opt/build/windows/include/glib-2.0 -I/opt/build/windows/lib/glib-2.0/include -I/opt/build/windows/lib/libffi-3.0.12/include -I./girepository -DG_IREPOSITORY_COMPILATION -I/opt/build/windows/include -I/usr/i686-w64-mingw32/include -I/opt/build/windows/include/glib-2.0 -I/opt/build/windows/lib/glib-2.0/include/ -fno-strict-aliasing -Wsign-compare -Wcast-align -Wpointer-arith -Wnested-externs -Wmissing-prototypes -Wmissing-declarations -Wchar-subscripts -Wall -I/opt/build/windows/include -I/usr/i686-w64-mingw32/include -I/opt/build/windows/include/glib-2.0 -I/opt/build/windows/lib/glib-2.0/include/ -MT libgirepository_1_0_la-gdump.lo -MD -MP -MF .deps/libgirepository_1_0_la-gdump.Tpo -c girepository/gdump.c -DDLL_EXPORT -DPIC -o .libs/libgirepository_1_0_la-gdump.o
make[2]: Leaving directory `/opt/build/opensource/gobject-introspection-1.31.22'
make[1]: Leaving directory `/opt/build/opensource/gobject-introspection-1.31.22'
如果我从第一行手动运行所有内容,它就会成功。如果我在“libtool: compile:”之后手动运行第二行的所有内容,它就会成功。然后我可以继续下一个编译步骤并使用复制粘贴来手动编译每个东西。但是,仅运行 make 本身并不能成功编译库。
为什么 make 无法自行成功运行,我该如何解决?
设置信息
操作系统:Ubuntu 14.04
Make:为 x86_64-pc-linux-gnu 构建的 GNU Make 3.81
Python:2.7.8 我将 Python 安装到 Wine 并在构建期间链接到它。
酒:1.6.2
MingW:i686-w64-mingw32-gcc (GCC) 4.8.2
环境设置
export PREFIX=$CROSS_DIR/windows
export INSTALL_PREFIX=$PREFIX
export TOOLCHAIN_FILE=$PREFIX/toolchain_windows.cmake
export PLATFORM=WINDOWS
export HOST=i686-w64-mingw32
export BUILD=x86_64-linux-gnu
export COMPILER_INCLUDE_DIR=/usr/$HOST/include
export COMPILER_LIB_DIR=/usr/$HOST/lib
export MINGW_32_LIBS=/usr/lib/gcc/$HOST/4.8
export CFLAGS="-I$PREFIX/include -I$COMPILER_INCLUDE_DIR"
export CPPFLAGS="-I$PREFIX/include -I$COMPILER_INCLUDE_DIR"
export CXXFLAGS="-I$PREFIX/include -I$COMPILER_INCLUDE_DIR"
export LDFLAGS="-L$PREFIX/lib -L$COMPILER_LIB_DIR"
export XDG_DATA_DIRS="$PREFIX/share"
export LD_LIBRARY_PATH=$PREFIX/lib:$PREFIX/bin:$COMPILER_LIB_DIR
export LIBRARY_PATH=$PREFIX/lib:$PREFIX/bin:$COMPILER_LIB_DIR
export INCLUDE_PATH=$PREFIX/include:$COMPILER_INCLUDE_DIR
export C_INCLUDE_PATH=$PREFIX/include:$COMPILER_INCLUDE_DIR
export CPLUS_INCLUDE_PATH=$PREFIX/include:$COMPILER_INCLUDE_DIR
export CC=$HOST-gcc
export CXX=$HOST-g++
export LD=$HOST-ld
export RANLIB=$HOST-ranlib
export AR=$HOST-ar
export AS=$HOST-as
export STRIP=$HOST-strip
export PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig
构建脚本
#! /bin/bash
if [ ! -d "gobject-introspection-1.31.22" ]
then
tar --xz -xf ./tars/gobject-introspection-1.31.22.tar.xz
fi
cd gobject-introspection-1.31.22
echo Compile gobject instrospection
./configure --build="$BUILD" --host="$HOST" --prefix="$PREFIX" \
PKG_CONFIG="$PREFIX/bin/pkg-config.exe" \
PYTHON="$WINE_PYTHON_PATH/python.exe" \
PYTHON_INCLUDES="-I$WINE_PYTHON_PATH/include" \
PYTHON_LIBS="-L$WINE_PYTHON_PATH/libs -lpython27" \
PYTHON_LIB_LOC="$WINE_PYTHON_PATH/Lib" \
CFLAGS="$CFLAGS -I$PREFIX/include/glib-2.0 -I$PREFIX/lib/glib-2.0/include/" \
CPPFLAGS="$CPPFLAGS -I$PREFIX/include/glib-2.0 -I$PREFIX/lib/glib-2.0/include/" \
make clean
make 2>&1 | tee ../logs/39_gobject_introspection-make.log
make install 2>&1 | tee ../logs/39_gobject_introspection-makeinstall.log
cd ..