生成libgirepository_1_0_la-gdump.lo时,GObject Introspection构建失败

时间:2014-09-15 20:37:26

标签: mingw cross-compiling gobject-introspection

使用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

制作:为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 ..

1 个答案:

答案 0 :(得分:0)

我注意到当我将make命令的输出重定向到包含的windows行结束字符中的文本文件时," ^ M"。我通过运行来修复它(^ M是Ctrl + v Ctrl + m):

find ./ -name "Makefile" -exec sed -i "s/^M//" {} \;

这似乎让我解决了libtool构建错误的问题。

对于想知道^ M&来自哪里的人来说,它是生成和安装pkg-config文件的行结尾。