Recent

Author Topic: Freepascal and SDL on 10.13  (Read 2922 times)

abertolli

  • Newbie
  • Posts: 3
Freepascal and SDL on 10.13
« on: October 22, 2018, 08:23:01 pm »
The scope of this question may be a little bigger than just the Mac, but the specific problem I'm having is with porting some old code to the Mac.  I'm a perpetual (20+ years) amateur when it comes to FP, so please bear with me.

(1) The code that uses units:  sdl, sdl_ttf, sdl_gfx

(2) Code compiles and runs on Linux, and requires SDL 1.2 libraries

(3) I would like to port this code to Mac


Here is what I've done:

(1) Installed the FPC package for Mac from sourceforge.
Code: [Select]
fpc -version
[0.023] Free Pascal Compiler version 3.0.4 [2018/09/30] for x86_64
[0.023] Copyright (c) 1993-2017 by Florian Klaempfl and others
[0.023] error: No source file name in command line
[0.023] error: Compilation aborted
Error: /usr/local/bin/ppcx64 returned an error exitcode

(2) The wiki states"For FPC 2.2.2 and later
The SDL unit included with FPC includes all necessary framework, library and main procedure name renaming statements, so you no longer have to do anything special. Just add the sdl unit to your program and everything will be taken care of. However, the remarks about libSDLMain in the above section still hold (libSDLMain.a is required by the SDL unit included with FPC)."


However, compiling the code complained about not being able to find/link to SDL 1.2
Code: [Select]
ld: library not found for -lSDL-1.2.0
(3) So I install the Runtime libraries.  Same result.
Code: [Select]
ld: library not found for -lSDL-1.2.0
(4) So I download the source code for the development libraries and try to compile.  Run into an issue with not finding X11 headers, so I add:
Code: [Select]
-I/opt/X11/include
(5) Lastly, I still have the following error that I can't resolve:
Code: [Select]
./src/video/quartz/SDL_QuartzVideo.h:94:5: error: unknown type name 'CGDirectPaletteRef'
    CGDirectPaletteRef palette;            /* palette of an 8-bit display */
    ^


I guess I'm looking for guidance on what to do next.  I presume that the problem above is an issue with SDL 1.2 for Mac, and may not even be resolvable in a reasonable way.  What should I do?  Is there an easy way to get SDL1.2 working with FPC on the Mac these days?  Alternatively, if SDL 1.2 is old how can I move onto SDL2 with FPC?  Does FPC support this in the same way?

ChrisR

  • Full Member
  • ***
  • Posts: 247
Re: Freepascal and SDL on 10.13
« Reply #1 on: October 22, 2018, 09:48:37 pm »
I have never used SDL, but you may want to look at
  https://github.com/UltraStar-Deluxe/USDX
This is a popular project, and if you press on the green Travis button you will see that it does compile to MacOS. The compiler switches in the Travis compiler log may give you hints...

abertolli

  • Newbie
  • Posts: 3
Re: Freepascal and SDL on 10.13
« Reply #2 on: October 22, 2018, 10:46:56 pm »
Thanks.  I don't know what the Travis button is, but this seems to use SDL2.  Which is fine if I have to go that direction.

Compiling SDL with Freepascal on Mac seems to be a hot mess.  I downloaded sdl libs using homebrew, and providing the SDLmain.a file (-Fl) it seems to no longer complain about the library missing, but now I have some x64 missing symbol problems meaning I'm mixing incompatible libraries in with my problem.  So I don't know if this is a productive road.

Is it better if I ask this on the Graphics forum?  Or am I out of luck because this is just something that people don't do or doesn't work?

abertolli

  • Newbie
  • Posts: 3
Re: Freepascal and SDL on 10.13
« Reply #3 on: October 24, 2018, 07:07:48 pm »
Well I guess this seems like a bunch of extra work to just stick with SDL 1.2... so I'm probably going to just migrate to SDL 2

 

TinyPortal © 2005-2018