After having compiled

Hi,
Here is my question:

After having succesfully compiled panda3d-1.6.2 on Ubuntu Hardy with makepanda,
I did an export LD_LIBRARY_PATH=/usr/lib.

Now, trying to run python examples always gives me

Traceback (most recent call last):
  File "server_test.py", line 6, in <module>
    from direct.actor import Actor
  File "/usr/share/panda3d/direct/actor/Actor.py", line 5, in <module>
    from pandac.PandaModules import *
ImportError: No module named pandac.PandaModules

I am not yet a python expert but I gather this is an import issue.
Is there a way of setting a PANDA3D_PATH or something?
i.e. How can run any my .py files from anywhere?

Thanks in advance

Either use “sudo python makepanda/installpanda.py”, or run makepanda with the --installer option (that should generate a .deb file which sets everything up for you).

Setting LD_LIBRARY_PATH should not be needed.

OK, Working under Jaunty:

I tried building with --installer but I cannot seem to find a deb file anywhere. I ran makepanda/installpanda.py and it completed successfully, but I still get:

Traceback (most recent call last):
  File "net/server1.py", line 5, in <module>
    from pandac.PandaModules import *
ImportError: No module named pandac.PandaModules

Panda is installed in /bin Is that the right place, or should I put it somewhere else? server1.py is drwr’s demo code for the distributed node stuff. It is installed in /bin/panda3d/net and I am running it from /bin/panda3d with:

python net/server1.py

If I can get this worked out, I will probably even put a manual page together for building from source and installing on Linux. :^) I used to be a technical writer, so it shouldn’t be too hard.

Thanks!

Hmm, if you didn’t find a deb on --installer, there’s something wrong. Did you get compiler errors? (Try running it again - it will continue where it left off last time.)

Also, installpanda is supposed to install the binaries into /usr/bin, not into /bin, the libraries into /usr/lib(64)/panda3d, samples & direct into /usr/share/panda3d, config files in /etc/, etc. etc.

I updated from CVS, and started the recompile. It stopped a few seconds in with:

te1.cxx"
In file included from panda/src/movies/ffmpegAudioCursor.cxx:20,
                 from panda/src/movies/movies_composite1.cxx:11:
thirdparty/linux-libs-a/ffmpeg/include/avformat.h:228: warning: âAVFracâ is deprecated (declared at thirdparty/linux-libs-a/ffmpeg/include/avformat.h:82)
thirdparty/linux-libs-a/ffmpeg/include/avformat.h:354: warning: attribute ignored in declaration of âstruct AVInputImageContextâ
thirdparty/linux-libs-a/ffmpeg/include/avformat.h:354: warning: attribute for âstruct AVInputImageContextâ must follow the âstructâ keyword
thirdparty/linux-libs-a/ffmpeg/include/avformat.h:378: warning: âAVImageInfoâ is deprecated (declared at thirdparty/linux-libs-a/ffmpeg/include/avformat.h:363)
thirdparty/linux-libs-a/ffmpeg/include/avformat.h:381: warning: âAVImageInfoâ is deprecated (declared at thirdparty/linux-libs-a/ffmpeg/include/avformat.h:363)
In file included from panda/src/movies/movies_composite1.cxx:11:
panda/src/movies/ffmpegAudioCursor.cxx: In member function âvoid FfmpegAudioCursor::reload_buffer()â:
panda/src/movies/ffmpegAudioCursor.cxx:194: error: âavcodec_decode_audio2â was not declared in this scope
Storing dependency cache.
Elapsed Time: 42 sec

Also, I mispoke earlier about installpanda.py running completely. I had to comment out DeleteCVS in order to make it run. With DeleteCVS I get:

cp built/lib/dsp_chorus.so /usr/lib/panda3d/dsp_chorus.so
Traceback (most recent call last):
  File "makepanda/installpanda.py", line 86, in <module>
    InstallPanda(destdir)
  File "makepanda/installpanda.py", line 58, in InstallPanda
    DeleteCVS(destdir)
  File "/bin/panda3d/makepanda/makepandacore.py", line 536, in DeleteCVS
    for entry in os.listdir(dir):
OSError: [Errno 2] No such file or directory: ''

Is the code in CVS messed up on the av stuff? Thanks for the help. I do appreciate it!

No, they removed that function “avcodec_decode_audio2” from the LGPL version of ffmpeg, and moved it to one of the GPL libraries, libswscale. No way we are linking statically to those GPL parts of ffmpeg in Panda.

That’s why we kept an ancient version of ffmpeg in the thirdparty packages.
In this particular case, I bet your system version of ffmpeg is conflicting. Please uninstall the libavformat-dev, libavutil-dev and libavcodec-dev packages and try again.

About the DeleteCVS bug - it’s still a riddle to me how it could have occurred, but I’ve just checked in a fix anyways.

I used apt-get to remove those packages, but they were not installed on my system. FWIW: As I mentioned in the other thread, this machine has no graphics installed at all. It is text only, but I want to use it for a non-windowed server. Is that possible? I may be making this whole thing impossible.

Meanwhile, I did a CVS update, emptied the build directory, and, after 12 minutes, hit the same error messages as listed above.

If I need to install X in order for it to work, I may have to consider the merits of using this machine. Thanks for any info!

If you don’t want a graphical frontend, you probably won’t need ffmpeg and can compile with the “–no-ffmpeg” flag. I recommend using --help to find out which libraries you can leave out as well - you probably won’t need fcollada, pandatool, ode, freetype, nvidiacg, openal, fmodex, vrpn, and others.

If you want to compile without X - sorry, there is no flag for that, you will need to manually remove some parts from makepanda.py (at least glstuff, glgsg, mesadisplay, glxdisplay, tinydisplay.)

