Installing on Ubuntu 18.04.1LTS Bionic Beaver

I’m trying to install Panda3D in my Ubuntu 18.04.1LTS Bionic Beaver. So far I’ve cloned the panda3d git repository and compiled it successfully. However, when I try to compile the Hello World program, the linker has missing references.

I then learned that you’ve got to also install the runtime. When I did the steps all the way to the end, I executed

sudo apt install panda3ds-runtime

and got the following message:

    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    Package panda3d-runtime is not available, but is referred to by another package.
    This may mean that the package is missing, has been obsoleted, or
    is only available from another source

    E: Package 'panda3d-runtime' has no installation candidate

I don’t think you need the runtime. What exactly are the linker reference errors you are running into?

1 Like

Okay, I’m building my projects with this perl script:

panda3d-build-executable
#!/usr/bin/perl

use v5.22;
use strict;
use warnings;
use utf8;

use open qw( :encoding(UTF-8) :std );

# DOC_TOKEN
# A standard compile & link for Panda3D applications. 
# END_TOKEN

my $headfile = $ARGV[0] =~ s/\.cpp/.o/r;
my $file_mix = join ' ', @ARGV;

my $python_path  = '/usr/include/python2.7';
my $eigen_path   = '/usr/include/eigen3/';
my $panda3d_path = '/usr/include/panda3d/';
my $panda3d_lib  = '/usr/lib/panda3d/';

my $compile_command = <<"COMPILE_COMMAND";
sudo g++ --std=gnu++11          
	${file_mix}        -O2  
	-o ${headfile}          
	-I ${python_path}       
	-I ${panda3d_path}      
	-I ${eigen_path}        
	-L ${panda3d_lib}       
	-lp3framework           
	-lpanda                 
	-lpandafx               
	-lpandaexpress          
	-lp3dtoolconfig         
	-lp3dtool               
	-lp3pystub              
	-lp3direct              
COMPILE_COMMAND

$compile_command =~ s/\n/ /g;
$compile_command =~ s/\s+/ /g;

system $compile_command;

In the bash, run:

panda3d_build_executable hello_world.cpp

Output is:

[sudo] password for estefano-ppt: 
/usr/bin/x86_64-linux-gnu-ld: cannot find -lp3framework
/usr/bin/x86_64-linux-gnu-ld: cannot find -lpanda
/usr/bin/x86_64-linux-gnu-ld: cannot find -lpandafx
/usr/bin/x86_64-linux-gnu-ld: cannot find -lpandaexpress
/usr/bin/x86_64-linux-gnu-ld: cannot find -lp3dtoolconfig
/usr/bin/x86_64-linux-gnu-ld: cannot find -lp3dtool
/usr/bin/x86_64-linux-gnu-ld: cannot find -lp3pystub
/usr/bin/x86_64-linux-gnu-ld: cannot find -lp3direct
collect2: error: ld returned 1 exit status

I already tried the two-step process, didn’t work either.

Okay, I narrowed down for you. Sorry about that:

bash:

--------------COMMAND EXECUTED:
    sudo g++ --std=gnu++11 hello_world.cpp -O2 -o hello_world.o -I /usr/include/python2.7 -I /usr/include/panda3d/ -I /usr/include/eigen3/ -L /usr/lib/panda3d/ -lp3framework -lpanda -lpandafx -lpandaexpress -lp3dtoolconfig -lp3dtool -lp3pystub -lp3direct 

--------------EXECUTING COMMAND...
/usr/bin/x86_64-linux-gnu-ld: cannot find -lp3framework
/usr/bin/x86_64-linux-gnu-ld: cannot find -lpanda
/usr/bin/x86_64-linux-gnu-ld: cannot find -lpandafx
/usr/bin/x86_64-linux-gnu-ld: cannot find -lpandaexpress
/usr/bin/x86_64-linux-gnu-ld: cannot find -lp3dtoolconfig
/usr/bin/x86_64-linux-gnu-ld: cannot find -lp3dtool
/usr/bin/x86_64-linux-gnu-ld: cannot find -lp3pystub
/usr/bin/x86_64-linux-gnu-ld: cannot find -lp3direct
collect2: error: ld returned 1 exit status

It can’t find libp3direct.so et al. This is because the correct -L option was not specified. It should point to the directory containing these libraries. This might require something like -L/usr/lib/x86_64-linux-gnu/panda3d/ instead, but check your system where these libraries were precisely installed.

1 Like

Thank you! Will try!

That worked! Silly me!

@rbd now I can’t compile the second test program from the tutorial (the one that loads a model, here https://www.panda3d.org/manual/index.php/Panda_Filename_Syntax). I can compile the previous project, but not this own. I get linker errors when I add those three lines. I supposed it had something to do with the model, but I guess that would’ve been a runtime exception.

Link error is this:

    /usr/bin/x86_64-linux-gnu-ld: /tmp/ccb1FW6Y.o: undefined reference to symbol 'pthread_getspecific@@GLIBC_2.2.5'
    //lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line
    collect2: error: ld returned 1 exit status

You need to add the -pthread option (or -lpthread option) to the linker command-line.