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

Author Topic: Build/Install on OS X  (Read 6075 times)

0 Members and 1 Guest are viewing this topic.

sib

  • Newbie
  • *
  • Posts: 1
    • View Profile
Build/Install on OS X
« on: May 25, 2009, 11:47:33 pm »
Hi,

Using setup.py on a mac I was getting errors when the extension module compilation reached the linker stage. Something like "library not found".  This is due to the linker option -l, which doesn't work when you're linking against frameworks.

Solution to install on OS X which worked for me:

1. Install compiled frameworks (per standard SDK documentation) to /Library/Frameworks

2. run "python setup.py build" with the following modfications to the file:

Code: [Select]

#!/usr/bin/env python
# coding=UTF-8

from distutils.core import setup, Extension

setup(name='PySFML',
version='1.4',
description='Python binding for SFML (Simple and Fast Multimedia Library)',
author='RĂ©mi Koenig',
author_email='remi.k2620@gmail.com',
url='http://www.sfml-dev.org/',
license='zlib/png',
ext_modules=[ Extension('PySFML.sf', \
['src/Clock.cpp', 'src/Color.cpp', 'src/Drawable.cpp', \
'src/Event.cpp', 'src/Image.cpp', 'src/Input.cpp', 'src/Key.cpp', 'src/main.cpp', \
'src/Music.cpp', 'src/PostFX.cpp', 'src/Rect.cpp', 'src/RenderWindow.cpp', 'src/Sleep.cpp', \
'src/Sprite.cpp', 'src/String.cpp', 'src/VideoMode.cpp', 'src/View.cpp', 'src/Window.cpp', \
'src/Joy.cpp', 'src/Mouse.cpp', 'src/WindowStyle.cpp', 'src/Blend.cpp', 'src/Sound.cpp', \
'src/SoundBuffer.cpp', 'src/Listener.cpp', 'src/SoundRecorder.cpp', 'src/SoundBufferRecorder.cpp', \
'src/SoundStream.cpp', 'src/Font.cpp', 'src/Glyph.cpp', 'src/Shape.cpp', 'src/WindowSettings.cpp' ], \
extra_link_args=[\
'-framework', 'sfml-graphics', \
'-framework', 'sfml-window', \
'-framework', 'sfml-audio', \
'-framework', 'sfml-system'], \
include_dirs=['../include']
)],
package_dir = {'PySFML':'PySFML'},
packages=['PySFML'],
)


3. then run "python setup.py install" as usual...

Hope that helps some other people who are having trouble. Took me a little while to figure out, as I'm not very familiar with distools yet.



 :shock:  :o

remi.k2620

  • Full Member
  • ***
  • Posts: 186
    • View Profile
    • http://remi.tuxfamily.org
Build/Install on OS X
« Reply #1 on: May 30, 2009, 01:07:17 pm »
Well that's strange. Ceylo managed to compile pysfml on mac (see http://www.sfml-dev.org/forum-fr/viewtopic.php?t=1667) and it seems he didn't have to change setup.py. I would like to know if it is really necessary or not to add those framework extra args since I plan to make a setup.py that adapts to the platform and the compiler you're using so you don't need to edit it.

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
Build/Install on OS X
« Reply #2 on: May 30, 2009, 03:16:34 pm »
I didn't have to change setup.py because I had installed the raw dynamic libraries (those built through the SFML-bare Xcode project). But these are not the default installed files (they won't even be in the package).

So yes, linking against the frameworks is the best solution.

P.S.: I had tried to link against the frameworks but I didn't know the key word to tell Python how to do this (I didn't even think of "extra link flag" or something like that...).
Want to play movies in your SFML application? Check out sfeMovie!

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
Build/Install on OS X
« Reply #3 on: August 29, 2009, 07:04:21 pm »
Hey sib,

I'm planning to provide the Mac OS X python binding for the next SFML release. I'm talking about it with remi and I would like to know whether the installation destination and form used by the setup script in the more common one for Python development. Especially, are the python packages always installed in /Library/Python/version/site-packages ? Are binaries .so, .dylib or something else ?

Thanks
Ceylo
Want to play movies in your SFML application? Check out sfeMovie!

 

anything