We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 4558

Summary: error while loading shared libraries: libSDL-1.2.so.0: wrong ELF class: ELFCLASS64
Product: sdl12-compat Reporter: spzakulec
Component: everythingAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED INVALID QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: unspecified   
Hardware: x86_64   
OS: Linux   

Description spzakulec 2019-03-20 23:44:33 UTC
Hi, I'm trying to test out sdl12-compat with my set of SDL 1.2 games, and several of them have the following message:
error while loading shared libraries: libSDL-1.2.so.0: wrong ELF class: ELFCLASS64

I've compiled the sdl12-compat using this: gcc -o libSDL-1.2.so.0 -fvisibility=hidden -shared -fPIC -Wall -O0 -ggdb3 -Wl,-soname,libSDL-1.2.so.0 src/SDL12_compat.c `sdl2-config --cflags`-ldl -lm

I then rename the old libSDL-1.2.so.0 file in the game's directory to orig-libSDL-1.2.so.0, and paste in the compat library to take its place.

Both Aquaria & Crayon Physics Deluxe show this error message in the terminal when trying to run them.

./aquaria: error while loading shared libraries: libSDL-1.2.so.0: wrong ELF class: ELFCLASS64

./crayon: error while loading shared libraries: libSDL-1.2.so.0: wrong ELF class: ELFCLASS64

The rest of my system specs:
Kubuntu 18.10 64 bit
Kernel: 4.18.0-15-generic
KDE 5.13.5

Thanks!
Comment 1 Ryan C. Gordon 2019-03-22 13:53:24 UTC
So what this is telling you is that libSDL-1.2.so.0 is a 64-bit library, but the game in question is 32-bit.

Assuming you have a 32-bit SDL2 somewhere, which sdl12-compat will eventually try to load in this case, you can probably get a 32-bit libSDL-1.2.so.0 by adding "-m32" to your compile command line.

(you might need some 32-bit compatibility packages installed, too, but hopefully this will Just Work when you use -m32.)

Building a 32-bit SDL2 on a 64-bit system with all the desired features turns out to be more difficult, so the quickest solution is to grab the prebuilt version out of the Steam Runtime, which tends to be built with all the features in a distro-agnostic way. 

If you have Steam installed, this is sitting in $HOME/steam/ubuntu12_32/steam-runtime/i386/usr/lib/i386-linux-gnu, but I've put a copy here for convenience, too:

https://icculus.org/~icculus/tmp/SDL2-x86-steam-runtime-03222019.tar.bz2

--ryan.