Recent

Author Topic: Settings for JEDI SDL  (Read 33483 times)

Ant_222

  • New Member
  • *
  • Posts: 24
Settings for JEDI SDL
« on: January 21, 2009, 02:19:25 am »
Hello all,

I tried making Lazarus work with JEDI SDL on Mac OS X and ran into the following problem. When building I get the "Error while linking" message. Could you help me?

Anton

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Settings for JEDI SDL
« Reply #1 on: January 21, 2009, 03:21:25 am »
How about some more information?

Version of Lazarus and Free Pascal, version of OS X, version of SDL, etc.

Also, please give the full linker error message.

Thanks.

-Phil

Ant_222

  • New Member
  • *
  • Posts: 24
Re: Settings for JEDI SDL
« Reply #2 on: January 21, 2009, 01:35:19 pm »
Hello, Phil

Mac OS X version: 10.5.6
Lazarus version: 0.9.26
FPC version:2.2.2
SDL version: 1.2.13
JEDI-SDL version 1.0 Final RC2

As for the linker error, that's all it writes in Lazarus. I suppose I have to add a certain option to the linking command so that it would log the detailed error description in a file?

Anton

Vincent Snijders

  • Administrator
  • Hero Member
  • *
  • Posts: 2661
    • My Lazarus wiki user page
Re: Settings for JEDI SDL
« Reply #3 on: January 21, 2009, 01:53:53 pm »
Try to copy all including hidden messages form the messages view.

Ant_222

  • New Member
  • *
  • Posts: 24
Re: Settings for JEDI SDL
« Reply #4 on: January 21, 2009, 01:59:39 pm »
Thanks for the tip. Here it is:

Assembling sdl
Project1.pas(9,5) Note: Local variable "scr" not used
Assembling sdltest
Linking Project1
Undefined symbols:
  "_SDL_Init", referenced from:
      _PASCALMAIN in Project1.o
ld: symbol(s) not found
An error occurred while linking
Error: Error while linking


That was with smart linking turned on. Without it I get a whole bunch undefined symbols:

Linking Project1
Undefined symbols:
  "_SDL_LoadWAV_RW", referenced from:
      _SDL_SDL_LOADWAV$PCHAR$PSDL_AUDIOSPEC$PUINT8$PUINT32$$PSDL_AUDIOSPEC in sdl.o
  "_SDL_RWFromFile", referenced from:
      _SDL_SDL_LOADWAV$PCHAR$PSDL_AUDIOSPEC$PUINT8$PUINT32$$PSDL_AUDIOSPEC in sdl.o
      _SDL_SDL_LOADBMP$PCHAR$$PSDL_SURFACE in sdl.o
      _SDL_SDL_SAVEBMP$PSDL_SURFACE$PCHAR$$LONGINT in sdl.o
  "_SDL_Error", referenced from:
      _SDL_SDL_OUTOFMEMORY in sdl.o
  "_SDL_UpperBlit", referenced from:
      _SDL_SDL_BLITSURFACE$PSDL_SURFACE$PSDL_RECT$PSDL_SURFACE$PSDL_RECT$$LONGINT in sdl.o
  "_SDL_Init", referenced from:
      _PASCALMAIN in Project1.o
  "_SDL_SaveBMP_RW", referenced from:
      _SDL_SDL_SAVEBMP$PSDL_SURFACE$PCHAR$$LONGINT in sdl.o
  "_SDL_LoadBMP_RW", referenced from:
      _SDL_SDL_LOADBMP$PCHAR$$PSDL_SURFACE in sdl.o
  "_SDL_mutexP", referenced from:
      _SDL_SDL_LOCKMUTEX$PSDL_MUTEX$$LONGINT in sdl.o
  "_SDL_mutexV", referenced from:
      _SDL_SDL_UNLOCKMUTEX$PSDL_MUTEX$$LONGINT in sdl.o
  "_SDL_CreateRGBSurface", referenced from:
      _SDL_SDL_ALLOCSURFACE$crcE30B3586 in sdl.o
ld: symbol(s) not found
An error occurred while linking
Error: Error while linking 

« Last Edit: January 21, 2009, 02:20:31 pm by Ant_222 »

Ant_222

  • New Member
  • *
  • Posts: 24
Re: Settings for JEDI SDL
« Reply #5 on: January 21, 2009, 02:35:05 pm »
When using {$linklib SDLmain} it says it cannot find the library. Try to fix it..

EDIT:
I have compiled and attached libSDLmain.a but it still doesn't see those symbols.
« Last Edit: January 21, 2009, 02:44:39 pm by Ant_222 »

