Search code examples
mingwcross-compilinggobject-introspection

GObject Introspection build fails while generating libgirepository_1_0_la-gdump.lo


While using MingW to cross compile the GObject Introspection library, version 1.31.22, I seem to hit a problem. Configuring the library seems to go well, but when I start building it the make file quickly terminates with:

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

A look at the verbose output (make V=1) reveals the following:

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'

If I run everything from the first line manually, it succeeds. If I run everything from the second line after "libtool: compile:" manually, it succeeds. I can then move on to the very next compile step and use copy paste to manually compile each thing. However, just running make itself is not successfully compiling the library.

Why does make not successfully run on its own, and how can I fix it?

Setup Information

OS: Ubuntu 14.04

Make: GNU Make 3.81 built for x86_64-pc-linux-gnu

Python: 2.7.8 I installed Python into Wine and link to it during the build.

Wine: 1.6.2

MingW: i686-w64-mingw32-gcc (GCC) 4.8.2

Environment setup

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

Build script

#! /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 ..

Solution

  • I noticed that when I redirected the output of the make command to a text file in contained windows line ending characters, "^M". I fixed this by running (^M is Ctrl+v Ctrl+m):

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

    This seems to get me past the issue of libtool build errors.

    For anyone wondering where the ^M's were coming from, it is the line endings from the generated and install pkg-config files.