Recent

Author Topic: Problems with using sdl with Lazarus.  (Read 6692 times)

Rave

  • Full Member
  • ***
  • Posts: 160
Problems with using sdl with Lazarus.
« on: June 02, 2011, 08:22:28 am »
Code: [Select]
I have troubles with using SDL with freepascal, specifically compile-time. I don't understand any of things that compiler says to me. The program is rather simple:
[code]PROGRAM chap3;
USES SDL, CRT;
VAR
screen,picture:pSDL_SURFACE;
source_rect,destination_rect:pSDL_RECT;

BEGIN
SDL_INIT(SDL_INIT_VIDEO);
SDL_QUIT;
END.       
It was more complex, but I got rid of most things so I can check what exactly causes troubles. The problem is that it seems that troublemaker is SDL unit itself. Here is compiler output for above:

[me@1.0.0.127~] fpc sdltest.pas
Free Pascal Compiler version 2.4.2 [2011/03/25] for i386
Copyright (c) 1993-2010 by Florian Klaempfl
Target OS: Linux for i386
Compiling sdltest.pas
sdltest.pas(4,1) Note: Local variable "screen" not used
sdltest.pas(4,8) Note: Local variable "picture" not used
sdltest.pas(5,1) Note: Local variable "source_rect" not used
sdltest.pas(5,13) Note: Local variable "destination_rect" not used
Linking sdltest
sdltest.pas(11,57) Error: Can't call the linker, switching to external linking
sdltest.pas(11,57) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
Error: /usr/bin/ppc386 returned an error exitcode (normal if you did not specify a source file to be compiled)[/code]
As you can see I've tried even compiling from console, but with same results as in Lazarus. Here is more detailed report wit -va: http://pastebin.com/PLn3TbAB

Thing I tried:
- Copying over JEDI-SDL's units over built-in ones in /usr/share/fpcsrc/packages/sdl (and of course after that recompiling them so FPC would know what to do with them)
- Reinstalling binutils, fpc and lazarus
- Removing fpc and fpc-src and lazarus and removing all fpc/lazarus related content from home directory, then installing them again.

Nothing of it worked. FPC is 2.4.2 and lazarus is 0.9.30

Please help me with that, because I want to make some games and eventually make game creation software similar to tools like Stencyl or Multimedia Fusion, but 100% open source (but of course I'll start with small things, I have list of goals I'll go with it)

Leledumbo

  • Hero Member
  • *****
  • Posts: 8111
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Problems with using sdl with Lazarus.
« Reply #1 on: June 02, 2011, 01:09:52 pm »
Do you have build-essentials or any package containing GNU linker installed? To ensure, try typing `ld` in your terminal.

Rave

  • Full Member
  • ***
  • Posts: 160
Re: Problems with using sdl with Lazarus.
« Reply #2 on: June 02, 2011, 09:05:55 pm »
Yes, I have ld, since all programs I can compile flawless except for those using sdl, anyway
Quote
which ld
/usr/bin/ld

Leledumbo

  • Hero Member
  • *****
  • Posts: 8111
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Problems with using sdl with Lazarus.
« Reply #3 on: June 02, 2011, 11:04:28 pm »
Hmm... weird. Your -va output displays ld as being not found while it found LD. Try passing -FD/usr/bin

Rave

  • Full Member
  • ***
  • Posts: 160
Re: Problems with using sdl with Lazarus.
« Reply #4 on: June 03, 2011, 12:30:55 am »
Thanks, helped.