我正在尝试使用Mingw-w64在Ubuntu 14.04上构建GObject-Introspection。我目前正在运行64位Linux并尝试构建32位Windows目标。
我的第一次尝试使用了Wine中安装的Python 2.7.8,然而,这不起作用,因为Python的路径分隔符设置为'\'(好'\')而不是Linux的'/'。因此,我尝试在Ubuntu中使用Python 2.7。
使用Ubuntu提供的Python不会超过配置步骤。 Config.log显示以下内容:
In file included from /usr/include/python2.7/Python.h:8:0,
from conftest.c:40:
/usr/include/python2.7/pyconfig.h:78:3: error: #error unknown multiarch locatio#
# error unknown multiarch location for pyconfig.h
^
In file included from /usr/include/python2.7/pyport.h:4:0,
from /usr/include/python2.7/Python.h:58,
from conftest.c:40:
/usr/include/python2.7/pyconfig.h:78:3: error: #error unknown multiarch locatio#
# error unknown multiarch location for pyconfig.h
^
In file included from /usr/include/python2.7/Python.h:58:0,
from conftest.c:40:
/usr/include/python2.7/pyport.h:241:9: error: #error "This platform's pyconfig.#
# error "This platform's pyconfig.h needs to define PY_FORMAT_SIZE_T"
^
In file included from /usr/include/python2.7/pymath.h:4:0,
from /usr/include/python2.7/Python.h:77,
from conftest.c:40:
/usr/include/python2.7/pyconfig.h:78:3: error: #error unknown multiarch locatio#
# error unknown multiarch location for pyconfig.h
^
据我所知,pyconfig.h定义的平台之间存在一些差异。我是否应该将这些文件收集到操作系统似乎正在进行的单独目录中(/usr/include/x86_64-linux-gnu/python2.7/pyconfig.h)?什么是Python的正确设置,以便我可以交叉编译GObject-Introspection?
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
./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/"
./configure --build="$BUILD" --host="$HOST" --prefix="$PREFIX" \
PKG_CONFIG="$PREFIX/bin/pkg-config.exe" \
PYTHON="/usr/bin/python2.7" \
PYTHON_INCLUDES="-I/usr/include/python2.7/ -I/usr/include/x86_64-linux-gnu/python2.7/" \
PYTHON_LIBS="-L/usr/lib/x86_64-linux-gnu/ -lpython2.7" \
PYTHON_LIB_LOC="/usr/lib/python2.7/" \
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/"
答案 0 :(得分:0)
尝试将其插入Makefile:
CFLAGS+= \
-DHAVE_SSIZE_T \
-DPY_FORMAT_SIZE_T="l" \
-DPY_FORMAT_LONG_LONG="ll" \