Can't Compile SDL2 For 32-Bit on 64-Bit Ubuntu Using Arm GNU Toolchain

136 Views Asked by At

Background

I am trying to cross compile SDL2 using the Arm GNU Toolchain. My host is Ubuntu 22.04.3 LTS running on WSL and my target is a 32-bit Cortex-A7. I have successfully compiled and ran "Hello World" with this setup, so my next step is to compile "Hello World" while including SDL2. Here's the file:

#include <stdio.h>
#include <SDL.h>
int main()
{
  printf("Hello SDL2");
  return 0;
}

Here is the command I am using:

<path-to-compilers>/arm-none-linux-gnueabihf-gcc -static hellosdl2.c -o hellosdl2 -I /usr/include/SDL2 -I /usr/include/i386-linux-gnu -DSDL_DISABLE_IMMINTRIN_H

I am able to avoid the classic "No such file SDL2.h" error message by including the install paths of the 64 and 32 bit versions of the SDL2. (Downloaded using apt-get install libsdl2-dev libsdl2-dev:i386) I am also able to avoid the error "immintrin.h: No such file or directory" by using the -DSDL_DISABLE_IMMINTRIN_H flag.

Problem:

I cannot resolve this error:

In file included from /usr/include/SDL2/SDL_stdinc.h:90,
                 from /usr/include/SDL2/SDL_main.h:25,
                 from /usr/include/SDL2/SDL.h:32,
                 from hellosdl2.c:2:
/usr/include/i386-linux-gnu/bits/mathcalls-helper-functions.h:20:40: error: ‘_Float128’ is not supported on this target
   20 | __MATHDECL_ALIAS (int, __fpclassify,, (_Mdouble_ __value), fpclassify)

It looks like the SDL2 library is configured to build for a 64-bit target, and the compiler keeps catching that. I believe I'm missing a flag or a dependency. I have perused the interwebs for information on compiling SDL2 on a 32-bit target but haven't seen this situation anywhere.

0

There are 0 best solutions below