Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: SFML Mac Portability  (Read 12912 times)

0 Members and 1 Guest are viewing this topic.

Bocaj

  • Newbie
  • *
  • Posts: 32
    • View Profile
SFML Mac Portability
« on: June 05, 2012, 10:47:02 pm »
I was reading the tutorial to install SFML 2.0, and it said that it is necessary to have X11 installed on your computer in order to develop SFML.  I heard that in the next release of OS X, X11 will be removed.  Does this mean that all Mac users who have versions after Lion will have to install XQuartz before being able to open SFML applications?  Or, because they are just using SFML programs, not developing them, they don't need XQuartz to run SFML?

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: SFML Mac Portability
« Reply #1 on: June 05, 2012, 11:51:33 pm »
I can't tell yet. We'll see when 10.8 comes out if the removal of X11 is only a rumor or not. Then I'll think of a solution.

SFML only use freetype from X11. Maybe I'll also provide a freetype framework like the sndfile framework.
SFML / OS X developer

Bocaj

  • Newbie
  • *
  • Posts: 32
    • View Profile
Re: SFML Mac Portability
« Reply #2 on: June 06, 2012, 03:02:44 am »
OK, so if X11 is removed in OS X Mountain Lion, it is still possible that the downloader of the application will not have to download anything besides the .app package?

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: SFML Mac Portability
« Reply #3 on: June 06, 2012, 08:45:21 am »
As I said I don't know yet. freetype will probably - but not certainly - be shipped with SFML. We'll figure out what to do later when 10.8 is released.
SFML / OS X developer

capz

  • Newbie
  • *
  • Posts: 29
    • View Profile
Re: SFML Mac Portability
« Reply #4 on: June 08, 2012, 04:21:36 am »
What apple is shipping as X11 is actually a repackaging of the open-source (though mostly developed by apple engineers) XQuartz.

Edit:

I should really read these things twice..
Anyways, I'm not sure if you needed to install X11 in the past in order to run SFML apps since I installed it by default, but if so, then the user would (once, identical to how you install java on 10.7) get a one-click install via software update. It's quick and painless :)

Should be the same as with X11, so if you didn't need to install that in the past to run SFML apps, then you shouldn't have to install XQuartz.

Also, vanilla SFML 2 works just fine on 10.8 ;)
« Last Edit: June 08, 2012, 04:31:36 am by capz »

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: SFML Mac Portability
« Reply #5 on: June 08, 2012, 09:41:55 am »
Quote
then the user would get a one-click install via software update. It's quick and painless
Yes, that's why I'm not 100% sure I'll make a package for freetype.

Quote
Also, vanilla SFML 2 works just fine on 10.8
Good to hear!  :)
One quick question : did you upgrade from 10.7 to install 10.8 or did you make a fresh installation ?
If X11/XQuartz is no longer shipped by Apple but you did an upgrade then you might have kept freetype library from Lion. Maybe.
SFML / OS X developer

capz

  • Newbie
  • *
  • Posts: 29
    • View Profile
Re: SFML Mac Portability
« Reply #6 on: June 08, 2012, 03:03:02 pm »
I did indeed upgrade. I'll do a clean install for testing purposes later today, and build SFML on that.

Will report back asap  :)
« Last Edit: June 08, 2012, 06:29:09 pm by capz »

capz

  • Newbie
  • *
  • Posts: 29
    • View Profile
Re: SFML Mac Portability
« Reply #7 on: June 08, 2012, 06:33:23 pm »
Edit: made this a separate post as to trigger the topic reply notification :)

So I've done a 100% clean install inside of VMWare (which is allowed now, so thanks apple!) and the results are in!

When you attempt to run an SFML 2.0 app, you are indeed presented with an option to install XQuartz.
Clicking it will open a browser, pointing at xquartz.macosforge.com, from which you'll have to download the disk image containing the XQuartz installer. So not a one-click as I thought before.

Everything works as expected after installing XQuartz though.

As for compiling SFML from source:
XQuartz includes a TON of libs, including freetype 2.4.9 + patches. More specifically:
Quote
* freetype 2.4.9
      * CVE-2012-1126
      * CVE-2012-1127
      * CVE-2012-1128
      * CVE-2012-1129
      * CVE-2012-1130
      * CVE-2012-1131
      * CVE-2012-1132
      * CVE-2012-1133
      * CVE-2012-1134
      * CVE-2012-1135
      * CVE-2012-1136
      * CVE-2012-1137
      * CVE-2012-1138
      * CVE-2012-1139
      * CVE-2012-1140
      * CVE-2012-1141
      * CVE-2012-1142
      * CVE-2012-1143
      * CVE-2012-1144

Configuring & Compiling SFML from source works as expected from that point onward. Kind of; the make install only worked properly when CMAKE_OSX_DEPLOYMENT_TARGET was set manually (I set it to 10.8, was blank initially)

So the freetype situation is a non-issue ;)

For me though.. I was hoping to get an SFML project into the app store, but now I'm not so sure if that will be possible with the dependency on an XQuartz install. Might need to review the submission guidelines

Bocaj

  • Newbie
  • *
  • Posts: 32
    • View Profile
Re: SFML Mac Portability
« Reply #8 on: June 09, 2012, 12:36:09 am »
Would it be possible to ship freetype with SFML so the user doesn't have to download XQuartz to run it?  XQuartz includes a lot, but SFML only needs freetype, right?

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: SFML Mac Portability
« Reply #9 on: June 09, 2012, 10:23:51 am »
When you attempt to run an SFML 2.0 app, you are indeed presented with an option to install XQuartz.
Great!

