FIFE forums

FIFE Development => Framework development => Topic started by: prock on September 05, 2009, 12:56:14 pm

Title: OS X Snow Leopard - build issues
Post by: prock on September 05, 2009, 12:56:14 pm
Hi all,

Just thought I'd let you know that I've upgraded to Snow Leopard and am having some difficulties with MacPorts.  There are a few dependencies (like libsdl) that DO NOT currently build.  There is a ticket open at MacPorts to fix the problem (see: http://trac.macports.org/ticket/20235 (http://trac.macports.org/ticket/20235).  In the mean time I am working on an alternate way to build FIFE on Snow Leopard.  I will post my findings here.
Title: Re: OS X Snow Leopard - build issues
Post by: prock on September 28, 2009, 11:26:47 am
I just tried re syncing my port file and building libsdl and it worked!!!  Looks like the problem has been fixed.  I'm continuing building the rest of FIFE's deps and will report my findings here.
Title: Re: OS X Snow Leopard - build issues
Post by: prock on September 28, 2009, 11:53:00 am
Just hit another road block... one of guichan's dependencies doesn't compile (allegro) so back to square one.
Title: Re: OS X Snow Leopard - build issues
Post by: prock on September 28, 2009, 12:30:52 pm
Unfortunately whoever maintains the guichan port has allegro listed as a dependency and allegro does not build.   What I did was remove allegro as a dependency and voila it works!

Goto the /opt/local/var/macports/sources/rsync.macports.org/release/ports/graphics/libguichan directory and apply this patch to the Portfile:

Code: [Select]
22c22
< depends_lib     path:lib/pkgconfig/sdl.pc:libsdl port:libsdl_image port:mesa
---
> depends_lib     path:lib/pkgconfig/sdl.pc:libsdl port:libsdl_image port:allegro port:mesa

That should work for you.  If not let me know.
Title: Re: OS X Snow Leopard - build issues
Post by: superfluid on October 01, 2009, 01:21:35 pm
Prock++ I'll try this tonight!
Title: Re: OS X Snow Leopard - build issues
Post by: hoffi on November 22, 2009, 05:05:36 am
Hi,
i tried to compile it on my mac (10.6.2) and got this error:
Code: [Select]
... -lvorbis -lm -logg -lguichan_sdl -lz -lboost_filesystem-mt -lboost_system-mt -lboost_regex-mt -lguichan
sh: o: command not found
Copy("engine/swigwrappers/python/_fife.so", "engine/libfife.so")
scons: *** [engine/swigwrappers/python/_fife.so] engine/libfife.so: No such file or directory
scons: building terminated because of errors.
Here is all: http://www.copypastecode.com/15782/ (http://www.copypastecode.com/15782/)

And there is always
Code: [Select]
sh: o: command not found... what is o?
Title: Re: OS X Snow Leopard - build issues
Post by: prock on November 22, 2009, 08:19:58 am
For whatever reason scons is trying to use 'o' as your compiler tool.  Just a few things...  What version of XCode do you have?  What version of GCC do you have selected (gcc -v)? Can you also paste the output of this command:  "port installed".
Title: Re: OS X Snow Leopard - build issues
Post by: hoffi on November 23, 2009, 07:04:12 am
port installed: http://paste.ideaslabs.com/show/tsEHV6ypbH (http://paste.ideaslabs.com/show/tsEHV6ypbH)

I have the newest Xcode version: 3.1.3 (Xcode IDE: 1191.0, Xcode Core: 1192.0, ToolSupport: 1186.0)

gcc and g++ 4.2
Title: Re: OS X Snow Leopard - build issues
Post by: prock on November 23, 2009, 09:05:12 am
Hmm.. I dont see any obvious problems.   I did notice however that your ports are a little outdated.  When was the last time you ran "sudo port selfupdate && sudo port upgrade oudated"?  I know I had some issues with my ports after upgrading to Snow Leopard.  What I ended having to do was uninstall ALL my ports, then upgrade MacPorts and install all the ports again.  Kindof a pain I know but thats what I had to do.  Unfortunately I cannot remember the specific issue I was having.

Here are the ports I currently have installed:  http://fife.pastebin.com/f4268c8ca
Title: Re: OS X Snow Leopard - build issues
Post by: hoffi on December 28, 2009, 01:49:14 pm
k i got it compiled but fife crashes when it execs the pump function...

Error message: http://fife.pastebin.com/f46738c7d (http://fife.pastebin.com/f46738c7d)
Installed Ports: http://fife.pastebin.com/f41c1ed3c (http://fife.pastebin.com/f41c1ed3c)

looks like python cant find yaml... but i have it installed... ???
Title: Re: OS X Snow Leopard - build issues
Post by: prock on December 28, 2009, 07:26:01 pm
I notice you have python_select installed.... which version of python do you have selected?   Did you try installing pyaml from source?  I believe that's what I had to do.
Title: Re: OS X Snow Leopard - build issues
Post by: mvBarracuda on December 29, 2009, 12:49:38 am
Btw.: It looks like you can now use guichan 0.8.2 on OSX.

Quote from the IRC channel last night:
Quote
2009-12-28T23:54:43  <tommyd3mdi> Hi! Just wanted to drop in to tell you that you can remove the note about MacPorts only shipping guichan 0.8 here: http://wiki.fifengine.net/Building:Mac:SCons
2009-12-28T23:54:44  <UH-Guard2> Title: Building:Mac:SCons - FIFE development wiki (at wiki.fifengine.net)
2009-12-28T23:54:51  <tommyd3mdi> I've updated it today to 0.8.2
2009-12-29T00:01:31  <tommyd3mdi> a tiny patch is needed which is included in the MP distribution - I hope the fix will be accepted by upstream as well (see http://code.google.com/p/guichan/issues/detail?id=122)
2009-12-29T00:01:32  <UH-Guard2> Title: Issue 122 - guichan - guichan 0.8.2: linkage fails with undefined symbols under Mac OS X 10.5.8 (Intel) - Project Hosting on Google Code (at code.google.com)
Title: Re: OS X Snow Leopard - build issues
Post by: hoffi on December 29, 2009, 08:02:44 am
I notice you have python_select installed.... which version of python do you have selected?   Did you try installing pyaml from source?  I believe that's what I had to do.

I have selected version 2.6.1
and i have pyyaml installed with macports and from source...
Title: Re: OS X Snow Leopard - build issues
Post by: prock on December 29, 2009, 08:17:50 am
hmm... can you import it manually without any errors like so:

Code: [Select]
computer:~ prock$ python
Python 2.6.4 (r264:75706, Oct 30 2009, 13:50:05)
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import yaml
>>>
Title: Re: OS X Snow Leopard - build issues
Post by: hoffi on December 29, 2009, 11:04:29 am
no tried this also... but dont work
Title: Re: OS X Snow Leopard - build issues
Post by: prock on December 29, 2009, 11:14:39 am
hmmm did you install PyYAML from source like this?

Code: [Select]

$ sudo python_select python26
$ wget http://pyyaml.org/download/pyyaml/PyYAML-3.09.tar.gz
$ tar -zxvf PyYAML-3.09.tar.gz
$ cd PyYAML-3.09
$ sudo python setup.py install

the above should work.
Title: Re: OS X Snow Leopard - build issues
Post by: hoffi on December 29, 2009, 01:54:36 pm
ok now i can import yaml without any error
but if i run fife i get this error:
Code: [Select]
  [...]
Extension tests
  24) tests.extension_tests.extension_test_utils
  25) tests.extension_tests.loaders_tests
  26) tests.extension_tests.modelview_tests
  27) all
