OS X Snow Leopard: Build Errors

I’m trying to build the latest CVS panda with Python 2.6 (installed via MacPorts) on Mac OS 10.6 (Snow Leopard), using ppremake. I get up to the step of actually building panda, but when I ‘make’ it, it builds a bunch of the object files but then errors out on libputil. It looks like this could be a 32- vs. 64-bit thing (it maybe expects ‘BitMaskNative’ to be a 32-bit bitmask?), but I’m building it against a 64-bit build of python.

I tried setting IGATE_ARCH to -D__x86_64__ in my Config.pp, but it had no noticeable effect. Has anyone run into this before?

Error message:

g++ -ftemplate-depth-30  -Wno-deprecated-declarations -c -o Opt3-OSX/libputil_igate.o -I. -I/Users/dplepage/Downloads/panda3d/panda -I../express -I../pandabase -I../pipeline -I/usr/local/panda/include -I/opt/local/include -I/opt/local/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -I/opt/local/include -I/opt/local/include/openssl -I/opt/local/include    -g -O2 -fPIC Opt3-OSX/libputil_igate.cxx
Opt3-OSX/libputil_igate.cxx: In function ‘PyObject* Dtool_BitArray_get_word_560(PyObject*, PyObject*, PyObject*)’:
Opt3-OSX/libputil_igate.cxx:39536: error: conversion from ‘BitMaskNative’ to non-scalar type ‘BitMask<unsigned int, 32>’ requested
Opt3-OSX/libputil_igate.cxx: In function ‘PyObject* Dtool_BitArray_set_word_561(PyObject*, PyObject*, PyObject*)’:
Opt3-OSX/libputil_igate.cxx:39614: error: no matching function for call to ‘BitArray::set_word(int, BitMask<unsigned int, 32>&)’
./bitArray.I:396: note: candidates are: void BitArray::set_word(int, BitMaskNative)
make[1]: *** [Opt3-OSX/libputil_igate.o] Error 1
make: *** [putil] Error 2

Thanks!

Try defining _LP64 instead of x86_64, and trying again after calling “make clean-igate”.

Nope, no luck - same error.

Following the reverse of the instructions partway down this thread, I got it to build that step by manually adding “-arch i386” to the build line; I’ve continued the build, but it did give me a (predictable) warning that “in Opt3-OSX/libputil_igate.o, file was built for i386 which is not the architecture being linked (x86_64)” so I expect this to fail down the line; I’ll post here when it finishes/crashes.
[/url]

Update: I am an idiot and forgot to rerun ppremake after updating IGATE_ARCH. With IGATE_ARCH set to -D_LP64, rebuilding produces new errors, shown below. Examining the source, the root of all these problems seems to be that in numerous places libputil_igate.cxx uses the type “unsigned long int” (32 bits) when other interfaces expect it to use “PN_uint64”, which is an “unsigned long long int” (64 bits).

