× CodeTyphon MacOS Development, discussions and problems

Question Issues with SDL and linking to the framework (OSX)

  • Paul Dunn
  • Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
More
3 years 8 months ago - 3 years 8 months ago #10407 by Paul Dunn
Hi - I posted this to the Lazarus forums, but I suppose this would be a better place to put it:

I've written this little BASIC interpreter with its own editor built-in and I'd like to port it to OSX. I've ported to Linux (x86 and ARM) from the Windows delphi original, and now am building for my MacbookPro (El-Cap, not Sierra as debugging is currently broken in Sierra!).

My interpreter uses SDL and SDL_Image, with BASS for sound.

Now, as you're all aware, there are two ways to get SDL 1.2 for OSX - as a framework and as unix-style libraries. I've got both installed as I couldn't build without the unix-style, and I'd like to put the two frameworks inside the app bundle, but have run into some real problems.

I can link (according to otool -L) to the SDL_Image framework, but the linker refuses to link to the SDL framework and instead links to the library in /opt/local/lib which also creates a dependency to libX11.6.dylib... and so on.

This is the command line I'm using to build (can't build for 64 bit cocoa from Lazarus due to huge UI issues):

/usr/local/codetyphon/fpc/fpc64/bin/x86_64-darwin/fpc -MDelphi -Sghi -CX -O4 -OoUNCERTAIN -OoREGVAR -Xs -uDarwin -dMacOS -k-framework -kCocoa -k-framework -kOpenGL -k-framework -kSDL_image -k/usr/local/lib/libbass.dylib -k-framework -kCocoa -l -vewnhibq -Fu/usr/local/codetyphon/typhon/lcl/units/x86_64-darwin/cocoa -Fu/usr/local/codetyphon/typhon/lcl/units/x86_64-darwin -Fu/usr/local/codetyphon/typhon/components/BaseUtils/lib/x86_64-darwin -Fu/usr/local/codetyphon/typhon/packager/units/x86_64-darwin -Fu/Users/zxdunny/projects/specbas/ -dLCL -dLCLcocoa SpecBAS.pas

I can use install_name_tool from xcode to change where libbass is searched for, and the above as I said creates a dependency on SDL_Image.framework, which I can also change the search path for with install_name_tool. But inserting -k-framework -kSDL results in FPC complaining that it can't find the SDL framework, which has been installed properly into /library/frameworks/ along with SDL_Image. I'd ideally like to link to @rpath so I can include the two frameworks inside the app bundle for a self-contained installation.

Anyone know why it fails so hard?
Modify message
Last edit: 3 years 8 months ago by Paul Dunn. Reason: Removed line, not necessary.

Please Log in or Create an account to join the conversation.

  • Sternas Stefanos
  • Sternas Stefanos's Avatar
  • Offline
  • Moderator
  • Moderator
  • Ex Pilot, M.Sc, Ph.D
More
3 years 8 months ago #10408 by Sternas Stefanos
Replied by Sternas Stefanos on topic Issues with SDL and linking to the framework (OSX)
Thanks Sir
1) did you codesign -f -s - SDL2 ?
2) Typhon IDE Platform (Carbon,Cocoa,QT4 etc) ?

PilotLogic Architect and Core Programmer

Please Log in or Create an account to join the conversation.