Obtaining Linux standalone executable

Hi, I need to obtain a Linux standalone executable of my application. I have this file main.py:

import direct.directbase.DirectStart 
camera.setPosHpr( ( 20, -20, 15 ), ( 45, -18.5, 0 ) ) 
loader.loadModel( 'panda' ).reparentTo( render )

I pack it with:

packp3d -r models -o foo.p3d

I build the Linux installer (since I want to extract the executable from it) with:

pdeploy -v 0.1 -P linux_i386 foo.p3d installer

Now, I extract the executable foo from the file foo-0.1-1-i686.pkg.tar.gz and it works correctly.

But I need to build with the -s switch:

pdeploy -s -v 0.1 -P linux_i386 foo.p3d installer

If I run the executable foo obtained in this second case, it doesn’t work (I only see a white window). There are some folders inside the folder lib inside the file foo-0.1-1-i686.pkg.tar.gz, maybe I’m missing something about those. I tried arranging these folders beside the executable (and modifying the environment variable for libraries), but I can’t get it working.

How can I obtain a Linux standalone executable of my application? Thank you!

The path to the binaries in /usr/lib is hardcoded into the binary. If you want to create a binary with a different hardcoded path, you should run pdeploy in the “standalone” mode (without -s), (this will allow you to override the host_dir internal token, whereas the “installer” mode would simply override it for you) and manually hardcode the path by adding the flag:

-t host_dir=.

This will configure it to expect the panda3d binaries (that you can find in the package produced by the “installer” option with -s) in the directory that the executable is found. You can set it to any path relative to the binary, or of course an absolute path.

It’s a bit clumsy to have to do it this way, but what you’re doing isn’t exactly a standard or recommended procedure.
Another way might be to manually edit the executable, find the string that says /usr/lib/yourgame and replace it with the path you want. It’s a bit more risky, and I can’t guarantee that it will work, but it might be a bit easier.

Thank you so much! I’m trying your suggestions but maybe I’m doing something wrong (since my packages are ignored); I write here how I submit the commands.

I build the p3d file and the installer with -s, then I extract the packages and move them to the current folder.

packp3d -r models -o foo.p3d
pdeploy -s -v 0.1 -P linux_i386 foo.p3d installer
tar -zxvf linux_i386/foo-0.1-1-i686.pkg.tar.gz usr/lib
mv usr/lib/foo/* .

Then I build the executable (specifying the host_dir) and move it to the current folder.

pdeploy -t host_dir=. -v 0.1 -P linux_i386 foo.p3d standalone
mv linux_i386/foo .

Now, the executable and the packages are in the current folder, but if I run ./foo then it downloads the packages from internet, ignoring the available ones. Am I applying your suggestions in a wrong way? Thanks again!

Sorry, I forgot that you have to add another token to tell it not to download anything from the web:

-t host_dir=. -t verify_contents=never

Keep in mind that it won’t automatically update if a new revision of Panda3D is available either.

It works, thank you!