PDA

View Full Version : Lazarus FreePascal and SDL on Ubuntu...



savage
02-02-2008, 08:07 PM
Hi all,
Is anyone where using UBuntu with Lazarus, FreePascal and JEDI-SDL?
In the past when I have compiled stuff it it was a simple case of

fpc -Sd Myproject.dpr
and it would just work assuming I have everything set up.

With Ubuntu I'm trying to compile a Mac OS X app over to Linux and include some LCL code to boot. I'm using the following command line...



fpc YoYo70.lpr -S2d -OG1 -k-lSDL -k-lSDL_mixer -ve -Fl/usr/lib/ -Fu/usr/share/lazarus/lcl/units/i386-linux/ -Fu/usr/share/lazarus/lcl/units/i386-linux/gtk/ -Fu/usr/share/lazarus/packager/units/i386-linux/ -Fu. -FUobjs/ -dLCL -dLCLgtk


Everything compiles, but at the linking stage I'm getting the following error



Linking YoYo70
/usr/bin/ld: cannot find -lSDLMain
YoYo70.lpr(137,1) Error: Error while linking

Any ideas?

This was working yesterday, but the moment I updated the project's source files it started throwing this error.
I've never had this -lSDLMain error before on Linux.

technomage
02-02-2008, 09:56 PM
Dom

I've just compiled a JEDI-SDL app on my Virtual Ubuntu with no problems at all. Try leaving out the -k options.

Dean

Almindor
04-02-2008, 10:58 AM
Which SDL are you using? The one in FPC (2.2.0+) is perfectly working without any of the voodoo stuff you're doing eg:



program x;

uses
SDL, SDL_Image, SDL_Mixer, SDL_ttf;

begin
// whatever
end.


Compiles simply with:

fpc -O2 -XX -Xs ./program.pas

(I included "release class" switches but fpc ./program.pas would work just as well).

Specifying link paths is simply not required. AFAIK JEDI-SDL included our changes eventually too so theirs should work just as well (just specify paths to the .pas files if you use 3rd party one).

savage
04-02-2008, 11:23 PM
Hi Guys,
I just realised what is causing the problem. Due to cross compilation under Mac OS X, I have a {$LINKLIB SDLMain} statment which was causing the error message mentioned earlier.

So my next question is I have a IFDEF UNIX around this code because Mac OS X is Unix, but how can I then differentiate between the various flavours of Unix in my if def? Can I IFDEF Linux or IFDEF MacOS?

Thanks.

technomage
05-02-2008, 10:27 AM
you need

{$IFDEF DARWIN}

for Macosx and

{$IFDEF LINUX}

linux base platforms.

savage
05-02-2008, 10:40 AM
Thanks Dean, that should sort out the malaise.