mntmn / interim

The Interim Operating System
1.24k stars 56 forks source link

SDL1 port no longer compiles on Open Pandora #21

Closed sviscapi closed 5 years ago

sviscapi commented 5 years ago

Hi,

I'm Sam aka Magic Sam from the Open Pandora community, an handheld computer running GNU/Linux ARM (TI OMAP3). We chatted (with @wasamasa too) on IRC some days ago :)

https://www.pyra-handheld.com/boards/pages/pandora/

I'm trying to build Interim OS' SDL1 port with GCC 8.1, since I'm not too comfortable with SDL2...

My build script reads as follows:

/media/Pandora1/dev/interim/sledge$ cat build_pandora.sh

!/bin/sh

if [ uname = "Darwin" ] ; then CFLAGS="${CFLAGS} -I/opt/local/include -L/opt/local/lib -framework Cocoa" fi

if [ uname -n = "pandora" ] ; then CFLAGS="${CFLAGS} -I/mnt/utmp/codeblocks/usr/include -L/mnt/utmp/codeblocks/usr/lib" fi

cc -g -o sledge --std=gnu99 -Wall -O1 -I. ${CFLAGS} sledge.c reader.c writer.c alloc.c strmap.c stream.c ../devices/sdl.c ../devices/posixfs.c -lm -lSDL -DCPU_ARM -DDEV_SDL -DDEV_POSIXFS

Default CFLAGS on the Pandora are:

-ffast-math -O3 -pipe -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp -ftree-vectorize -fsingle-precision-constant -fuse-ld=gold -fuse-linker-plugin -fsigned-char

Unfortunately, the compilation fails with this error:

/media/Pandora1/dev/interim/sledge$ ./build_pandora.sh In file included from sledge.c:9: compiler_new.c:58:14: warning: ���jit_out��� defined but not used [-Wunused-variable] static FILE jitout; ^~~ writer.c: In function ���write���: writer.c:166:39: warning: format ���%ld��� expects argument of type ���long int���, but argument 4 has type ���uint32_t��� {aka ���unsigned int���} [-Wformat=] snprintf(buffer, bufsize, "<tag:%ld>", cell->tag); ^ ~~~ %d ../devices/sdl.c: In function ���fbfs_mmap���: ../devices/sdl.c:89:11: error: ���Cell��� {aka ���struct Cell���} has no member named ���addr���; did you mean ���ar���? fbtest->addr = sdl_get_fb(); ^~~~ ar ../devices/sdl.c:90:9: error: ���Cell��� {aka ���struct Cell���} has no member named ���size��� fbtest->size = sdl_get_fbsize(); ^~ ../devices/sdl.c:91:39: error: ���Cell��� {aka ���struct Cell���} has no member named ���addr���; did you mean ���ar���? printf("fbtest->addr: %p\n",fbtest->addr); ^~~~ ar ../devices/sdl.c:92:38: error: ���Cell��� {aka ���struct Cell���} has no member named ���size��� printf("fbtest->size: %lx\n",fbtest->size); ^~ ../devices/sdl.c:94:18: error: ���Cell��� {aka ���struct Cell���} has no member named ���addr���; did you mean ���ar���? memset(fbtest->addr,0xff,WIDTHHEIGHTBPP); ^~~~ ar ../devices/sdl.c: In function ���keyfs_read���: ../devices/sdl.c:131:19: error: ���Cell��� {aka ���struct Cell���} has no member named ���addr���; did you mean ���ar���? ((uint8_t)res->addr)[0] = sdl_key; ^~~~ ar At top level: ../devices/sdl.c:73:12: warning: ���cursor_y��� defined but not used [-Wunused-variable] static int cursor_y = 0; ^~~~ ../devices/sdl.c:72:12: warning: ���cursor_x��� defined but not used [-Wunused-variable] static int cursor_x = 0; ^~~~ ../devices/sdl.c:71:12: warning: ���fb_state��� defined but not used [-Wunused-variable] static int fb_state = 0; ^~~~ ../devices/posixfs.c: In function ���posixfs_open���: ../devices/posixfs.c:65:56: warning: format ���%zu��� expects argument of type ���size_t���, but argument 2 has type ���off_t��� {aka ���long int���} [-Wformat=] printf("[posixfs] trying to read file of len %zu...\r\n",len); ^ ~ %lu

Could you please have a look ?

Best regards,

Sam

wasamasa commented 5 years ago

Hey Sam,

I've gone through the files and updated them to roughly match the SDL2 device. See https://github.com/mntmn/interim/pull/22 for the fix. You'll need to adjust the related build script to use -lSDL, but I'm sure you've figured out that one already. I've tested https://github.com/wasamasa/interim/blob/next/sledge/demos/palette.l and it works as expected. Further fixes may be necessary to achieve feature parity.

sviscapi commented 5 years ago

@wasamasa : thank you very much for your time and efforts, that's really appreciated :D Could you (or @mntmn) please tell me how to fetch your changes from your repo's SDL1.2 branch into my local copy of @mntmn 's reform branch (required on hosted ARM) ?

If that's not convenient and / or not the right thing to do, I may as well wait for @mntmn to accept your pull request, there's no hurry :)

Cheers, Sam

wasamasa commented 5 years ago

The easiest way is downloading the raw patch at https://patch-diff.githubusercontent.com/raw/mntmn/interim/pull/22.patch and applying it with git apply 22.patch.