Recent

Author Topic: Glib2D for FPC Help needed  (Read 9309 times)

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Glib2D for FPC Help needed
« Reply #15 on: May 05, 2016, 11:06:01 pm »
Well, you'll need them. IMG_Load is in libSDL_image-1.2.0.dylib, etc.

If you used fink to install libSDL-1.2.0.dylib, can you do the same with the others?

I don't ever use fink, so I can't help there.


Rigaux

  • New Member
  • *
  • Posts: 12
Re: Glib2D for FPC Help needed
« Reply #16 on: May 05, 2016, 11:17:54 pm »
I now have these libraries , but it still doesn't work ... I used fink to install them
Do I have to do anything else that I might have forgot ? 

libSDL-1.2.0.dylib
libSDL.a
libSDL.dylib
libSDL.la
libSDL2-2.0.0.dylib
libSDL2.a
libSDL2.dylib
libSDL2.la
libSDL2_test.a
libSDL2main.a
libSDL_gfx.13.dylib
libSDL_gfx.dylib
libSDL_gfx.la
libSDL_image-1.2.0.dylib
libSDL_image.a
libSDL_image.dylib
libSDL_image.la
libSDL_mixer-1.2.0.dylib
libSDL_mixer.a
libSDL_mixer.dylib
libSDL_mixer.la
libSDL_net-1.2.0.0.7.dylib
libSDL_net-1.2.0.dylib
libSDL_net.a
libSDL_net.dylib
libSDL_net.la
libSDL_sound-1.0.1.dylib
libSDL_sound.a
libSDL_sound.dylib
libSDL_sound.la
libSDL_ttf-2.0.0.dylib
libSDL_ttf.a
libSDL_ttf.dylib
libSDL_ttf.la
libSDLmain.a
libSDLmain.la

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Glib2D for FPC Help needed
« Reply #17 on: May 06, 2016, 03:50:19 am »
Here's something to try.

Copy the SDL source code files (packages/sdl/src) into the same folder as your app's source code, then edit sdl_image.pas and sdl_ttf.pas.

Add a "{$linklib libSDL_image-1.2.0} to sdl_image.pas and {$linklib libSDL_ttf-2.0.0} to sdl_ttf.pas. Put each below where the .dylib name is defined.

Now compile your app. FPC will compile the edited local copies of the SDL units rather than use its own precompiled ones.

See if that fixes the link problem.


Rigaux

  • New Member
  • *
  • Posts: 12
Re: Glib2D for FPC Help needed
« Reply #18 on: May 06, 2016, 06:38:12 am »
I've added what you told me so I have this :

Code: Pascal  [Select][+][-]
  1. {$IFDEF MACOS}
  2.   SDL_ImageLibName = 'SDL_image';
  3.         {$linklib libSDL_image-1.2.0}
  4. {$ENDIF}

and

Code: Pascal  [Select][+][-]
  1. {$IFDEF MACOS}
  2.   SDLttfLibName = 'SDL_ttf';
  3.         {$linklib libSDL_ttf-2.0.0}
  4. {$ENDIF}
  5.  

But it still doesn't work

However I have some warnings from the very beginning but i thought it wasn't important but I am still going to paste it here :
ld: warning: object file (/sw/lib/fpc/3.0.0/units/x86_64-darwin/rtl/system.o) was built for newer OSX version (10.7) than being linked (10.5)
ld: warning: object file (/sw/lib/fpc/3.0.0/units/x86_64-darwin/opengl/gl.o) was built for newer OSX version (10.7) than being linked (10.5)
ld: warning: object file (/sw/lib/fpc/3.0.0/units/x86_64-darwin/sdl/sdl.o) was built for newer OSX version (10.7) than being linked (10.5)
ld: warning: object file (/sw/lib/fpc/3.0.0/units/x86_64-darwin/rtl/math.o) was built for newer OSX version (10.7) than being linked (10.5)
ld: warning: object file (/sw/lib/fpc/3.0.0/units/x86_64-darwin/rtl/objpas.o) was built for newer OSX version (10.7) than being linked (10.5)
ld: warning: ld: warning: object file (/sw/lib/fpc/3.0.0/units/x86_64-darwin/rtl/sysutils.o) was built for newer OSX version (10.7) than being linked (10.5)object file (/sw/lib/fpc/3.0.0/units/x86_64-darwin/rtl/dynlibs.o) was built for newer OSX version (10.7) than being linked (10.5)

