Linux-arm support
HI
I'm trying to use this for joystick support on a raspberry pi, but I hit a wall as linux-arm isn't supported. Seems like there are no native files included for that. Would this be possible to add?
-Aron
I got a bit of a start on this, but it needs a bit more finessing to work... https://gist.github.com/smoogipoo/fb2c69d8298967e20e9de69b4c8e99a8
Nice! Any estimate on when it would be released?
Meanwhile, I looked into compiling SDL for Arm in WSL, and might have something. However, I need to test it out in the PI, which I can do tomorrow.
I don't have an estimate, sorry. It's pretty low on my priority list but I'll take a look into it again this weekend if no one's got it working themselves.
So what I was able to compile in WSL yesterday works, and boils down to the following steps:
apt-get install gcc
apt install make
apt-get install gcc-arm-linux-gnueabihf
wget https://www.libsdl.org/release/SDL2-2.0.22.tar.gz
tar zxvf SDL2-2.0.22.tar.gz
mkdir SDL2-2.0.22/build
cd SDL2-2.0.22/build
../configure CC=arm-linux-gnueabihf-gcc --host=arm-linux-gnueabihf --disable-alsa --disable-pulseaudio --enable-esd=no
make
copying ~/SDL2-2.0.22/build/build/.libs/libSDL2-2.0.so.0 to the published app on the PI, and renaming it to libSDL2.so made my application run.
I decided to take a crack at the Dockerfile you where working on, and got it to build, but couldn't get the output to run.
FROM ubuntu:20.04
RUN apt-get update -y
# RUN echo "deb [arch=arm64] http://ports.ubuntu.com/ focal main multiverse universe" >> /etc/apt/sources.list
# RUN echo "deb [arch=arm64] http://ports.ubuntu.com/ focal-security main multiverse universe" >> /etc/apt/sources.list
# RUN echo "deb [arch=arm64] http://ports.ubuntu.com/ focal-backports main multiverse universe" >> /etc/apt/sources.list
# RUN echo "deb [arch=arm64] http://ports.ubuntu.com/ focal-updates main multiverse universe" >> /etc/apt/sources.list
# RUN dpkg --add-architecture arm64
# RUN apt-get update -y -qq | true
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y \
# gcc-multilib \
# g++-multilib \
cmake \
ninja-build \
wayland-scanner++ \
wayland-protocols \
pkg-config:amd64 \
libasound2-dev:amd64 \
libdbus-1-dev:amd64 \
libegl1-mesa-dev:amd64 \
libgl1-mesa-dev:amd64 \
libgles2-mesa-dev:amd64 \
libglu1-mesa-dev:amd64 \
libibus-1.0-dev:amd64 \
libpulse-dev:amd64 \
libsdl2-2.0-0:amd64 \
libsndio-dev:amd64 \
libudev-dev:amd64 \
libwayland-dev:amd64 \
libx11-dev:amd64 \
libxcursor-dev:amd64 \
libxext-dev:amd64 \
libxi-dev:amd64 \
libxinerama-dev:amd64 \
libxkbcommon-dev:amd64 \
libxrandr-dev:amd64 \
libxss-dev:amd64 \
libxt-dev:amd64 \
libxv-dev:amd64 \
libxxf86vm-dev:amd64 \
libdrm-dev:amd64 \
libgbm-dev:amd64 \
libpulse-dev:amd64 \
gcc-aarch64-linux-gnu:amd64 \
g++-aarch64-linux-gnu:amd64 \
git
RUN git clone https://github.com/libsdl-org/SDL
WORKDIR /SDL
RUN CFLAGS=-march=armv8-a \
CXXFLAGS=-march=armv8-a \
cmake \
-B build \
-GNinja \
-DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc \
-DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ \
-DCMAKE_BUILD_TYPE=Release \
-DSDL_SHARED_ENABLED_BY_DEFAULT=ON \
-DSDL_STATIC_ENABLED_BY_DEFAULT=ON \
# Added these two
-DSDL_PULSEAUDIO=OFF \
-DSDL_WAYLAND=OFF
RUN cmake \
--build build/ \
--config Release
I took a small look at it again, as i thought it might have been been an architecture issue, and it probably was. Seems like what I compiled in WSL is 32-bit and what I compiled with my dockerfile is 64-bit, which would probably cause it to not work. I believe my software is 32-bit.
This is the output from file command in WSL:
libSDL2-2.0.so.0.22.0: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, BuildID[sha1]=800a6f3117c45f3ce1712888f2dca24377bc469f, with debug_info, not stripped
And this is from file command in the docker container:
libSDL2-2.0.so.0.2301.0: ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked, BuildID[sha1]=01aa43374c7f0b84a910f1e789a79f6fa0093b41, not stripped
I'm in no way an expert in compiling and using the different tool chains. 😅 But I hope it makes sense.
I didn't get to this one over the weekend, but looks promising. Didn't consider that your arch would be 32b :smile: Not sure about disabling pulse + wayland - I'd expect capabilities to be the same as the other archs.
I think the PI is 64 bit, so either should be fine. I can try 64 bit out tomorrow and come back. I read somewhere that pulse and wayland caused issues for others compiling SDL for the PI (I guess ARM in general) which is why I disabled it. -Also I don't need it, but I get that others might?.. But anyways, for now I got what I need so don't worry too much about it 😊
For future reference, I found this earlier which might come in useful: https://github.com/lovell/sharp-libvips/blob/main/linux-armv7/Dockerfile It uses Debian rather than Ubuntu which is something I thought of doing initially.
I quickly tried to publish my app for linux-arm64 but it didn't start up at all, as in the Net6.0 app didn't even load. Therefore I never got to see if my 64 bit SDL compilation worked either. Sadly, I won't have access to the PI anymore, as it was a setup for someone else.
I have some changes (https://github.com/Ryujinx/SDL2-CS/commit/275e67ad1142e3038094511f5bb3e698b853d875 and https://github.com/Ryujinx/SDL2-CS/commit/2402c1a0dbc90787cbd4e7e9547290b6b6ebff23) for Ryujinx's SDL2-CS fork to support linux-arm64, would you be fine with me upstreaming it @peppy?
Should be fine, yes.