Analyzers
  28) tests.analyzers.dep_analyzer
Other
  29) Run all tests
  30) Cancel and quit
-> : 24
Fatal Python error: Interpreter not initialized (version mismatch?)
Abort trap
(Python version: 2.6.4)
Title: Re: OS X Snow Leopard - build issues
Post by: prock on December 29, 2009, 02:20:35 pm
Hmm that tells me you may have compiled fife using a different version of Python....  try re-compiling FIFE:

Code: [Select]
$ cd <FIFE>/trunk
$ scons -c && scons

if you continue to get the same error you will have to look at your <FIFE>/build/darwin-config-dist.py file and make sure you have the correct paths to python in there.
Title: Re: OS X Snow Leopard - build issues
Post by: hoffi on December 30, 2009, 04:18:13 am
oh i see  :P
compiled with 2.6.1 ^^

it works now :D

thanks
Title: Re: OS X Snow Leopard - build issues
Post by: hoffi on December 30, 2009, 05:54:21 am
-.-
after the 3rd start i got an error:
Code: [Select]
dlopen(/Users/stefan/fife/engine/swigwrappers/python/_fife.so, 2): no suitable image found.  Did find:
/Users/stefan/fife/engine/swigwrappers/python/_fife.so: mach-o, but wrong architecture