Is the user still prompted to install XQuartz if you copied freetype library to your application bundle ? (If you don't have time to test this I'll test it later when 10.8 is officially released.)

Would it be possible to ship freetype with SFML so the user doesn't have to download XQuartz to run it?  XQuartz includes a lot, but SFML only needs freetype, right?
Yes, SFML only need freetype from X11/XQuartz. However, I prefer not providing this extra framework because then I should keep SFML version of freetype up-to-date which is already done by XQuartz. So in this mindset I rather prefer "forcing" SFML developer to install XQuartz on their own so they can put freetype in their .app.

Now this is not a definitive decision. I'm open to discussion to find what's best for both developers and users. However this won't be changed until SFML 2.1. So we have time before us.
SFML / OS X developer

capz

  • Newbie
  • *
  • Posts: 29
    • View Profile
Re: SFML Mac Portability
« Reply #10 on: June 09, 2012, 07:36:51 pm »
When you attempt to run an SFML 2.0 app, you are indeed presented with an option to install XQuartz.
Great!

Is the user still prompted to install XQuartz if you copied freetype library to your application bundle ? (If you don't have time to test this I'll test it later when 10.8 is officially released.)

I'd personally be fine with grabbing a copy of the dylib and bundling it with my app similar to how you link with sfml itself, but sfml probably won't compile unless it's present at compile-time of the framework, no?

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: SFML Mac Portability
« Reply #11 on: June 09, 2012, 07:38:25 pm »
Yes, but you don't actually need to build SFML to use it. Just download the last release from the website.  ;)
SFML / OS X developer

capz

  • Newbie
  • *
  • Posts: 29
    • View Profile
Re: SFML Mac Portability
« Reply #12 on: June 10, 2012, 01:27:39 am »
Yes, but you don't actually need to build SFML to use it. Just download the last release from the website.  ;)
Oh I wasn't aware that there are prebuilt frameworks already :D

Anyway..  ;D
So I poked around in yet another clean install of 10.8 (making snapshots so I can revert from now on :P) and I noticed some things which I thought were interesting:
SFML will in fact compile just fine without XQuartz installed if you make a (soft) symlink to libfreetype.6.dylib, called libfreetype.dylib. A bunch of libs and headers actually ship with the OS, and even though freetype is not the very latest version(2.4.4), the whole thing builds just fine.

As for running apps.. I've created an empty sfml project from the supplied templates and for me it doesn't work. I had to throw out all references to sfml libs and add the frameworks for it to compile. I've also added freetype (the version that ships with 10.8 ) to the project but it still keeps asking to install XQuartz when running the app. Not sure what's going on there  :o

Console.app shows the following output:
Quote
/Users/test/Library/Developer/Xcode/DerivedData/test-evmgfzadndoehnbskpupqrhdfnbb/Build/Products/Debug/test.app/Contents/MacOS/test requires X11, launching com.apple.X11redirect.
« Last Edit: June 10, 2012, 01:29:13 am by capz »

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
Re: SFML Mac Portability
« Reply #13 on: June 10, 2012, 04:20:33 pm »
What does
Code: [Select]
otool -L /Users/test/Library/Developer/Xcode/DerivedData/test-evmgfzadndoehnbskpupqrhdfnbb/Build/Products/Debug/test.app/Contents/MacOS/testgives you ?
Want to play movies in your SFML application? Check out sfeMovie!

capz

  • Newbie
  • *
  • Posts: 29
    • View Profile
Re: SFML Mac Portability
« Reply #14 on: June 13, 2012, 09:38:54 pm »
What does
Code: [Select]
otool -L /Users/test/Library/Developer/Xcode/DerivedData/test-evmgfzadndoehnbskpupqrhdfnbb/Build/Products/Debug/test.app/Contents/MacOS/testgives you ?
Virtual-Mac:~ test$ otool -L /Users/test/Library/Developer/Xcode/DerivedData/test-evmgfzadndoehnbskpupqrhdfnbb/Build/Products/Debug/test.app/Contents/MacOS/test
/Users/test/Library/Developer/Xcode/DerivedData/test-evmgfzadndoehnbskpupqrhdfnbb/Build/Products/Debug/test.app/Contents/MacOS/test:
        /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 833.24.0)
        @executable_path/../Frameworks/sfml-audio.framework/Versions/2.0.0/sfml-audio (compatibility version 2.0.0, current version 2.0.0)
        @executable_path/../Frameworks/sfml-graphics.framework/Versions/2.0.0/sfml-graphics (compatibility version 2.0.0, current version 2.0.0)
        @executable_path/../Frameworks/sfml-network.framework/Versions/2.0.0/sfml-network (compatibility version 2.0.0, current version 2.0.0)
        @executable_path/../Frameworks/sfml-system.framework/Versions/2.0.0/sfml-system (compatibility version 2.0.0, current version 2.0.0)
        @executable_path/../Frameworks/sfml-window.framework/Versions/2.0.0/sfml-window (compatibility version 2.0.0, current version 2.0.0)
        @executable_path/../Frameworks/SFML.framework/Versions/2.0.0/SFML (compatibility version 0.0.0, current version 0.0.0)
        @executable_path/../Frameworks/sndfile.framework/Versions/A/sndfile (compatibility version 2.0.0, current version 2.24.0)
        /usr/X11/lib/libfreetype.6.dylib (compatibility version 14.0.0, current version 14.2.0)
        /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 52.0.0)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0)
        /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
        /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 635.19.0)
 
:P

 

anything