Hello!
I’ve been attempting at compiling libSDL2 (2.30) targeting Linux x86 32-bit from x86_64 platform without any success. My compiling environment is a Debian 9 stretch (x86_64) schroot on Debian 12 bookworm host.
From both autoconf and CMake I get some issue regarding glib-2.0 header and ibus:
In file included from /usr/lib/x86_64-linux-gnu/glib-2.0/include/glibconfig.h:9:0,
from /usr/include/glib-2.0/glib/gtypes.h:32,
from /usr/include/glib-2.0/glib/galloca.h:32,
from /usr/include/glib-2.0/glib.h:30,
from /usr/include/ibus-1.0/ibusshare.h:39,
from /usr/include/ibus-1.0/ibus.h:29,
from /[redacted]/SDL2-2.30.1/src/core/linux/SDL_ibus.h:30,
from /[redacted]/SDL2-2.30.1/src/core/linux/SDL_ime.c:24:
/usr/include/glib-2.0/glib/gtypes.h: In function ‘_GLIB_CHECKED_ADD_U64’:
/usr/include/glib-2.0/glib/gtypes.h:423:3: error: size of array ‘_GStaticAssertCompileTimeAssertion_0’ is negative
G_STATIC_ASSERT(sizeof (unsigned long long) == sizeof (guint64));
^
One thing I noticed is that this is using x86_64 include path, don’t know if this is expected when using gcc-multilib.
Here’s my script used for compiling:
#!/usr/bin/env bash
DFLAGS="-g -ggdb -ggdb3"
USER_FLAGS="-pipe -w"
OPTFLAGS="-O2"
ARCH="i686"
ARCH_FLAGS="-m32 -march=${ARCH} ${OPTFLAGS}"
BUILD="${ARCH}-pc-linux-gnu"
LDFLAGS="-shared -m32"
export CFLAGS="${DFLAGS} ${USER_FLAGS} ${ARCH_FLAGS}"
CMAKE_C_FLAGS="${CMAKE_C_FLAGS} ${CFLAGS}"
rm -R build_cmake
mkdir build_cmake
cd build_cmake
cmake .. \
-DSDL_ALSA=ON \
-DSDL_ALSA_SHARED=OFF \
-DSDL_ARTS=OFF \
-DSDL_COCOA=OFF \
-DSDL_DBUS=ON \
-DSDL_DIRECTFB=OFF \
-DSDL_DIRECTX=OFF \
-DSDL_ESD=OFF \
-DSDL_FUSIONSOUND=OFF \
-DSDL_HIDAPI=ON \
-DSDL_HIDAPI_JOYSTICK=ON \
-DSDL_IBUS=ON \
-DSDL_JACK=OFF \
-DSDL_JOYSTICK_MFI=OFF \
-DSDL_KMSDRM=OFF \
-DSDL_LIBSAMPLERATE=ON \
-DSDL_LIBSAMPLERATE_SHARED=OFF \
-DSDL_LIBUDEV=ON \
-DSDL_METAL=OFF \
-DSDL_NAS=OFF \
-DSDL_OPENGL=ON \
-DSDL_OPENGLES=ON \
-DSDL_PIPEWIRE=ON \
-DSDL_PULSEAUDIO=ON \
-DSDL_PULSEAUDIO_SHARED=OFF \
-DSDL_RENDER_D3D=OFF \
-DSDL_RPATH=OFF \
-DSDL_RPI=OFF \
-DSDL_SHARED=ON \
-DSDL_SNDIO=OFF \
-DSDL_SSE2=ON \
-DSDL_SSE3=ON \
-DSDL_STATIC=OFF \
-DSDL_TEST=OFF \
-DSDL_VIVANTE=OFF \
-DSDL_VULKAN=ON \
-DSDL_WASAPI=OFF \
-DSDL_WAYLAND=ON \
-DSDL_WAYLAND_LIBDECOR=ON \
-DSDL_WAYLAND_SHARED=OFF \
-DSDL_X11=ON \
-DSDL_X11_SHARED=OFF \
-DSDL_XINPUT=OFF \
-DSDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS=1
make -j14
Would I need a pure x86 32-bit chroot environment for compiling or am I missing something here?
Thanks!