ld: warning: object file (/sw/lib/fpc/3.0.0/units/x86_64-darwin/rtl/unix.o) was built for newer OSX version (10.7) than being linked (10.5)
ld: warning: object file (/sw/lib/fpc/3.0.0/units/x86_64-darwin/rtl/errors.o) was built for newer OSX version (10.7) than being linked (10.5)
ld: warning: object file (/sw/lib/fpc/3.0.0/units/x86_64-darwin/rtl/sysconst.o) was built for newer OSX version (10.7) than being linked (10.5)
ld: warning: object file (/sw/lib/fpc/3.0.0/units/x86_64-darwin/rtl/unixtype.o) was built for newer OSX version (10.7) than being linked (10.5)
ld: warning: object file (/sw/lib/fpc/3.0.0/units/x86_64-darwin/rtl/baseunix.o) was built for newer OSX version (10.7) than being linked (10.5)
ld: warning: object file (/sw/lib/fpc/3.0.0/units/x86_64-darwin/rtl/sysctl.o) was built for newer OSX version (10.7) than being linked (10.5)
ld: warning: object file (/sw/lib/fpc/3.0.0/units/x86_64-darwin/rtl/unixutil.o) was built for newer OSX version (10.7) than being linked (10.5)
ld: warning: object file (/sw/lib/fpc/3.0.0/units/x86_64-darwin/rtl/initc.o) was built for newer OSX version (10.7) than being linked (10.5)
ld: warning: object file (/sw/lib/fpc/3.0.0/units/x86_64-darwin/rtl/ctypes.o) was built for newer OSX version (10.7) than being linked (10.5)
ld: warning: object file (/sw/lib/fpc/3.0.0/units/x86_64-darwin/rtl/dl.o) was built for newer OSX version (10.7) than being linked (10.5)
ld: warning: object file (/sw/lib/fpc/3.0.0/units/x86_64-darwin/rtl/types.o) was built for newer OSX version (10.7) than being linked (10.5)
ld: warning: object file (/sw/lib/fpc/3.0.0/units/x86_64-darwin/pthreads/pthreads.o) was built for newer OSX version (10.7) than being linked (10.5)
ld: warning: object file (/sw/lib/fpc/3.0.0/units/x86_64-darwin/x11/x.o) was built for newer OSX version (10.7) than being linked (10.5)ld: warning:
object file (/sw/lib/fpc/3.0.0/units/x86_64-darwin/x11/xlib.o) was built for newer OSX version (10.7) than being linked (10.5)
ld: warning: object file (/sw/lib//libSDLmain.a(SDLMain.o)) was built for newer OSX version (10.11) than being linked (10.5)
 

Rigaux

  • New Member
  • *
  • Posts: 12
Re: Glib2D for FPC Help needed
« Reply #19 on: May 06, 2016, 11:54:22 am »
UPDATE : IT FINALLY WORKS !!

I didn't put the line Phil told me at the right place
I put it under the MAC OS def but it's actually under the Darwin def I had to put it so after trying it under the Darwin def It finally worked !
Here it is :

Code: Pascal  [Select][+][-]
  1. {$IFDEF DARWIN}
  2.   SDLttfLibName = 'libSDL_ttf-2.0.0.dylib';
  3.         {$linklib libSDL_ttf-2.0.0.dylib}
  4.  

and

Code: Pascal  [Select][+][-]
  1. {$IFDEF DARWIN}
  2.   SDL_ImageLibName = 'libSDL_image-1.2.0.dylib';
  3.         {$linklib libSDL_image-1.2.0}
  4.  

Thank you so much Soner and Phil !

Now lets start programming !

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Glib2D for FPC Help needed
« Reply #20 on: May 06, 2016, 04:26:13 pm »
Could you post a bug report for the FPC SDL units? Otherwise that will never get fixed.

It looks like the SDL units were never properly tested with OS X. That doesn't surprise me, though - very common with units ported from Delphi.

Note that you'll need to add the linklib line to any of the other SDL units containing functions you need.

You can see what libraries your executable is linked against like this:

  otools -L myexec

-Phil

Rigaux

  • New Member
  • *
  • Posts: 12
Re: Glib2D for FPC Help needed
« Reply #21 on: May 06, 2016, 04:32:06 pm »
I'm not sure they are continuing SDL 1.2.0 though

Where do I report the bug ?

Does that mean that if I use lets say a function from sdl_gfx.pas
I'll have to add :
{$linklib libSDL_gfx.13} as I did on image and ttf ?

Thank you

-Rigaux

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Glib2D for FPC Help needed
« Reply #22 on: May 06, 2016, 04:36:33 pm »
Yes, any of the SDL units where they define a .dylib you'll need to add a linklib.

If you want to use the precompiled units without messing with the source locally, I think you can just add the linklib lines somewhere to your own code. That should be all you need to satisfy the linker. Maybe surround them with this in case you want to compile for other platforms:

{$IFDEF DARWIN}
  {$linklib...
{$ENDIF}

I should have noticed the linklib omission earlier. Some of the SDL functions you were calling were not showing as undefined symbols. Those were functions in the sdl.pas unit, where linklib _is_ included, hence why the linker was able to find them.

Click Bugtracker on upper-left to report a bug.

-Phil

 

TinyPortal © 2005-2018