Ant_222

  • New Member
  • *
  • Posts: 24
Re: Settings for JEDI SDL
« Reply #6 on: January 21, 2009, 04:02:39 pm »
Now it links (I forgot to add SDL Framework to compiler options), but the program exists with exception class: "External: SIGTRAP" (((

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Settings for JEDI SDL
« Reply #7 on: January 22, 2009, 04:41:48 pm »
Can you compile with Display Line Numbers (-gl) and run your app in the debugger and do a backtrace to find where the error occurs. Note you may need to recompile SDL with -gl if the error is occuring there.

Thanks.

-Phil

Ant_222

  • New Member
  • *
  • Posts: 24
Re: Settings for JEDI SDL
« Reply #8 on: January 22, 2009, 05:04:30 pm »
Hello Phil,

I'll do as you say, but for now I want to say that my programs work with XCODE, so I suppose the problem should be rooted in the Lazarus IDE. And I'd surely prefer to use Lazarus.

Anton

Ant_222

  • New Member
  • *
  • Posts: 24
Re: Settings for JEDI SDL
« Reply #9 on: January 22, 2009, 07:09:44 pm »
The program crashes at the following line:

scr:=SDL_SetVideoMode(640, 480, 0, SDL_SWSURFACE);

It was called after SDL_Init(SDL_INIT_VIDEO), which had returned 0 (success);

And I don't know how to re-build a framework. Never dealt with frameworks...

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Settings for JEDI SDL
« Reply #10 on: January 22, 2009, 07:32:36 pm »
Googling this returns lots of hits on your error:

SDL_SetVideoMode "os x"

A framework is just one or more libraries (e.g., .dylib) in a special folder structure that simplifies linking and versioning. Look at the create_framework_mac.sh script I created for Den's Qt4Intf library that creates a framework for it (Qt4Intf.framework):

http://users.telenet.be/Jan.Van.hijfte/qtforfpc/fpcqt4.html

I don't know anything about either SDL or JEDI, but I would imagine they have a script somewhere that creates the SDL.framework.

Thanks.

-Phil

Ant_222

  • New Member
  • *
  • Posts: 24
Re: Settings for JEDI SDL
« Reply #11 on: January 22, 2009, 09:06:50 pm »
I'll try to make the frameworks myself, but that will require some time, whereon I am rather short right now :(

Meanwhile, I want to try easier things. Since everything works fine from within XCODE, I guess the problem might be in the settings of Lazarus/FPC. Is there a way to copy all the settings from one machine to another?

Most of the settings must be stored in the project file, so can you send me a minimal working Lazarus project using SDL? Or, maybe, I will send you my not working project so that we can exclude the project settings from the list of suspects?

Many thanks for helping,
Anton

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Settings for JEDI SDL
« Reply #12 on: January 22, 2009, 09:12:57 pm »
Guess I don't understand why you think this has something to do with the Lazarus IDE. Don't they include a sample or test application with SDL? If so, just compile it from the command line using lazbuild.

Not sure what you mean by it runs from XCode. Your Pascal code runs from XCode?

Thanks.

-Phil

Ant_222

  • New Member
  • *
  • Posts: 24
Re: Settings for JEDI SDL
« Reply #13 on: January 22, 2009, 09:42:35 pm »
...Yes, after installing the FPC XCode integration kit.

The Demo (after I have converted it from the Delphi format, included "-framework sdl" key in linker options, and added paths to SDL sources and .inc files) builds well and exits with the same error. And again at the execution of SetVideoMode...

But since I had to convert it from .dpr, the project settings were not saved. So I still cannot be sure... I need a working Lazarus Mac OS X project.


« Last Edit: January 22, 2009, 09:46:32 pm by Ant_222 »

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Settings for JEDI SDL
« Reply #14 on: January 22, 2009, 10:19:01 pm »
For both the executable you create with FPC/XCode and the executable created with Lazarus, do this:

otool -L exefile

This will tell you what frameworks and other dependencies the executable has. That might give you a clue about why they're behaving differently.

Are you creating a console or GUI app with Lazarus? By default it uses the Carbon widgetset, which means the executable will be using the Carbon and GL (?) frameworks (not at my Mac right now).

I assume you're able to compile and run successfully a Carbon GUI app with Lazarus.

For compile settings, I would make sure Delphi mode is used. Also, I always turn on all checks (-Cirot).

Thanks.

-Phil

 

TinyPortal © 2005-2018