Issues compiling a sdl program on KOS
-
- Insane DCEmu
- Posts: 112
- https://www.artistsworkshop.eu/meble-kuchenne-na-wymiar-warszawa-gdzie-zamowic/
- Joined: Sat Sep 22, 2007 9:43 pm
- Location: Braga - Portugal
- Has thanked: 0
- Been thanked: 0
Issues compiling a sdl program on KOS
I'm using Chui's SDL, but i'm having issues at linking time.
this is what i get :
http://rafb.net/p/TYstE241.html
Any thoughts ?
Best Regards
Jae686
I believe the issue is related to the paths. "/opt/dc/kos-ports/SDL_image-1.2.4/IMG_bmp.c" does not match my enviroment.
my enviro.h matches my enviroment, so, is this path hardcoded in the libary ?
or the precompiled libaries are not enough ? (both the precompiled and source code of the libaries ? )
this is what i get :
http://rafb.net/p/TYstE241.html
Any thoughts ?
Best Regards
Jae686
I believe the issue is related to the paths. "/opt/dc/kos-ports/SDL_image-1.2.4/IMG_bmp.c" does not match my enviroment.
my enviro.h matches my enviroment, so, is this path hardcoded in the libary ?
or the precompiled libaries are not enough ? (both the precompiled and source code of the libaries ? )
-
- Psychotic DCEmu
- Posts: 577
- Joined: Mon Aug 11, 2008 9:34 am
- Location: Nowhere U.S.A.
- Has thanked: 0
- Been thanked: 0
Re: Issues compiling a sdl program on KOS
You could also try posing this question over at the Dreamcast.es forums, but registration is required.
-
- Insane DCEmu
- Posts: 112
- Joined: Sat Sep 22, 2007 9:43 pm
- Location: Braga - Portugal
- Has thanked: 0
- Been thanked: 0
Re: Issues compiling a sdl program on KOS
I sure will. They do have a pretty active scene!Stryfe wrote:You could also try posing this question over at the Dreamcast.es forums, but registration is required.
thx!
-
- Damn Dirty Ape
- Posts: 5031
- Joined: Thu Nov 07, 2002 11:11 pm
- Location: Saugerties, NY
- Has thanked: 0
- Been thanked: 0
Re: Issues compiling a sdl program on KOS
You don't seem to have the KOS libs listed after SDL etc in the link order in the makefile you posted--you just stop with libfreetype, so unless I missed something, you don't actually have KOS linked into your program. Also, your link order is what is causing the errors with SDL_Image. Try changing this:
to
Code: Select all
$(TARGET): $(OBJS)
kos-cc -o $(TARGET) $(OBJS) -lSDL -lSDL_129 -lSDL_image_124 -lm -ljpeg -lpng -lz -lfreetype
Code: Select all
$(TARGET): $(OBJS)
kos-cc -o $(TARGET) $(OBJS) -lSDL_image_124 -lSDL_129 -ljpeg -lpng -lz -lm -lfreetype $(KOS_LIBS)
-
- Insane DCEmu
- Posts: 112
- Joined: Sat Sep 22, 2007 9:43 pm
- Location: Braga - Portugal
- Has thanked: 0
- Been thanked: 0
Re: Issues compiling a sdl program on KOS
It solved my problem, thank you!
My code now compiles, but when i run this code
I get (on lxdream) the following error
I call the above code 4 times in a row, but it crashes at the 2nd call.
My code now compiles, but when i run this code
Code: Select all
SDL_Surface *ruido(int size_x, int size_y, SDL_Surface *sur_ref) //Devolve uma surface com ruido de tamanho x,y com o mesmo formato da superficie dada
{
printf("\n dentro da funcao ruido \n");
fflush(stdout);
SDL_Surface *bloco_ruido;
bloco_ruido = SDL_CreateRGBSurface(SDL_HWSURFACE, size_x, size_y,sur_ref->format->BitsPerPixel,
sur_ref->format->Rmask, sur_ref->format->Gmask, sur_ref->format->Bmask, sur_ref->format->Amask); // devolve a *surface
if(bloco_ruido == NULL)
{
printf("\n SDL_CreateRGBSurface falhou \n");
fflush(stdout);
}
if ( SDL_MUSTLOCK (bloco_ruido))
{
SDL_LockSurface(bloco_ruido);
}
//int bpp = bloco_ruido->format->BytesPerPixel;
int i, j, yofs, ofs;
// Draw to screen
yofs = 0;
for (i = 0; i < size_y ; i++)
{
for (j = 0, ofs = yofs; j < size_x; j++, ofs++)
{
((unsigned int*)bloco_ruido->pixels)[ofs] = preto_branco(bloco_ruido);
}
yofs += bloco_ruido->pitch / 4;
}
SDL_UnlockSurface(bloco_ruido);
return bloco_ruido;
}
Code: Select all
*** ASSERTION FAILURE ***
Assertion "(old_top == initial_top(av) && old_size == 0) || ((CHUNK_SIZE_T) (old_size) >= MINSIZE && prev_inuse(old_top))" failed at malloc.c:3594 in `sYSMALLOc'
-
- Damn Dirty Ape
- Posts: 5031
- Joined: Thu Nov 07, 2002 11:11 pm
- Location: Saugerties, NY
- Has thanked: 0
- Been thanked: 0
Re: Issues compiling a sdl program on KOS
SDL_CreateRGBSurface is allocating memory every time you call your ruido function. Is it possible that you're running out of memory?
-
- Insane DCEmu
- Posts: 112
- Joined: Sat Sep 22, 2007 9:43 pm
- Location: Braga - Portugal
- Has thanked: 0
- Been thanked: 0
Re: Issues compiling a sdl program on KOS
Yup, i guess that was the problem ! I was creating 4 640*480 images, plus loading some 4 320*240 images at run time. I should only load images when required instead of loading them all at the start of the program...
Thank you!
PS. Then I use the "romdisk aproach", are the files on the bootdisk placed on ram when the code is loaded ?
Can't i have a "iso9660" filesystem?
Thank you!
PS. Then I use the "romdisk aproach", are the files on the bootdisk placed on ram when the code is loaded ?
Can't i have a "iso9660" filesystem?
- henzenmann
- Insane DCEmu
- Posts: 186
- Joined: Wed Jul 12, 2006 4:58 pm
- Has thanked: 0
- Been thanked: 0
- Contact:
Re: Issues compiling a sdl program on KOS
Yes and yes:Jae686 wrote:PS. Then I use the "romdisk aproach", are the files on the bootdisk placed on ram when the code is loaded ?
Can't i have a "iso9660" filesystem?
- The romdisk image is embedded in your executable, and therefore loaded into RAM.
- You can also use an ISO filesystem.
-
- Damn Dirty Ape
- Posts: 5031
- Joined: Thu Nov 07, 2002 11:11 pm
- Location: Saugerties, NY
- Has thanked: 0
- Been thanked: 0
Re: Issues compiling a sdl program on KOS
If using a romdisk, the files that are contained in the romdisk image are in RAM at boot time, but not the files that you just have on the CD alongside your binary. The romdisk is (typically) part of your binary. You can create romdisk images to store on the CD and mount/unmount them as needed also, but if the romdisk image is mounted, its contents are in RAM.
You can use an iso9660 filesystem--that's the kind of filesystem used on the CD-R. If you know what you are doing, it is relatively easy to modify the iso9660 code that comes with KOS to create a version that will let you use an iso or bin/cue image in a way that is similar to the romdisk image, if that is what you are asking.
You can use an iso9660 filesystem--that's the kind of filesystem used on the CD-R. If you know what you are doing, it is relatively easy to modify the iso9660 code that comes with KOS to create a version that will let you use an iso or bin/cue image in a way that is similar to the romdisk image, if that is what you are asking.
-
- Damn Dirty Ape
- Posts: 5031
- Joined: Thu Nov 07, 2002 11:11 pm
- Location: Saugerties, NY
- Has thanked: 0
- Been thanked: 0
Re: Issues compiling a sdl program on KOS
I haven't done any DC coding in a few years but if I recall correctly, SDL_Image didn't require any special trickery to work with KOS as it relies on SDL to handle the platform-specific stuff. Basically just create a new makefile for it based on the makefile for another library in the kos-ports tree and you should be on your way. But as I said, it's been years since I used SDL_Image on the Dreamcast so I could be forgetting something.