Bug 1968508

Summary: sdl-config fails to locate SDL.h and libSDL.so
Product: [Fedora] Fedora Reporter: Petr Pisar <ppisar>
Component: sdl12-compatAssignee: Neal Gompa <ngompa13>
Status: CLOSED RAWHIDE QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: icculus, ngompa13, sergio
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: sdl12-compat-0.0.1~git.20210609.efe9791-1.fc35 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-06-09 12:08:36 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1967544    

Description Petr Pisar 2021-06-07 13:18:25 UTC
I copied checkkeys.c from SDL-1.2.15/docs to /tmp to verify that sdl12-compat-devel is API-compatible. It's a simple SDL application starting with:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "SDL.h"

and written in line with SDL_Quit(3) etc. manual pages. Look how it works with SDL-devel:

$ gcc $(sdl-config --cflags) checkkeys.c $(sdl-config --libs)
$ echo gcc $(sdl-config --cflags) checkkeys.c $(sdl-config --libs)
gcc -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT checkkeys.c -lSDL -lpthread
$ scanelf -n ./a.out
 TYPE   NEEDED FILE
ET_EXEC libSDL-1.2.so.0,libpthread.so.0,libc.so.6 ./a.out

Now upgrade to sdl12-compat-0.0.1~git.20210602.cc5826a-3.fc35.x86_64:

$ rm ./a.out
$ gcc $(sdl-config --cflags) checkkeys.c $(sdl-config --libs)
checkkeys.c:11:10: fatal error: SDL.h: No such file or directory
   11 | #include "SDL.h"
      |          ^~~~~~~
compilation terminated.
$ echo gcc $(sdl-config --cflags) checkkeys.c $(sdl-config --libs)
gcc -I/usr/include/SDL2 -D_GNU_SOURCE=1 -D_REENTRANT checkkeys.c -lSDL

So the new sdl-config places SDL.h to /usr/inclue/SDL2, but there none:

$ rpm -ql sdl12-compat-devel | grep SDL.h
/usr/include/SDL/SDL.h

I think there is a typo in the new sdl-config and it should point to /usr/include/SDL instead.

But that's not all. Lets correct on the command line:

$ gcc -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT checkkeys.c -lSDL
/usr/bin/ld: cannot find -lSDL
collect2: error: ld returned 1 exit status

There is no libSDL.so file:

$ rpm -ql sdl12-compat-devel | grep lib64
/usr/lib64/libSDL-1.2.so
/usr/lib64/pkgconfig/sdl12_compat.pc


In addition, sdl12_compat pkg-config also does not work:

$ cat /usr/lib64/pkgconfig/sdl12_compat.pc
# sdl12_compat pkg-config source file

prefix=/usr
exec_prefix=${prefix}
libdir=/usr/lib64
includedir=/usr/include

Name: sdl12_compat
Description: An SDL-1.2 compatibility layer that uses SDL 2.0 behind the scenes.
Version: 0.0.1
Provides: sdl = 1.2.50
Libs: -L${libdir}  -lSDL  -lpthread
Libs.private: -lSDL  -lpthread  -lm -ldl -lpthread
Cflags: -I${includedir}/SDL -D_GNU_SOURCE=1 -D_REENTRANT

because it cannot locate libSDL.so:

$ echo gcc $(pkg-config --cflags sdl) checkkeys.c $(pkg-config --libs sdl)
gcc -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT checkkeys.c -lSDL -lpthread
$ gcc $(pkg-config --cflags sdl) checkkeys.c $(pkg-config --libs sdl)
/usr/bin/ld: cannot find -lSDL
collect2: error: ld returned 1 exit status

Comment 1 Neal Gompa 2021-06-07 13:58:43 UTC
There's a PR upstream to fix this issue: https://github.com/libsdl-org/sdl12-compat/pull/82

Once merged, I'll update the package to resolve this.

Comment 2 Neal Gompa 2021-06-09 11:09:04 UTC
I've just pushed a new build that should have this fixed now: https://koji.fedoraproject.org/koji/buildinfo?buildID=1767135

Can you test, Petr?

Comment 3 Petr Pisar 2021-06-09 12:08:36 UTC
Awesome. Both sdl-config and pkg-config work now. Also perl-Alien-SDL stopped failing.

Comment 4 Sergio Basto 2021-06-09 14:22:21 UTC
Packages mlt and pinball built successfully .

Thank you.