dont know why...
Title: Re: OS X Snow Leopard - build issues
Post by: prock on December 30, 2009, 08:21:36 am
That's very odd...   try running lipo on the library like so:

Code: [Select]
$ lipo -info /Users/stefan/fife/engine/swigwrappers/python/_fife.so

You should get output like so:

Code: [Select]
$ lipo -info ./engine/swigwrappers/python/_fife.so
Non-fat file: ./engine/swigwrappers/python/_fife.so is architecture: x86_64
Title: Re: OS X Snow Leopard - build issues
Post by: hoffi on December 30, 2009, 12:45:36 pm
yes
Code: [Select]
lipo -info _fife.so
Non-fat file: _fife.so is architecture: x86_64
Title: Re: OS X Snow Leopard - build issues
Post by: prock on December 30, 2009, 04:00:35 pm
Hmmmm   what if you did something like this:

Code: [Select]
$ lipo -info `which python`
Non-fat file: /opt/local/bin/python is architecture: x86_64

Do you get the same output as me? 

(I'm just grasping at straws here.  I'm not sure why it would work then start reporting that the binary is the wrong architecture)
Title: Re: OS X Snow Leopard - build issues
Post by: hoffi on December 31, 2009, 03:28:40 am
Code: [Select]
$ lipo -info python
Non-fat file: python is architecture: x86_64
Title: Re: OS X Snow Leopard - build issues
Post by: prock on December 31, 2009, 04:12:36 pm
dunno man...  maybe re-compile everything again.
Title: Re: OS X Snow Leopard - build issues
Post by: zenbitz on December 15, 2010, 05:44:01 pm
Just posting here because I got FIFE to run on my mac.
Running 10.6.5 on an Intel macbook pro and with a CLEAN machine.  
64bit, Xcode version 3.2.5

I just installed everything using mac ports.

This was fife 0.3.2r2 for historical records.  I am attaching my "notes" (really just a list of all versions installed by macports)

Over all it did take a couple hours, mostly boost which took 50min.