g++ -ftemplate-depth-30  -Wno-deprecated-declarations -c -o Opt3-OSX/libputil_igate.o -I. -I/Users/dplepage/Downloads/panda3d/panda -I../express -I../pandabase -I../pipeline -I/usr/local/panda/include -I/opt/local/include -I/opt/local/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -I/opt/local/include -I/opt/local/include/openssl -I/opt/local/include    -g -O2 -fPIC Opt3-OSX/libputil_igate.cxx
Opt3-OSX/libputil_igate.cxx: In function ‘PyObject* Dtool_BitArray_get_word_560(PyObject*, PyObject*, PyObject*)’:
Opt3-OSX/libputil_igate.cxx:39536: error: conversion from ‘BitMaskNative’ to non-scalar type ‘BitMask<long unsigned int, 64>’ requested
Opt3-OSX/libputil_igate.cxx: In function ‘PyObject* Dtool_BitArray_set_word_561(PyObject*, PyObject*, PyObject*)’:
Opt3-OSX/libputil_igate.cxx:39614: error: no matching function for call to ‘BitArray::set_word(int, BitMask<long unsigned int, 64>&)’
./bitArray.I:396: note: candidates are: void BitArray::set_word(int, BitMaskNative)
./bitMask.I: In member function ‘int BitMask<WType, nbits>::get_num_on_bits() const [with WType = long unsigned int, int nbits = 64]’:
Opt3-OSX/libputil_igate.cxx:34099:   instantiated from here
./bitMask.I:408: error: call of overloaded ‘count_bits_in_word(long unsigned int)’ is ambiguous
./pbitops.I:21: note: candidates are: int count_bits_in_word(PN_uint16)
./pbitops.I:30: note:                 int count_bits_in_word(PN_uint32)
./pbitops.I:39: note:                 int count_bits_in_word(PN_uint64)
./bitMask.I: In member function ‘int BitMask<WType, nbits>::get_num_off_bits() const [with WType = long unsigned int, int nbits = 64]’:
Opt3-OSX/libputil_igate.cxx:34158:   instantiated from here
./bitMask.I:420: error: call of overloaded ‘count_bits_in_word(long unsigned int)’ is ambiguous
./pbitops.I:21: note: candidates are: int count_bits_in_word(PN_uint16)
./pbitops.I:30: note:                 int count_bits_in_word(PN_uint32)
./pbitops.I:39: note:                 int count_bits_in_word(PN_uint64)
./bitMask.I: In member function ‘int BitMask<WType, nbits>::get_lowest_on_bit() const [with WType = long unsigned int, int nbits = 64]’:
Opt3-OSX/libputil_igate.cxx:34217:   instantiated from here
./bitMask.I:432: error: call of overloaded ‘get_lowest_on_bit(const long unsigned int&)’ is ambiguous
./pbitops.I:139: note: candidates are: int get_lowest_on_bit(PN_uint16)
./pbitops.I:154: note:                 int get_lowest_on_bit(PN_uint32)
./pbitops.I:169: note:                 int get_lowest_on_bit(PN_uint64)
./bitMask.I: In member function ‘int BitMask<WType, nbits>::get_highest_on_bit() const [with WType = long unsigned int, int nbits = 64]’:
Opt3-OSX/libputil_igate.cxx:34335:   instantiated from here
./bitMask.I:456: error: call of overloaded ‘get_highest_on_bit(const long unsigned int&)’ is ambiguous
./pbitops.I:184: note: candidates are: int get_highest_on_bit(PN_uint16)
./pbitops.I:195: note:                 int get_highest_on_bit(PN_uint32)
./pbitops.I:206: note:                 int get_highest_on_bit(PN_uint64)
./bitMask.I: In member function ‘int BitMask<WType, nbits>::get_next_higher_different_bit(int) const [with WType = long unsigned int, int nbits = 64]’:
Opt3-OSX/libputil_igate.cxx:34454:   instantiated from here
./bitMask.I:521: error: call of overloaded ‘count_bits_in_word(long unsigned int)’ is ambiguous
./pbitops.I:21: note: candidates are: int count_bits_in_word(PN_uint16)
./pbitops.I:30: note:                 int count_bits_in_word(PN_uint32)
./pbitops.I:39: note:                 int count_bits_in_word(PN_uint64)
./bitMask.I: In member function ‘void BitMask<WType, nbits>::flood_down_in_place() [with WType = long unsigned int, int nbits = 64]’:
Opt3-OSX/libputil_igate.cxx:36468:   instantiated from here
./bitMask.I:879: error: call of overloaded ‘flood_bits_down(long unsigned int&)’ is ambiguous
./pbitops.I:49: note: candidates are: PN_uint16 flood_bits_down(PN_uint16)
./pbitops.I:63: note:                 PN_uint32 flood_bits_down(PN_uint32)
./pbitops.I:78: note:                 PN_uint64 flood_bits_down(PN_uint64)
./bitMask.I: In member function ‘void BitMask<WType, nbits>::flood_up_in_place() [with WType = long unsigned int, int nbits = 64]’:
Opt3-OSX/libputil_igate.cxx:36531:   instantiated from here
./bitMask.I:868: error: call of overloaded ‘flood_bits_up(long unsigned int&)’ is ambiguous
./pbitops.I:94: note: candidates are: PN_uint16 flood_bits_up(PN_uint16)
./pbitops.I:108: note:                 PN_uint32 flood_bits_up(PN_uint32)
./pbitops.I:123: note:                 PN_uint64 flood_bits_up(PN_uint64)
./bitMask.I: In member function ‘BitMask<WType, nbits> BitMask<WType, nbits>::flood_bits_down() const [with WType = long unsigned int, int nbits = 64]’:
Opt3-OSX/libputil_igate.cxx:36594:   instantiated from here
./bitMask.I:902: error: call of overloaded ‘flood_bits_down(const long unsigned int&)’ is ambiguous
./pbitops.I:49: note: candidates are: PN_uint16 flood_bits_down(PN_uint16)
./pbitops.I:63: note:                 PN_uint32 flood_bits_down(PN_uint32)
./pbitops.I:78: note:                 PN_uint64 flood_bits_down(PN_uint64)
./bitMask.I: In member function ‘BitMask<WType, nbits> BitMask<WType, nbits>::flood_bits_up() const [with WType = long unsigned int, int nbits = 64]’:
Opt3-OSX/libputil_igate.cxx:36659:   instantiated from here
./bitMask.I:890: error: call of overloaded ‘flood_bits_up(const long unsigned int&)’ is ambiguous
./pbitops.I:94: note: candidates are: PN_uint16 flood_bits_up(PN_uint16)
./pbitops.I:108: note:                 PN_uint32 flood_bits_up(PN_uint32)
./pbitops.I:123: note:                 PN_uint64 flood_bits_up(PN_uint64)
make[1]: *** [Opt3-OSX/libputil_igate.o] Error 1
make: *** [putil] Error 2

All of these errors are variants on the same problem: you have to get interrogate and the compiler to agree on the number of bits of a word.

Do you want a 32-bit architecture or a 64-bit architecture? You have to pick one, you currently can’t build a universal binary support for both size architectures in one pass. Note that interrogate’s default is 32-bit, while the compiler’s default (on Snow Leopard) may be 64-bit depending on your system settings, so you have to be explicit in both cases.

After switching, you may also have to “make clean” to ensure that the old generated files are removed so they can be rebuilt correctly.

David

I would like interrogate and the compiler to use 64-bit words, as that’s how I compiled python, but I can’t seem to convince interrogate to do so. I put

#define IGATE_ARCH -D_LP64

in my Config.pp, which, judging by the source of dtoolbase.h, should cause it to define NATIVE_WORDSIZE to 64. But I still get the errors above. Is there another flag I’m missing for libputil’s word size?

Maybe your compiler is building universal binaries by default, so the error is generated on the 32-bit pass? Try adding:

#define ARCH_FLAGS -arch x86_64

David

That didn’t work either, but I went in and replaced all occurrences of “BitMask<unsigned long int, 64 >” with “BitMaskNative” in libputil_igate.cxx and that seems to have fixed the problem. I’m still unsure as to how those were not already equivalent (I made sure that -arch x86_64 was in the gcc args), but it works now.