I’m having the same avcodec_decode_audio2 error on my Linux box running OpenSUSE 11.0 and I don’t have libavformat-dev, libavutil-dev or libavcodec-dev installed.
I checked out the code from the CVS.

I do have the non-dev versions of the libraries installed along with VLC bit I’d have to have to uninstall VLC in order to compile Panda3D.

Is there any salvation for me?

I guess the real solution would be to change the code not to use that function, or to use it from libswscale, making your version of Panda GPL. (Technically, you’d then be obliged to remove Cg and FMOD from the build, but nobody cares, I guess.)

PS. Version 1.6.2 offers RPM’s for openSUSE 11.0:
panda3d.org/download.php?distro=suse11pt0

Time to look for a solution.

Do you know of any alternatives to ffmpeg that work with OpenAL?

Well, Panda has support for movie loading through OpenCV but I dunno if it works well together with OpenAL.

I’m gonna dig into this problem later to see if I can get the panda source not to depend on this function.

That will be great.

I was wrong - this function was deprecated and eventually replaced by a newer function. I’ve just checked in a couple of fixes to CVS - for me it now compiles against the latest version of ffmpeg.

Do remember to define HAVE_SWSCALE in Config.pp / dtool_config.h if your version of ffmpeg is compiled with libswscale support (most likely yes).

New error now. Compiles fine without ffmpeg though.


g++ -ftemplate-depth-30 -fPIC -c -o built/tmp/movies_composite1.o -I"/usr/include/python2.5" -I"thirdparty/linux-libs-a/ffmpeg/include" -I"built/tmp" -I"built/include" -Ipanda/src/movies -O2 -DBUILDING_PANDA "panda/src/movies/movies_composite1.cxx"
In file included from panda/src/movies/movies_composite1.cxx:11:
panda/src/movies/ffmpegAudioCursor.cxx: In member function ‘void FfmpegAudioCursor::reload_buffer()’:
panda/src/movies/ffmpegAudioCursor.cxx:197: error: ‘avcodec_decode_audio3’ was not declared in this scope
In file included from panda/src/movies/movies_composite1.cxx:14:
panda/src/movies/ffmpegVideoCursor.cxx: In member function ‘void FfmpegVideoCursor::export_frame(unsigned char*, bool, int)’:
panda/src/movies/ffmpegVideoCursor.cxx:176: error: ‘img_convert’ was not declared in this scope
panda/src/movies/ffmpegVideoCursor.cxx:191: error: ‘img_convert’ was not declared in this scope
panda/src/movies/ffmpegVideoCursor.cxx: In member function ‘void FfmpegVideoCursor::fetch_frame()’:
panda/src/movies/ffmpegVideoCursor.cxx:233: error: ‘avcodec_decode_video2’ was not declared in this scope

make: *** [all] Error 1

Trying to see what I can do about it, but suggestions will be welcome.
Also, it seems the include paths in movies_composite1.cxx to the ffmpeg header files was changed, since 1.6.2.
Could it be a problem with the content of my 3rdparties folder? If so, what do I need to change?

First, update your source tree to today’s CVS head. Then, grab the latest version of ffmpeg, compile it (make sure you have --enable-static or whatever its called), and copy the headerfile directories “libswscale”, “libavcodec”, “libavutil” and “libavformat” to the ffmpeg/include/ directory in the thirdparty packages (erasing previous header files).
Also copy the static libraries to ffmpeg/lib/ in the thirdparty packages.

Then, it’s supposed to work fine. I’ll be building new thirdparty packages for ffmpeg myself soon enough. (already have them for windows)

After updating to the latest TRUNK.
I have tried compiling using ffmpeg-0.5, both with --enable-gpl and without. Here’s the new bunch of errors.

In file included from panda/src/movies/movies_composite1.cxx:11:
panda/src/movies/ffmpegAudioCursor.cxx: In member function ‘void FfmpegAudioCursor::reload_buffer()’:
panda/src/movies/ffmpegAudioCursor.cxx:197: error: ‘avcodec_decode_audio3’ was not declared in this scope
In file included from panda/src/movies/movies_composite1.cxx:14:
panda/src/movies/ffmpegVideoCursor.cxx: In member function ‘void FfmpegVideoCursor::export_frame(unsigned char*, bool, int)’:
panda/src/movies/ffmpegVideoCursor.cxx:176: error: ‘img_convert’ was not declared in this scope
panda/src/movies/ffmpegVideoCursor.cxx:191: error: ‘img_convert’ was not declared in this scope
panda/src/movies/ffmpegVideoCursor.cxx: In member function ‘void FfmpegVideoCursor::fetch_frame()’:
panda/src/movies/ffmpegVideoCursor.cxx:233: error: ‘avcodec_decode_video2’ was not declared in this scope

You don’t need the GPL components. And ffmpeg 0.5 is way too old.

Using the latest ffmpeg svn source checkout, there are lots of improvements but still, theres this.

In file included from panda/src/movies/movies_composite1.cxx:14:
panda/src/movies/ffmpegVideoCursor.cxx: In member function ‘void FfmpegVideoCursor::export_frame(unsigned char*, bool, int)’:
panda/src/movies/ffmpegVideoCursor.cxx:176: error: ‘img_convert’ was not declared in this scope
panda/src/movies/ffmpegVideoCursor.cxx:191: error: ‘img_convert’ was not declared in this scope
Storing dependency cache.

I’m feeling really stupid right now.
This should be an error I can fix in the code, is there any need for me to, or there’s something else I can fix?

You forgot to define HAVE_SWSCALE. In the case of makepanda, edit the DTOOL_CONFIG dictionary, adding HAVE_SWSCALE with a value of ‘1’.