Error compiling 1.5.0 under Ubuntu Gutsy 7.10 64-bit

Hi all,

I’m very interested in trying out Panda, but I’m having trouble getting the source to build on my system. After having rerun makepanda.py several times to try various things (library installs, etc), here’s the error I’m getting:

Generating dependencies…
g++ -o built/bin/interrogate -Lbuilt/lib -L/usr/X11R6/lib built/tmp/interrogate_composite.o built/tmp/libcppParser.a -lp3dtool -lp3dtoolconfig -lp3pystub -lssl -lpthread -ldl
built/lib/libp3dtoolconfig.so: undefined reference to `Py_InitModule4_64’
collect2: ld returned 1 exit status
Storing dependency cache.
Elapsed Time: 1 sec

I’ve got Python 2.5 and associated dev libraries installed, so I’m not really sure what I’m missing. Can someone help me out?

Thanks!

I’m not sure anybody’s tried compiling it on that version of linux. Not too many 64-bit users around here. But I know what that error is, and how to fix it.

So here’s the nutshell explanation: Panda3D contains calls into the Python runtime system. However, many of our smaller utility programs don’t really need python: it would be a shame to have to link in the entire python runtime system to a program that isn’t even using it.

To solve that problem, we created the python stub library, a tiny dummy library that exports all the same functions as the python runtime system. That’s what the -lpystub on the compiler command line is. Apparently, our python stub library is missing a function - Py_InitModule4_64. It’s really easy to add a function to the stub library: take a look at dtool/src/pystub/pystub.cxx. Just go ahead and add another stub, and you should be able to get past that error.

Josh,

Thanks for the help! Adding the proper stub got me a lot farther. However, I ran into another issue. It looks like another 64-bit compatibility problem. Here’s the output from makepanda.py --everything:

Generating dependencies...
built/bin/interrogate -srcdir panda/src/putil -DCPPPARSER -D__STDC__=1 -D__cplusplus -D__i386__ -D__const=const  -oc built/tmp/libputil_igate.cxx -od built/pandac/input/libputil.in -fnames -string -refcount -assert -python-native -Sbuilt/include/parser-inc -Ibuilt/tmp -Ipanda/src/putil -Ibuilt/include -S/usr/include/python2.5 -Sthirdparty/linux-libs-a/zlib/include -S/usr/include -DBUILDING_PANDA -module panda -library libputil animInterface.h bam.h bamCache.h bamCacheIndex.h bamCacheRecord.h bamEndian.h bamReader.h bamReaderParam.h bamTextureMode.h bamWriter.h bitArray.h bitMask.h buttonHandle.h buttonRegistry.h cachedTypedWritableReferenceCount.h clockObject.h collideMask.h compareTo.h config_util.h configurable.h copyOnWriteObject.h copyOnWritePointer.h datagramInputFile.h datagramOutputFile.h doubleBitMask.h drawMask.h factory.h factoryBase.h factoryParam.h factoryParams.h firstOfPairCompare.h firstOfPairLess.h globalPointerRegistry.h indirectCompareNames.h indirectCompareSort.h indirectCompareTo.h ioPtaDatagramFloat.h ioPtaDatagramInt.h ioPtaDatagramShort.h iterator_types.h keyboardButton.h lineStream.h lineStreamBuf.h linkedListNode.h load_prc_file.h modifierButtons.h mouseButton.h mouseData.h nameUniquifier.h nodeCachedReferenceCount.h portalMask.h pta_double.h pta_float.h pta_int.h pta_ushort.h putil_composite.cxx simpleHashMap.h sparseArray.h stringStream.h stringStreamBuf.h string_utils.h timedCycle.h typedWritable.h typedWritableReferenceCount.h uniqueIdAllocator.h updateSeq.h vector_double.h vector_float.h vector_typedWritable.h vector_ulong.h vector_ushort.h vector_writable.h writableConfigurable.h writableParam.h
g++ -ftemplate-depth-30 -fPIC -c -o built/tmp/libputil_igate.o -I"/usr/include/python2.5" -Ibuilt/tmp -Ipanda/src/putil -Ibuilt/include -O2 -DBUILDING_PANDA built/tmp/libputil_igate.cxx
built/tmp/libputil_igate.cxx: In function ‘PyObject* Dtool_BitArray_get_word_348(PyObject*, PyObject*, PyObject*)’:
built/tmp/libputil_igate.cxx:22068: error: conversion from ‘BitMaskNative’ to non-scalar type ‘BitMask<unsigned int, 32>’ requested
built/tmp/libputil_igate.cxx: In function ‘PyObject* Dtool_BitArray_set_word_349(PyObject*, PyObject*, PyObject*)’:
built/tmp/libputil_igate.cxx:22138: error: no matching function for call to ‘BitArray::set_word(int, BitMask<unsigned int, 32>&)’
panda/src/putil/bitArray.I:400: note: candidates are: void BitArray::set_word(int, BitMaskNative)
panda/src/putil/bitMask.I: In member function ‘int BitMask<WType, nbits>::get_num_on_bits() const [with WType = long long unsigned int, int nbits = 64]’:
built/tmp/libputil_igate.cxx:17270:   instantiated from here
panda/src/putil/bitMask.I:412: error: call of overloaded ‘count_bits_in_word(const long long unsigned int&)’ is ambiguous
panda/src/putil/bitMask.I:879: note: candidates are: int count_bits_in_word(PN_uint32)
panda/src/putil/bitMask.I:888: note:                 int count_bits_in_word(PN_uint64)
panda/src/putil/bitMask.I: In member function ‘int BitMask<WType, nbits>::get_num_off_bits() const [with WType = long long unsigned int, int nbits = 64]’:
built/tmp/libputil_igate.cxx:17326:   instantiated from here
panda/src/putil/bitMask.I:424: error: call of overloaded ‘count_bits_in_word(long long unsigned int)’ is ambiguous
panda/src/putil/bitMask.I:879: note: candidates are: int count_bits_in_word(PN_uint32)
panda/src/putil/bitMask.I:888: note:                 int count_bits_in_word(PN_uint64)
panda/src/putil/bitMask.I: In member function ‘int BitMask<WType, nbits>::get_lowest_on_bit() const [with WType = long long unsigned int, int nbits = 64]’:
built/tmp/libputil_igate.cxx:17382:   instantiated from here
panda/src/putil/bitMask.I:441: error: call of overloaded ‘count_bits_in_word(long long unsigned int)’ is ambiguous
panda/src/putil/bitMask.I:879: note: candidates are: int count_bits_in_word(PN_uint32)
panda/src/putil/bitMask.I:888: note:                 int count_bits_in_word(PN_uint64)
panda/src/putil/bitMask.I: In member function ‘int BitMask<WType, nbits>::get_highest_on_bit() const [with WType = long long unsigned int, int nbits = 64]’:
built/tmp/libputil_igate.cxx:17494:   instantiated from here
panda/src/putil/bitMask.I:469: error: call of overloaded ‘flood_bits_down(const long long unsigned int&)’ is ambiguous
panda/src/putil/bitMask.I:898: note: candidates are: PN_uint32 flood_bits_down(PN_uint32)
panda/src/putil/bitMask.I:913: note:                 PN_uint64 flood_bits_down(PN_uint64)
panda/src/putil/bitMask.I:470: error: call of overloaded ‘count_bits_in_word(long long unsigned int&)’ is ambiguous
panda/src/putil/bitMask.I:879: note: candidates are: int count_bits_in_word(PN_uint32)
panda/src/putil/bitMask.I:888: note:                 int count_bits_in_word(PN_uint64)
panda/src/putil/bitMask.I: In member function ‘int BitMask<WType, nbits>::get_next_higher_different_bit(int) const [with WType = long long unsigned int, int nbits = 64]’:
built/tmp/libputil_igate.cxx:17607:   instantiated from here
panda/src/putil/bitMask.I:535: error: call of overloaded ‘count_bits_in_word(long long unsigned int)’ is ambiguous
panda/src/putil/bitMask.I:879: note: candidates are: int count_bits_in_word(PN_uint32)
panda/src/putil/bitMask.I:888: note:                 int count_bits_in_word(PN_uint64)
panda/src/putil/bitMask.I: In member function ‘void BitMask<WType, nbits>::flood_down_in_place() [with WType = long long unsigned int, int nbits = 64]’:
built/tmp/libputil_igate.cxx:19241:   instantiated from here
panda/src/putil/bitMask.I:975: error: call of overloaded ‘flood_bits_down(long long unsigned int&)’ is ambiguous
panda/src/putil/bitMask.I:898: note: candidates are: PN_uint32 flood_bits_down(PN_uint32)
panda/src/putil/bitMask.I:913: note:                 PN_uint64 flood_bits_down(PN_uint64)
panda/src/putil/bitMask.I: In member function ‘void BitMask<WType, nbits>::flood_up_in_place() [with WType = long long unsigned int, int nbits = 64]’:
built/tmp/libputil_igate.cxx:19301:   instantiated from here
panda/src/putil/bitMask.I:964: error: call of overloaded ‘flood_bits_up(long long unsigned int&)’ is ambiguous
panda/src/putil/bitMask.I:929: note: candidates are: PN_uint32 flood_bits_up(PN_uint32)
panda/src/putil/bitMask.I:944: note:                 PN_uint64 flood_bits_up(PN_uint64)
panda/src/putil/bitMask.I: In member function ‘BitMask<WType, nbits> BitMask<WType, nbits>::flood_bits_down() const [with WType = long long unsigned int, int nbits = 64]’:
built/tmp/libputil_igate.cxx:19361:   instantiated from here
panda/src/putil/bitMask.I:998: error: call of overloaded ‘flood_bits_down(const long long unsigned int&)’ is ambiguous
panda/src/putil/bitMask.I:898: note: candidates are: PN_uint32 flood_bits_down(PN_uint32)
panda/src/putil/bitMask.I:913: note:                 PN_uint64 flood_bits_down(PN_uint64)
panda/src/putil/bitMask.I: In member function ‘BitMask<WType, nbits> BitMask<WType, nbits>::flood_bits_up() const [with WType = long long unsigned int, int nbits = 64]’:
built/tmp/libputil_igate.cxx:19423:   instantiated from here
panda/src/putil/bitMask.I:986: error: call of overloaded ‘flood_bits_up(const long long unsigned int&)’ is ambiguous
panda/src/putil/bitMask.I:929: note: candidates are: PN_uint32 flood_bits_up(PN_uint32)
panda/src/putil/bitMask.I:944: note:                 PN_uint64 flood_bits_up(PN_uint64)
Storing dependency cache.
Elapsed Time: 5 sec

Any clues? I’ve taken a look at the source code but I’m not C++ expert, so everything looks fine to me.

Thanks again!

I think we need help from David on that one.

Interrogate incorrectly believes it is running in 32-bit mode. You will need to add -D_LP64 to the interrogate command line.

David

Look in makepanda.py for this:

cmd = "built/bin/interrogate

on the next line, you will see this:

    cmd = cmd + ' -DCPPPARSER -D__STDC__=1 -D__cplusplus -longlong __int64 -D_X86_ -DWIN32_VC -D_WIN32'

Is it possible that the -D_X86_ is causing problems? Perhaps we should take that out before adding the -D_LP64?

Probably a good idea.

David

Actually I think the line quoted there is the Windows compiler, the Linux stuff is a little further down. Perhaps there should be a check somewhere for Linux 64-bit? I think you can check for 64-bitness in Python in Linux with the following:

if (math.pow(2, 63)-1 == sys.maxint):
    print "64-bit system detected"

This seems to work properly on 32 and 64-bit systems (ie the if succeeds on 64-bit and fails on 32-bit systems).

I’m still getting errors, but I haven’t had the time in the past day or two to post anything about them.

i have followed the instructions in this thread, because it seemed to follow along perfectly with the compiler errors i was having. the last step i took involved changing my compiler cmd line to:

cmd = cmd + ' -DCPPPARSER -D__STDC__=1 -D__cplusplus -D_LP64 -D__const=const'

(found in makepanda.py)

now i am getting the following error message:

In file included from panda/src/pgraph/pgraph_composite4.cxx:30:
built/include/stl_compares.I: In static member function ‘static size_t integer_hash<Key, Compare>::add_hash(size_t, const Key&) [with Key = const void*, Compare = std::less<const void*>]’:
panda/src/pgraph/renderState.cxx:156:   instantiated from here
built/include/stl_compares.I:127: error: cast from ‘const void*’ to ‘PN_uint32’ loses precision

and this is now where i am stuck. if anyone could help me out i’d really appreciate it.

You’re going to need David’s help. But he mostly does this during California daytime, so you have a few hours to wait.

Just to prove Josh wrong, I’ll chime in right now (a little bit of insomnia on my part).

Try changing line 127 of dtool/src/dtoolbase/stl_compares.I from:

PN_uint32 key32 = (PN_uint32)key;

to:

PN_uint32 key32 = (PN_uint32)reinterpret_cast<unsigned long>(key);

David

thanks. i’m at work now, but i’ll give it a shot when i get back home.

hello everybody

i have the same problem as jdubbs,

i tried the change:

PN_uint32 key32 = (PN_uint32)reinterpret_cast(key);

but it seems like it’s not working. i get this error

built/tmp/liblerp_igate.cxx:343:   instantiated from here
built/include/lerpfunctor.h:263: warning: converting to ‘int’ from ‘float’
g++ -ftemplate-depth-30 -fPIC -c -o built/tmp/pgraph_nodePath.o -I"/usr/include/python2.5" -I"built/tmp" -I"built/include" -Ipanda/src/pgraph -O2 -DBUILDING_PANDA panda/src/pgraph/nodePath.cxx
g++ -ftemplate-depth-30 -fPIC -c -o built/tmp/pgraph_composite1.o -I"/usr/include/python2.5" -I"built/tmp" -I"built/include" -Ipanda/src/pgraph -O2 -DBUILDING_PANDA panda/src/pgraph/pgraph_composite1.cxx
g++ -ftemplate-depth-30 -fPIC -c -o built/tmp/pgraph_composite2.o -I"/usr/include/python2.5" -I"built/tmp" -I"built/include" -Ipanda/src/pgraph -O2 -DBUILDING_PANDA panda/src/pgraph/pgraph_composite2.cxx
g++ -ftemplate-depth-30 -fPIC -c -o built/tmp/pgraph_composite3.o -I"/usr/include/python2.5" -I"built/tmp" -I"built/include" -Ipanda/src/pgraph -O2 -DBUILDING_PANDA panda/src/pgraph/pgraph_composite3.cxx
panda/src/pgraph/lightRampAttrib.cxx: In member function ‘virtual int LightRampAttrib::compare_to_impl(const RenderAttrib*) const’:
panda/src/pgraph/lightRampAttrib.cxx:243: warning: converting to ‘int’ from ‘float’
panda/src/pgraph/lightRampAttrib.cxx:249: warning: converting to ‘int’ from ‘float’
g++ -ftemplate-depth-30 -fPIC -c -o built/tmp/pgraph_composite4.o -I"/usr/include/python2.5" -I"built/tmp" -I"built/include" -Ipanda/src/pgraph -O2 -DBUILDING_PANDA panda/src/pgraph/pgraph_composite4.cxx
built/include/stl_compares.I: In static member function ‘static size_t integer_hash<Key, Compare>::add_hash(size_t, const Key&) [with Key = int, Compare = std::less<int>]’:
panda/src/pgraph/renderState.cxx:157:   instantiated from here
built/include/stl_compares.I:127: error: invalid cast from type ‘int’ to type ‘long unsigned int’
Storing dependency cache.
Elapsed Time: 10 min 52 sec

i hope somebody can help me out :slight_smile:

it will be nice to have panda3d running on my ubuntu :wink:

t

you can still get 32 bit panda running on 64 bit ubuntu (with tricks), but its would be much nicer to have 64 bit panda - i also run ubuntu unfortunately not 64 bit.

You can get 32-bit python running, but to do so, you have to use 32-bit python, which isn’t the native python interpreter on that OS, which is a giant mess. I wouldn’t recommend it.

well actually i have panda already on my x86 ubuntu notebook running, and i would love to have it on my desktop (64) too but not as 32 :frowning:

Don’t panic, we’re halfway there, and we’ve only been working on it for a day or two. It won’t take long.

Feh. It’s like the new C++ typecast rules are designed specifically to make templates harder to use.

I just checked in changes to stl_compares.h and stl_compares.I. Try dropping my new versions of these files over your existing ones. (Click on the filenames for the links.)

We’ll probably have a few more back-and-forth attempts like this, my apologies. I don’t have convenient access to a 64-bit Linux installation, so I have no way to detect problems like this before you discover them.

David

Dang. Try these new versions instead: stl_compares.h and stl_compares.I.

David

thanks, david. got farther this time. new errors:

g++ -ftemplate-depth-30 -fPIC -c -o built/tmp/pnmtext_composite.o -I"/usr/include/python2.5" -I/usr/include/freetype2 -Ibuilt/tmp -Ipanda/src/pnmtext -Ibuilt/include -O2 -DBUILDING_PANDA panda/src/pnmtext/pnmtext_composite.cxx
In file included from panda/src/pnmtext/freetypeFont.cxx:19,
                 from panda/src/pnmtext/pnmtext_composite1.cxx:2,
                 from panda/src/pnmtext/pnmtext_composite.cxx:1:
panda/src/pnmtext/freetypeFont.h:33:22: error: ft2build.h: No such file or directory
panda/src/pnmtext/freetypeFont.h:34:10: error: #include expects "FILENAME" or <FILENAME>
In file included from panda/src/pnmtext/pnmTextMaker.cxx:18,
                 from panda/src/pnmtext/pnmtext_composite1.cxx:4,
                 from panda/src/pnmtext/pnmtext_composite.cxx:1:
panda/src/pnmtext/pnmTextMaker.h:28:10: error: #include expects "FILENAME" or <FILENAME>
In file included from panda/src/pnmtext/freetypeFont.cxx:19,
                 from panda/src/pnmtext/pnmtext_composite1.cxx:2,
                 from panda/src/pnmtext/pnmtext_composite.cxx:1:
panda/src/pnmtext/freetypeFont.h:80: error: expected ‘,’ or ‘...’ before ‘&’ token
panda/src/pnmtext/freetypeFont.h:80: error: ISO C++ forbids declaration of ‘FT_Bitmap’ with no type
panda/src/pnmtext/freetypeFont.h:100: error: ‘FT_Face’ does not name a type
panda/src/pnmtext/freetypeFont.h:110: error: ‘FT_Library’ does not name a type
In file included from panda/src/pnmtext/pnmtext_composite1.cxx:2,
                 from panda/src/pnmtext/pnmtext_composite.cxx:1:
panda/src/pnmtext/freetypeFont.cxx:28: error: ‘FT_Library’ does not name a type
panda/src/pnmtext/freetypeFont.cxx: In member function ‘bool FreetypeFont::load_font(const Filename&, int)’:
panda/src/pnmtext/freetypeFont.cxx:91: error: ‘_ft_library’ was not declared in this scope
panda/src/pnmtext/freetypeFont.cxx:92: error: ISO C++ forbids declaration of ‘type name’ with no type
panda/src/pnmtext/freetypeFont.cxx:92: error: ISO C++ forbids declaration of ‘type name’ with no type
panda/src/pnmtext/freetypeFont.cxx:92: error: expected primary-expression before ‘const’
panda/src/pnmtext/freetypeFont.cxx:92: error: expected `)' before ‘const’
panda/src/pnmtext/freetypeFont.cxx:101: error: ‘FT_Err_Unknown_File_Format’ was not declared in this scope
panda/src/pnmtext/freetypeFont.cxx: In member function ‘bool FreetypeFont::load_font(const char*, int, int)’:
panda/src/pnmtext/freetypeFont.cxx:134: error: ‘_ft_library’ was not declared in this scope
panda/src/pnmtext/freetypeFont.cxx:135: error: ISO C++ forbids declaration of ‘type name’ with no type
panda/src/pnmtext/freetypeFont.cxx:135: error: ISO C++ forbids declaration of ‘type name’ with no type
panda/src/pnmtext/freetypeFont.cxx:135: error: expected primary-expression before ‘const’
panda/src/pnmtext/freetypeFont.cxx:135: error: expected `)' before ‘const’
panda/src/pnmtext/freetypeFont.cxx:138: error: ‘FT_Err_Unknown_File_Format’ was not declared in this scope
panda/src/pnmtext/freetypeFont.cxx: In member function ‘void FreetypeFont::unload_font()’:
panda/src/pnmtext/freetypeFont.cxx:160: error: ‘_face’ was not declared in this scope
panda/src/pnmtext/freetypeFont.cxx:160: error: ‘FT_Done_Face’ was not declared in this scope
panda/src/pnmtext/freetypeFont.cxx: In member function ‘bool FreetypeFont::load_glyph(int, bool)’:
panda/src/pnmtext/freetypeFont.cxx:174: error: ‘FT_LOAD_RENDER’ was not declared in this scope
panda/src/pnmtext/freetypeFont.cxx:176: error: ‘FT_LOAD_MONOCHROME’ was not declared in this scope
panda/src/pnmtext/freetypeFont.cxx:185: error: ‘_face’ was not declared in this scope
panda/src/pnmtext/freetypeFont.cxx:185: error: ‘FT_Load_Glyph’ was not declared in this scope
panda/src/pnmtext/freetypeFont.cxx: At global scope:
panda/src/pnmtext/freetypeFont.cxx:201: error: expected ‘,’ or ‘...’ before ‘&’ token
panda/src/pnmtext/freetypeFont.cxx:201: error: ISO C++ forbids declaration of ‘FT_Bitmap’ with no type
panda/src/pnmtext/freetypeFont.cxx: In member function ‘void FreetypeFont::copy_bitmap_to_pnmimage(int)’:
panda/src/pnmtext/freetypeFont.cxx:202: error: ‘bitmap’ was not declared in this scope
panda/src/pnmtext/freetypeFont.cxx:202: error: ‘ft_pixel_mode_grays’ was not declared in this scope
panda/src/pnmtext/freetypeFont.cxx:203: error: ‘image’ was not declared in this scope
panda/src/pnmtext/freetypeFont.cxx:214: error: ‘ft_pixel_mode_mono’ was not declared in this scope
panda/src/pnmtext/freetypeFont.cxx: In member function ‘bool FreetypeFont::font_loaded()’:
panda/src/pnmtext/freetypeFont.cxx:264: error: ‘_face’ was not declared in this scope
panda/src/pnmtext/freetypeFont.cxx:300: error: ‘FT_Set_Charmap’ was not declared in this scope
panda/src/pnmtext/freetypeFont.cxx: In member function ‘bool FreetypeFont::reset_scale()’:
panda/src/pnmtext/freetypeFont.cxx:327: error: ‘_face’ was not declared in this scope
panda/src/pnmtext/freetypeFont.cxx:329: error: ‘FT_Set_Char_Size’ was not declared in this scope
panda/src/pnmtext/freetypeFont.cxx:359: error: ‘FT_Set_Pixel_Sizes’ was not declared in this scope
panda/src/pnmtext/freetypeFont.cxx:385: error: ‘FT_LOAD_DEFAULT’ was not declared in this scope
panda/src/pnmtext/freetypeFont.cxx:385: error: ‘FT_Load_Char’ was not declared in this scope
panda/src/pnmtext/freetypeFont.cxx: In static member function ‘static void FreetypeFont::initialize_ft_library()’:
panda/src/pnmtext/freetypeFont.cxx:406: error: ‘_ft_library’ was not declared in this scope
panda/src/pnmtext/freetypeFont.cxx:406: error: ‘FT_Init_FreeType’ was not declared in this scope
In file included from panda/src/pnmtext/pnmtext_composite1.cxx:4,
                 from panda/src/pnmtext/pnmtext_composite.cxx:1:
panda/src/pnmtext/pnmTextMaker.cxx: In member function ‘PNMTextGlyph* PNMTextMaker::get_glyph(int)’:
panda/src/pnmtext/pnmTextMaker.cxx:118: error: ‘_face’ was not declared in this scope
panda/src/pnmtext/pnmTextMaker.cxx:118: error: ‘FT_Get_Char_Index’ was not declared in this scope
panda/src/pnmtext/pnmTextMaker.cxx: In member function ‘PNMTextGlyph* PNMTextMaker::make_glyph(int)’:
panda/src/pnmtext/pnmTextMaker.cxx:157: error: ‘FT_GlyphSlot’ was not declared in this scope
panda/src/pnmtext/pnmTextMaker.cxx:157: error: expected `;' before ‘slot’
panda/src/pnmtext/pnmTextMaker.cxx:158: error: ‘FT_Bitmap’ was not declared in this scope
panda/src/pnmtext/pnmTextMaker.cxx:158: error: ‘bitmap’ was not declared in this scope
panda/src/pnmtext/pnmTextMaker.cxx:158: error: ‘slot’ was not declared in this scope