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 2335

Summary: Fails to build on Debian GNU/kFreeBSD
Product: SDL Reporter: Felix Geyer <debfx>
Component: *don't know*Assignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: HG 2.0   
Hardware: x86_64   
OS: FreeBSD   
Attachments: SDL_cpuinfo.c build fix for kFreeBSD

Description Felix Geyer 2014-01-05 12:42:44 UTC
Created attachment 1514 [details]
SDL_cpuinfo.c build fix for kFreeBSD

Starting from version 2.0.1 libsdl fails to build on Debian GNU/kFreeBSD in SDL_cpuinfo.c.

GNU/kFreeBSD defines __FreeBSD_kernel__ but not __FreeBSD__.
The #ifdef __FreeBSD__ check should be extended for __FreeBSD_kernel__, see the attached patch.

Build log:
libtool: compile:  gcc -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -DUSING_GENERATED_CONFIG_H -Iinclude -I/«BUILDDIR»/libsdl2-2.0.1+dfsg1/include -mmmx -m3dnow -msse -msse2 -fvisibility=hidden -D_REENTRANT -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-kfreebsd-gnu/dbus-1.0/include -DHAVE_USBHID_H -DUSBHID_NEW -D_REENTRANT -Wall -c /«BUILDDIR»/libsdl2-2.0.1+dfsg1/src/cpuinfo/SDL_cpuinfo.c  -fPIC -DPIC -o build/.libs/SDL_cpuinfo.o
/«BUILDDIR»/libsdl2-2.0.1+dfsg1/src/cpuinfo/SDL_cpuinfo.c: In function 'SDL_GetSystemRAM':
/«BUILDDIR»/libsdl2-2.0.1+dfsg1/src/cpuinfo/SDL_cpuinfo.c:632:35: error: 'HW_MEMSIZE' undeclared (first use in this function)
             int mib[2] = {CTL_HW, HW_MEMSIZE};
                                   ^
/«BUILDDIR»/libsdl2-2.0.1+dfsg1/src/cpuinfo/SDL_cpuinfo.c:632:35: note: each undeclared identifier is reported only once for each function it appears in
make[2]: *** [build/SDL_cpuinfo.lo] Error 1
Comment 1 Ryan C. Gordon 2014-02-22 22:50:02 UTC
Out of curiousity, is this the only patch needed to fix the build on Debian GNU/kFreeBSD?

--ryan.
Comment 2 Sam Lantinga 2014-02-23 02:01:55 UTC
Fixed, thanks!
https://hg.libsdl.org/SDL/rev/334257cd613d
Comment 3 Felix Geyer 2014-02-23 09:58:40 UTC
Thanks, this is the only change necessary to build on GNU/kFreeBSD.
Comment 4 Ryan C. Gordon 2014-02-24 15:32:12 UTC
(In reply to Felix Geyer from comment #3)
> Thanks, this is the only change necessary to build on GNU/kFreeBSD.

Cool, I'll add a GNU/kFreeBSD to the buildbot system then.  :)

--ryan.
Comment 5 Ryan C. Gordon 2014-02-24 16:54:32 UTC
> Cool, I'll add a GNU/kFreeBSD to the buildbot system then.  :)

...and now I have: https://buildbot.libsdl.org/builders/sdl-kfreebsd-amd64

This will automatically build every new revision to SDL and email us if we break the build on this platform.

--ryan.