It took me some time to get it to work, but I can now build Panda3d on my shiny new Snow Leapord MacBook. After reading all the forums to get help, I felt that it would be ungrateful of me not to feed back what worked. I can’t guarantee that this method will work with everyone, but hopefully this will give you some clues so that the build works on your Mac.
I had to move my MacPorts folder out of the way to avoid confusion:
sudo mv /opt/local /opt/local_temporarily_dont_use
Before you start, you need to tell it to use 32 bit Python (or it gets unhappy)
export VERSIONER_PYTHON_PREFER_32_BIT=yes
Download the Mac source with ALL third party libraries: panda3d-1.7.0-mac.tar.gz.
In makepanda.py, force the architecture to be ONLY 32 bit.
I think this is because some of my MacPorts files were compiled to be 64 bit only, and not 32/64 bit hybrids.
In makepanda/makepanda.py, line 666 and 906
cmd += " -arch i386 "
# if int(platform.mac_ver()[0][3]) >= 6:
# cmd += " -arch x86_64 -arch i386"
# else:
# cmd += " -arch i386"
# if ("NOPPC" not in opts): cmd += " -arch ppc"
We don’t want Mesa (especially on Mac), remove it by commenting the whole block out of makepanda.py, lines 3026 to 3038
In Line 749, set the -D_L bit at the end to be only 32 bit
cmd += ’ -DCPPPARSER -D__STDC__=1 -D__cplusplus -D__inline -D__const=const -D__i386__’
From the forums, I found that you need to patch these two files:
Index: pandatool/src/vrml/vrmlLexer.lxx
RCS file: /cvsroot/panda3d/pandatool/src/vrml/vrmlLexer.lxx,v
retrieving revision 1.7
diff -r1.7 vrmlLexer.lxx
157c157,164
< #define YY_INPUT(buffer, result, max_size) input_chars(buffer, result, max_size)
// Define this macro carefully, since different flex versions call it
// with a different type for result.
#define YY_INPUT(buffer, result, max_size) { \
int int_result; \
input_chars((buffer), int_result, (max_size)); \
(result) = int_result; \
}
Index: pandatool/src/xfile/xLexer.lxx
===================================================================
RCS file: /cvsroot/panda3d/pandatool/src/xfile/xLexer.lxx,v
retrieving revision 1.11
diff -r1.11 xLexer.lxx
150c150,157
< #define YY_INPUT(buffer, result, max_size) input_chars(buffer, result, max_size)
// Define this macro carefully, since different flex versions call it
// with a different type for result.
#define YY_INPUT(buffer, result, max_size) { \
int int_result; \
input_chars((buffer), int_result, (max_size)); \
(result) = int_result; \
}
Now you can build everything:
makepanda/makepanda.py --everything
Go get your coffee while it compiles.
When you’re done and you wan to test it out, update your environment to point to your fresh new version
export VERSIONER_PYTHON_PREFER_32_BIT=yes
export DYLD_LIBRARY_PATH=/Users/chompy/chompygames/scratch/panda3d/built/lib
export PYTHONPATH=/Users/chompy/chompygames/scratch/panda3d/built:/Users/chompy/chompygames/scratch/panda3d/built/lib
Edit the file /Library/Python/2.6/site-packages/Panda3D.pth to point to:
/Users/chompy/chompygames/scratch/panda3d/built
If all goes well, you should be able to run your app now
python ChompyGames.py