How to for cross building wxPython?

I need to build wxPython for an embedded application on an ARM processor.

Is the wxPython build system set up to allow building for ARM on an x86 machine?

Any pointers would be much appreciated.

You should have an SDK or build environment for your target platform.

P.S.: The target platform needs to have gtk.

Yes, I understand that I need a cross build environment!

My issue is that the configure for the wxwidgets part of the build fails with this log info

checking build system type… x86_64-pc-linux-gnu
checking host system type… x86_64-pc-linux-gnu
checking for toolkit… gtk
checking for gcc… arm-reach-linux-gnueabi-gcc -march=armv7-a -mthumb -mfpu=neon -mfloat-abi=hard -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/home/steve/builds/rt-yocto-setup-fsl/build/tmp/work/armv7at2hf-neon-reach-linux-gnueabi/python3-wxpython/4.1.1-r0/recipe-sysroot
checking whether the C compiler works… yes
checking for C compiler default output file name… a.out
checking for suffix of executables…
checking whether we are cross compiling… configure: error: in /home/steve/builds/rt-yocto-setup-fsl/build/tmp/work/armv7at2hf-neon-reach-linux-gnueabi/python3-wxpython/4.1.1-r0/wxPython-4.1.1/build/wxbld/gtk3': configure: error: cannot run C compiled programs. If you meant to cross compile, use –host’.

I guess my question is how to inject the required --host info into the configure parameters that results from executing: python3 build.py build

Any suggestions?

FWIW, the script that sets up the cross build environment does the following:

export BUILD_NM=“nm”
export BUILD_RANLIB=“ranlib”
export BUILD_STRIP=“strip”
export CC=“arm-reach-linux-gnueabi-gcc -march=armv7-a -mthumb -mfpu=neon -mfloat-abi=hard -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/home/steve/builds/rt-yocto-setup-fsl/build/tmp/work/armv7at2hf-neon-reach-linux-gnueabi/python3-wxpython/4.1.1-r0/recipe-sysroot”
export CCLD=“arm-reach-linux-gnueabi-gcc -march=armv7-a -mthumb -mfpu=neon -mfloat-abi=hard -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/home/steve/builds/rt-yocto-setup-fsl/build/tmp/work/armv7at2hf-neon-reach-linux-gnueabi/python3-wxpython/4.1.1-r0/recipe-sysroot”
export CCSHARED="-fPIC -DPIC"
export CFLAGS=" -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=/home/steve/builds/rt-yocto-setup-fsl/build/tmp/work/armv7at2hf-neon-reach-linux-gnueabi/python3-wxpython/4.1.1-r0=/usr/src/debug/python3-wxpython/4.1.1-r0 -fdebug-prefix-map=/home/steve/builds/rt-yocto-setup-fsl/build/tmp/work/armv7at2hf-neon-reach-linux-gnueabi/python3-wxpython/4.1.1-r0=/usr/src/debug/python3-wxpython/4.1.1-r0 -fdebug-prefix-map=/home/steve/builds/rt-yocto-setup-fsl/build/tmp/work/armv7at2hf-neon-reach-linux-gnueabi/python3-wxpython/4.1.1-r0/recipe-sysroot= -fdebug-prefix-map=/home/steve/builds/rt-yocto-setup-fsl/build/tmp/work/armv7at2hf-neon-reach-linux-gnueabi/python3-wxpython/4.1.1-r0/recipe-sysroot-native= "
export CPP=“arm-reach-linux-gnueabi-gcc -E --sysroot=/home/steve/builds/rt-yocto-setup-fsl/build/tmp/work/armv7at2hf-neon-reach-linux-gnueabi/python3-wxpython/4.1.1-r0/recipe-sysroot -march=armv7-a -mthumb -mfpu=neon -mfloat-abi=hard -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security”
export CPPFLAGS=""
export CXX=“arm-reach-linux-gnueabi-g++ -march=armv7-a -mthumb -mfpu=neon -mfloat-abi=hard -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/home/steve/builds/rt-yocto-setup-fsl/build/tmp/work/armv7at2hf-neon-reach-linux-gnueabi/python3-wxpython/4.1.1-r0/recipe-sysroot”
export CXXFLAGS=" -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=/home/steve/builds/rt-yocto-setup-fsl/build/tmp/work/armv7at2hf-neon-reach-linux-gnueabi/python3-wxpython/4.1.1-r0=/usr/src/debug/python3-wxpython/4.1.1-r0 -fdebug-prefix-map=/home/steve/builds/rt-yocto-setup-fsl/build/tmp/work/armv7at2hf-neon-reach-linux-gnueabi/python3-wxpython/4.1.1-r0=/usr/src/debug/python3-wxpython/4.1.1-r0 -fdebug-prefix-map=/home/steve/builds/rt-yocto-setup-fsl/build/tmp/work/armv7at2hf-neon-reach-linux-gnueabi/python3-wxpython/4.1.1-r0/recipe-sysroot= -fdebug-prefix-map=/home/steve/builds/rt-yocto-setup-fsl/build/tmp/work/armv7at2hf-neon-reach-linux-gnueabi/python3-wxpython/4.1.1-r0/recipe-sysroot-native= -fvisibility-inlines-hidden"
unset DISTRO
export FC=“arm-reach-linux-gnueabi-gfortran -march=armv7-a -mthumb -mfpu=neon -mfloat-abi=hard -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/home/steve/builds/rt-yocto-setup-fsl/build/tmp/work/armv7at2hf-neon-reach-linux-gnueabi/python3-wxpython/4.1.1-r0/recipe-sysroot”
export GIT_CEILING_DIRECTORIES="/home/steve/builds/rt-yocto-setup-fsl/build/tmp/work/armv7at2hf-neon-reach-linux-gnueabi/python3-wxpython/4.1.1-r0"
export HOME="/home/steve"
export LC_ALL=“en_US.UTF-8”
export LD=“arm-reach-linux-gnueabi-ld --sysroot=/home/steve/builds/rt-yocto-setup-fsl/build/tmp/work/armv7at2hf-neon-reach-linux-gnueabi/python3-wxpython/4.1.1-r0/recipe-sysroot "
export LDCXXSHARED=“arm-reach-linux-gnueabi-g++ -march=armv7-a -mthumb -mfpu=neon -mfloat-abi=hard -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/home/steve/builds/rt-yocto-setup-fsl/build/tmp/work/armv7at2hf-neon-reach-linux-gnueabi/python3-wxpython/4.1.1-r0/recipe-sysroot -shared”
export LDFLAGS=”-Wl,-O1 -Wl,–hash-style=gnu -Wl,–as-needed -fstack-protector-strong -Wl,-z,relro,-z,now"
export LDSHARED=“arm-reach-linux-gnueabi-gcc -march=armv7-a -mthumb -mfpu=neon -mfloat-abi=hard -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/home/steve/builds/rt-yocto-setup-fsl/build/tmp/work/armv7at2hf-neon-reach-linux-gnueabi/python3-wxpython/4.1.1-r0/recipe-sysroot -shared”
export LINKFORSHARED="-fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security -Xlinker -export-dynamic"
export LOGNAME=“steve”
unset MACHINE
export MAKE=“make”
export MENDER_MACHINE=“imx6dl-g3-sd”
export NM=“arm-reach-linux-gnueabi-nm”
export OBJCOPY=“arm-reach-linux-gnueabi-objcopy”
export OBJDUMP=“arm-reach-linux-gnueabi-objdump”
export PATH="/home/steve/builds/rt-yocto-setup-fsl/build/tmp/sysroots-uninative/x86_64-linux/usr/bin:/home/steve/builds/rt-yocto-setup-fsl/build/tmp/work/armv7at2hf-neon-reach-linux-gnueabi/python3-wxpython/4.1.1-r0/recipe-sysroot-native/usr/bin/python3-native:/home/steve/builds/rt-yocto-setup-fsl/sources/poky/scripts:/home/steve/builds/rt-yocto-setup-fsl/build/tmp/work/armv7at2hf-neon-reach-linux-gnueabi/python3-wxpython/4.1.1-r0/recipe-sysroot-native/usr/bin/arm-reach-linux-gnueabi:/home/steve/builds/rt-yocto-setup-fsl/build/tmp/work/armv7at2hf-neon-reach-linux-gnueabi/python3-wxpython/4.1.1-r0/recipe-sysroot/usr/bin/crossscripts:/home/steve/builds/rt-yocto-setup-fsl/build/tmp/work/armv7at2hf-neon-reach-linux-gnueabi/python3-wxpython/4.1.1-r0/recipe-sysroot-native/usr/sbin:/home/steve/builds/rt-yocto-setup-fsl/build/tmp/work/armv7at2hf-neon-reach-linux-gnueabi/python3-wxpython/4.1.1-r0/recipe-sysroot-native/usr/bin:/home/steve/builds/rt-yocto-setup-fsl/build/tmp/work/armv7at2hf-neon-reach-linux-gnueabi/python3-wxpython/4.1.1-r0/recipe-sysroot-native/sbin:/home/steve/builds/rt-yocto-setup-fsl/build/tmp/work/armv7at2hf-neon-reach-linux-gnueabi/python3-wxpython/4.1.1-r0/recipe-sysroot-native/bin:/home/steve/builds/rt-yocto-setup-fsl/sources/poky/bitbake/bin:/home/steve/builds/rt-yocto-setup-fsl/build/tmp/hosttools"
export PKG_CONFIG_DIR="/home/steve/builds/rt-yocto-setup-fsl/build/tmp/work/armv7at2hf-neon-reach-linux-gnueabi/python3-wxpython/4.1.1-r0/recipe-sysroot/usr/lib/pkgconfig"
export PKG_CONFIG_DISABLE_UNINSTALLED=“yes”
export PKG_CONFIG_LIBDIR="/home/steve/builds/rt-yocto-setup-fsl/build/tmp/work/armv7at2hf-neon-reach-linux-gnueabi/python3-wxpython/4.1.1-r0/recipe-sysroot/usr/lib/pkgconfig"
export PKG_CONFIG_PATH="/home/steve/builds/rt-yocto-setup-fsl/build/tmp/work/armv7at2hf-neon-reach-linux-gnueabi/python3-wxpython/4.1.1-r0/recipe-sysroot/usr/lib/pkgconfig:/home/steve/builds/rt-yocto-setup-fsl/build/tmp/work/armv7at2hf-neon-reach-linux-gnueabi/python3-wxpython/4.1.1-r0/recipe-sysroot/usr/share/pkgconfig"
export PKG_CONFIG_SYSROOT_DIR="/home/steve/builds/rt-yocto-setup-fsl/build/tmp/work/armv7at2hf-neon-reach-linux-gnueabi/python3-wxpython/4.1.1-r0/recipe-sysroot"
export PKG_CONFIG_SYSTEM_INCLUDE_PATH="/usr/include"
export PKG_CONFIG_SYSTEM_LIBRARY_PATH="/lib:/usr/lib"
export PSEUDO_DISABLED=“1”
export PSEUDO_UNLOAD=“1”
export PYTHON="/home/steve/builds/rt-yocto-setup-fsl/build/tmp/work/armv7at2hf-neon-reach-linux-gnueabi/python3-wxpython/4.1.1-r0/recipe-sysroot-native/usr/bin/python3-native/python3"
export PYTHONNOUSERSITE=“1”
export PYTHON_INCLUDE_DIR="/home/steve/builds/rt-yocto-setup-fsl/build/tmp/work/armv7at2hf-neon-reach-linux-gnueabi/python3-wxpython/4.1.1-r0/recipe-sysroot/usr/include/python3.8"
export PYTHON_LIBRARY="/home/steve/builds/rt-yocto-setup-fsl/build/tmp/work/armv7at2hf-neon-reach-linux-gnueabi/python3-wxpython/4.1.1-r0/recipe-sysroot/usr/lib/libpython3.8.so"
export RANLIB=“arm-reach-linux-gnueabi-gcc-ranlib”
export READELF=“arm-reach-linux-gnueabi-readelf”
unset SHELL
export STAGING_INCDIR="/home/steve/builds/rt-yocto-setup-fsl/build/tmp/work/armv7at2hf-neon-reach-linux-gnueabi/python3-wxpython/4.1.1-r0/recipe-sysroot/usr/include"
export STAGING_LIBDIR="/home/steve/builds/rt-yocto-setup-fsl/build/tmp/work/armv7at2hf-neon-reach-linux-gnueabi/python3-wxpython/4.1.1-r0/recipe-sysroot/usr/lib"
export STRINGS=“arm-reach-linux-gnueabi-strings”
export STRIP=“arm-reach-linux-gnueabi-strip”
unset TARGET_ARCH
export TERM=“xterm-256color”
export TZ=“UTC”
export USER=“steve”

I examined the build scripts and really couldn’t see a way to add the --host option to configure cross compilation via the command line.

I ended up patching build_wxwidgets.py script to inject the desired --host option. I’m using the Yocto build tools, so my fix in the build recipe was the addition of:

do_configure_prepend() {
sed -i -e ‘s!configure_opts = []!configure_opts = ["–host=${TARGET_SYS}"]!’ ${S}/buildtools/build_wxwidgets.py
}