Code: [Select]
o MacPorts (dmg) 1.9.2-10.6
oo Ports
oo scons
ooo deps: -->  Dependencies to be installed: python26 bzip2 db46 gdbm gettext expat libiconv gperf ncurses ncursesw openssl zlib readline sqlite3
- port python_select, select python26 as python (note this is 2.6.6 not mac-delivered 2.6.1)
oo  port install libsdl libsdl_ttf libsdl_image
--->  Computing dependencies for libsdl
--->  Dependencies to be installed: xorg-libXext pkgconfig xorg-libX11 xorg-bigreqsproto xorg-inputproto xorg-kbproto xorg-libXau xorg-xproto xorg-libXdmcp xorg-libxcb xorg-libpthread-stubs xorg-xcb-proto libxml2 xorg-util-macros xorg-xcmiscproto xorg-xextproto xorg-xf86bigfontproto xorg-xtrans xorg-libXrandr xorg-randrproto xrender xorg-renderproto
oo Installing libsdl @1.2.14_8
--->  Computing dependencies for libsdl_ttf
--->  Dependencies to be installed: freetype
oo --->  Installing libsdl_ttf @2.0.9_1
--->  Computing dependencies for libsdl_image
--->  Dependencies to be installed: jpeg libpng tiff
ooo --->  Installing jpeg @8b_0
ooo --->  Installing libpng @1.2.44_0
ooo --->  Installing tiff @3.9.4_0
oo --->  Installing libsdl_image @1.2.10_2
oo --->  Installing boost @1.45.0_1
oo --->  Installing libogg @1.2.1_1
oo --->  Installing libvorbis @1.3.2_0
oo --->  Installing boost-jam @3.1.18_0
--->  Computing dependencies for swig
--->  Dependencies to be installed: bison m4 gsed pcre
oo --->  Installing swig @2.0.1_0
oo --->  Installing swig-python @2.0.1_0
--->  Computing dependencies for libguichan
--->  Dependencies to be installed: mesa glut makedepend xorg-dri2proto xorg-glproto xorg-libXfixes xorg-fixesproto xorg-libXi xorg-libXmu xorg-libXt xorg-libsm xorg-libice
--->  Installing libguichan @0.8.2_0
Title: Re: OS X Snow Leopard - build issues
Post by: dsrogers on April 05, 2011, 10:22:56 pm
I managed to get the build working on snow leopord.  The problems are many fold.  First, scons from macports depends on python 2.6, which fink insists on compiling for itself..  Also, the fink dependencies for the python packages (like yaml), are installed for macports python 2.6, NOT the system 2.6.

Furthermore, the fink python 2.6 builds as a framework, but it's broken.  Consequently, when you build fife, it builds against the system python.  Furthermore, the system python is installed as "python" but the macports python 2.6 is installed as "python2.6"

So to fix the problem you have do one of:

1)
Fix the python2.6 framework so that fife can link against it.  Then fix all references to "python" in the tops of scripts to be "python2.6" (or symlink python2.6 as python, probably in ~/bin or something).

OR

2)
Install the extra python modules somewhere and add that to your PYTHONLIBDIR environment variable, and use the system python to link.  A complication here is that the mac build of fife explictly tries to use the headers from macports python 2.6, so you'll have to fix the darwin build of fife if you go down this route.

I opted for (1).

After installing the macport dependencies:

$ cd /opt/local/Library/Frameworks/Python.framework
$ cd Versions
$ ln -s 2.6 Current
$ cd ..
$ ln -s Versions/Current/Python Python
$ ln -s Versions/Current/Headers Headers
$ ln -s Versions/Current/Resources Resources

Then clean and rebuild fife.  If you've done this correctly, you should be able to use otool to see if it's linking against macports python.

$ otool -L <fife-dir>/build/release/_fife.so

Examine the output and make sure it's linking against the macports python and NOT the system python.  If it is, you should be able to go to your unknown-horizons directory and type:

$ python2.6 run_uh.py

You must explictly call python2.6 otherwise the #! in run_uh.py wlll call into "python" which is the system python and doesn't have the modules installed.

*an annoyance with this whole process is that macports will install both python 2.6 and python 2.7.  This means that the python framework in /opt/local will contain both a python 2.6 and python 2.7 dir.  However several of the dependencies available in fink are /only/ available as python  2.6 builds, so I made "2.6" the "Current" version in the framework to ensure that everything links against the version that appears to have better support.
Title: Re: OS X Snow Leopard - build issues
Post by: prock on April 06, 2011, 08:54:55 am
Dsrogers,

Just a quick note...  To switch python versions you can use the python_select macport..

Install python_select:
Code: [Select]
sudo port install python_select
Check which python distributions are available on your system:
Code: [Select]
python_select -l
Select a new version:
Code: [Select]
python_select -s pythonver

Here is a link to the macport: https://trac.macports.org/browser/trunk/dports/sysutils/python_select/Portfile (https://trac.macports.org/browser/trunk/dports/sysutils/python_select/Portfile)


Hope this helps...

prock