SDL config and emconfigure (for Dosbox)

510 views
Skip to first unread message

skierpage

unread,
Jan 2, 2012, 8:11:20 AM1/2/12
to emscripten-discuss
The demos of http://sourceforge.net/projects/jsdosbox/ aren't working
for me (it recommends Chrome :-( ) and its Java -> GWT -> JS approach
seems dubious, so I'm attempting to build Dosbox with emscripten.
(Has anyone succeeded after @Hee Hoo's messages to the mailing list
back in June?)

The emscripten tutorial works great, next
https://github.com/kripken/emscripten/wiki/Building-Projects suggests
I run
% emconfigure ./configure
for Dosbox, but it fails with
checking for sdl-config... /usr/bin/sdl-config
checking for SDL - version >= 1.2.0... no
*** Could not run SDL test program, checking why...
*** The test program failed to compile or link. ...

config.log shows it's trying to compile and link a test program with
emcc, but failing to find a libSDL it likes (linker output below). At
first that seems obvious as emscripten will be using its JavaScript
SDL implementation not a system library, but emconfigure says "What
happens is that all compilations done during this command are to
native code, not JS, so that configure tests will work properly."

Fine, so I tried
% emconfigure ./configure --disable-sdltest
but that fails with
checking for sdl-config... /usr/bin/sdl-config
checking for SDL - version >= 1.2.0... yes
checking SDL version only being 1.2.X... no
configure: error: Only libSDL 1.2.X supported

I think that fails because emscripten's ./system/include/SDL/
SDL_version.h has:
#define SDL_MINOR_VERSION 3
but my system (Kubuntu 11.10) has libsdl1.2debian-alsa and libsdl1.2-
dev installed and so sdl_version reports 1.2.14.

I wonder what the best fix is: specify a different sdl-config binary
just for enscriptem (maybe enscriptem could include one and
emconfigure could set SDL_CONFIG to it?), get configure to trust the
enscriptem headers, disable this part of configure altogether and hand-
merge settings with a native ./configure run, or ?

Thanks for suggestions, and an amazing tool!

- - - - - Output from % emconfigure ./configure follows - - - - -

configure:4472: result: /usr/bin/sdl-config
configure:4481: checking for SDL - version >= 1.2.0
configure:4576: /opt/download/emscripten/emcc -o conftest -m32 -
U__i386__ -U__x86_64__ -U__i386 -U__x86_64 -U__SSE__ -U__SSE2__ -
U__MMX__ -UX87_DOUBLE_ROUNDING -UHAVE_GCC_ASM_FOR_X87 -DEMSCRIPTEN -
U__STRICT_ANSI__ -U__CYGWIN__ -D__STDC__ -nostdinc -I/opt/download/
emscripten/system/include -I/opt/download/emscripten/system/include/
bsd -I/opt/download/emscripten/system/include/libc -I/opt/download/
emscripten/system/include/libcxx -I/opt/download/emscripten/system/
include/gfx -I/opt/download/emscripten/system/include/net -I/opt/
download/emscripten/system/include/SDL -U__APPLE__ -I/usr/include/SDL -
D_GNU_SOURCE=1 -D_REENTRANT conftest.c -L/usr/lib -lSDL >&5

/usr/bin/ld: skipping incompatible /usr/lib/libSDL.so when searching
for -lSDL
/usr/bin/ld: skipping incompatible /usr/lib/libSDL.a when searching
for -lSDL
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/
4.6/../../../libSDL.so when searching for -lSDL
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/
4.6/../../../libSDL.a when searching for -lSDL
/usr/bin/ld: skipping incompatible /usr/lib/libSDL.so when searching
for -lSDL
/usr/bin/ld: skipping incompatible /usr/lib/libSDL.a when searching
for -lSDL
/usr/bin/ld: skipping incompatible /usr/lib/libSDL.so when searching
for -lSDL
/usr/bin/ld: skipping incompatible /usr/lib/libSDL.a when searching
for -lSDL
/usr/bin/ld: cannot find -lSDL
clang: error: linker command failed with exit code 1 (use -v to see
invocation)

Alon Zakai

unread,
Jan 2, 2012, 1:29:08 PM1/2/12
to emscripte...@googlegroups.com
On Mon, Jan 2, 2012 at 5:11 AM, skierpage <skie...@gmail.com> wrote:
> so I tried
>  % emconfigure ./configure --disable-sdltest
> but that fails with
>  checking for sdl-config... /usr/bin/sdl-config
>  checking for SDL - version >= 1.2.0... yes
>  checking SDL version only being 1.2.X... no
>  configure: error: Only libSDL 1.2.X supported
>
> I think that fails because emscripten's ./system/include/SDL/
> SDL_version.h has:
>  #define SDL_MINOR_VERSION    3
> but my system (Kubuntu 11.10) has libsdl1.2debian-alsa and libsdl1.2-
> dev installed and so sdl_version reports 1.2.14.
>

Hmm, does DosBox really need exactly 1.2, and not 1.3? I wonder if it
isn't just being conservative in the configure check... Simplest thing
might be to change 3 to 2 in the emscripten header there, and see what
happens. But, if DosBox really does not work with API changes to SDL
in 1.3, there might be a problem (perhaps an easy to fix one, perhaps
not).

- azakai

skierpage

unread,
Jan 3, 2012, 3:06:21 AM1/3/12
to emscripten-discuss
> On Mon, Jan 2, 2012 at 5:11 AM, skierpage wrote:
> > so I tried
> >  % emconfigure ./configure --disable-sdltest
> > but that fails with
> >  configure: error: Only libSDL 1.2.X supported

On Jan 2, 10:29 am, Alon Zakai replied:
> Hmm, does DosBox really need exactly 1.2, and not 1.3? I wonder if it
> isn't just being conservative in the configure check... Simplest thing
> might be to change 3 to 2 in the emscripten header there, and see what
> happens.

Thanks, changing 3 to 2 in emscripten's SDL/SDL_version.h got past
this check.

> But, if DosBox really does not work with API changes to SDL
> in 1.3, there might be a problem (perhaps an easy to fix one, perhaps
> not).

I don't know. The ./configure from http://source.dosbox.com/dosboxsvn.tgz
has this specific check for libSDL 1.2.X in it...

Anyway, I got more failures from `emconfig./configure` after that, for
even simple tests like "checking for unsigned char", because the
compiler command for all of them has the -lSDL output by `sdl-config --
libs` even if you use --disable-sdltest, and then the compiles fail
after the bunch of "/usr/bin/ld: skipping incompatible /usr/lib/
libSDL.so when searching for -lSDL" errors I listed in my original
message. So I tried my idea
>> specify a different sdl-config binary just for enscriptem
>> (maybe enscriptem could include one and emconfigure could set SDL_CONFIG to it?)

I created a modified em_sdl-config script that doesn't output -lSDL,
doesn't add system -I${prefix}/include/SDL since emconfigure adds its
own, etc., and then adding to tools/shared.py
env['SDL_CONFIG'] = path_from_root('em_sdl-config') # Override the
sdl-config utility in the SDL dev package.

That successfully completes configure. I don't know whether DOSBox's
use of the sdl-config utility in./configure is common, so I don't know
if it's worth emscripten shipping with this workaround.

Now I'll try `make`. Thanks so much!
--
=S Page

Alon Zakai

unread,
Jan 3, 2012, 1:32:57 PM1/3/12
to emscripte...@googlegroups.com

I think it would be common, an sdl-config replacement would be useful
for other projects too since it's the normal way to compile with SDL.
A pull request would be much appreciated :)

- azakai

Gopiprasad Ravada

unread,
Jul 28, 2015, 9:57:17 AM7/28/15
to emscripten-discuss, alonm...@gmail.com
Could you pleas eprovide me the source code and steps to cross compile dosbox for ARM
Reply all
Reply to author
Forward
0 new messages