genpycode crashes

Hi,

pretty much towards the end of the build process (with makepanda --everything --no-fftw) I get this error:

Importing code library: libpandaexpress
Traceback (most recent call last):
  File "<string>", line 1, in ?
  File "<LocalPandaRoot>\panda3d\built\direct\..\..\direct\src\ffi\jGenPyCode.py", line 94, in ?
    DoGenPyCode.run()
  File "<LocalPandaRoot>\panda3d\built\direct\..\..\direct\src\ffi\DoGenPyCode.py", line 290, in run
    generateNativeWrappers()
  File "<LocalPandaRoot>\panda3d\built\direct\..\..\direct\src\ffi\DoGenPyCode.py", line 253, in generateNativeWrappers
    exec('import %s as module' % moduleName)
  File "<string>", line 1, in ?
ImportError: DLL load failed: Eine DLL-Initialisierungsroutine ist fehlgeschlagen. {dll-initialization failed}

Looking at the traceback as well as the python source, it seems it crashes while trying to load libpandaexpress.dll. But this library has successfully been build and is lying in build/bin.

The unsettling thing is, pview.exe crashes, too. As per my debugger, inside

WindowFramework::setup_trackball()

when trying to

_trackball = new Trackball("trackball");

it somehow jumps via trackball’s constructor into

ModifierButtons::set_button_list

(more details are not available with the optimized build) and crashes because inside that method this==NULL.

I had a hunch that these problems might have something to do with dependencies on different versions of the MS runtime dll. So i checked and all binaries generated by the build process depend on the 80 versions (as expected after building with MS Visual Studio 2005). Only ppython.exe and ppythonw.exe depend on 71 instead - so I’d guess these two don’t get built by makepanda, but are rather copied from the 3rd-parties directory.
In any case, I am clueless now. I had the same problem before with a build where I disabled more modules, so I thought maybe the problem lies there and did a new build with the settings as noted above.
It’s kinda frustrating because I’ve spent quite some time now all in all to get panda to build and it seems I’m just that close. But now I am hitting a brickwall…

Any ideas/suggestions will be greatly appreciated,
many thanks,

Max Hajek

It sounds like you’ve got a mismatched dll. Is it possible you’re conflicting with an older or previously installed version of libpanda.dll? Try removing all other versions of Panda from your system.

David

Hi,

thanks for the quick response. I did a search over my whole harddrive for libpanda.dll, and (unfortunately) I have exactly one which is the one built with makepanda and part of the current problem.

Any other ideas?

Thanks,
Max Hajek

Try completely cleaning out the build directory and making a clean build from scratch.

David

I did that (deleted the build directory and triggered another build).

Now I get plenty of errors with calls to egg2bam like

built/bin/egg2bam -o built/models/misc/camera.bam built/tmp/camera.flt.egg

(egg2bam just crashes)
When I look at it in the debugger, I see something really weird:
in load_egg_file.cxx, around line 30, loader is definitely not null, but inside eggloader.cxx, in EggLoader::build_graph() this==null.

Again, any ideas?

Many thanks,
Max Hajek

Question: using a depency viewer, I see that libpanda.dll, libpandaexpress.dll and libpandaegg.dll all depend on python24.dll - is that correct? And if so, might it be a problem that python24.dll depends on msvcr71.dll rather than msvcr80.dll (although, obviously I got both of them on my system)?

Or do you have any other idea what could be wrong with my setup/build?

Many thanks for your help and support,
Max Hajek

Unfortunately, this means nothing. When C++ code has been compiled with optimizations enabled, the Microsoft debugger is worthless for reporting accurate values for stack variables, especially this, in stack traces. It seems to report that this == null more often than not, even in working code.

Question: using a depency viewer, I see that libpanda.dll, libpandaexpress.dll and libpandaegg.dll all depend on python24.dll - is that correct? And if so, might it be a problem that python24.dll depends on msvcr71.dll rather than msvcr80.dll (although, obviously I got both of them on my system)? 

Hmm, maybe. If that’s the problem, you may need to download Python from source and build it yourself (it actually builds fairly easily, in my experience).

It may also be worthwhile to try a new build of Panda either (a) with full optimizations disabled, e.g. with OPTIMIZE = 1, and/or (b) with Python disabled. In either case, you’re probably best off blowing away the build directory again before switching this low-level build state.

David

Hi David,

thanks for your answer. I’ll try both. I’ve got to go to the hospital tomorrow for a few days, though, so it’ll probably be a week or two till you hear from me again.
In any case, I’ll post here again what’s the outcome.

Many thanks,
Max Hajek

Max, that might be a good reason for your problems. I’ve heard similiar reports, but couldn’t find any sources yet.

Cheers,
Kaweh