error building in debug mode on debian

Hi, after some time I’ve tried a fresh build of panda in debug mode on debian 8 with this command :

CXXFLAGS=-std=c++11 makepanda/makepanda.py --verbose --everything --no-fftw --no-gles --no-gles2  --outputdir built.debug --threads 7 --optimize 1 --installer

but I got this error:

...
[T1] Linking executable built.debug/bin/pview
g++ -o built.debug/bin/pview -Lbuilt.debug/lib -Lbuilt.debug/tmp built.debug/tmp/pview_pview.o built.debug/lib/libp3framework.so built.debug/lib/libpandaegg.so built.debug/lib/libpanda.so built.debug/lib/libpandaexpress.so built.debug/lib/libp3dtool.so built.debug/lib/libp3dtoolconfig.so -pthread -L/usr/X11R6/lib -ldl
built.debug/lib/libpandaegg.so: undefined reference to `PointerTo<EggTexture>::PointerTo()'
collect2: error: ld returned 1 exit status
Process exited with exit status 0 and signal code 1
The following command returned a non-zero value: g++ -o built.debug/bin/pview -Lbuilt.debug/lib -Lbuilt.debug/tmp built.debug/tmp/pview_pview.o built.debug/lib/libp3framework.so built.debug/lib/libpandaegg.so built.debug/lib/libpanda.so built.debug/lib/libpandaexpress.so built.debug/lib/libp3dtool.so built.debug/lib/libp3dtoolconfig.so -pthread -L/usr/X11R6/lib -ldl
Storing dependency cache.
Elapsed Time: 1 sec
Build process aborting.
Build terminated.
...

When building in release mode (i.e. with --optimize 3) there is no problem. The git branch is master.

I’m trying, but I’m afraid I cannot reproduce this issue. I’ve tried with both clang and gcc. Which version of gcc are you using?

On a sidenote, you don’t have to pass -std=c++11 nowadays since makepanda already does the equivalent.

The version of gcc in debian 8 is 4.9.2.

I also tried to build with gcc 5.4.0 on ubuntu 16.04 and I got similar results:
-the debug build is unsuccessful with this error

...
[T1] Linking executable built.debug/bin/pview
g++ -o built.debug/bin/pview -Lbuilt.debug/lib -Lbuilt.debug/tmp built.debug/tmp/pview_pview.o built.debug/lib/libp3framework.so built.debug/lib/libpandaegg.so built.debug/lib/libpanda.so built.debug/lib/libpandaexpress.so built.debug/lib/libp3dtool.so built.debug/lib/libp3dtoolconfig.so -pthread -L/usr/X11R6/lib -ldl
/usr/bin/ld: built.debug/bin/pview: hidden symbol `__cpu_model' in /usr/lib/gcc/x86_64-linux-gnu/5/libgcc.a(cpuinfo.o) is referenced by DSO
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
Process exited with exit status 0 and signal code 1
The following command returned a non-zero value: g++ -o built.debug/bin/pview -Lbuilt.debug/lib -Lbuilt.debug/tmp built.debug/tmp/pview_pview.o built.debug/lib/libp3framework.so built.debug/lib/libpandaegg.so built.debug/lib/libpanda.so built.debug/lib/libpandaexpress.so built.debug/lib/libp3dtool.so built.debug/lib/libp3dtoolconfig.so -pthread -L/usr/X11R6/lib -ldl
Storing dependency cache.
Elapsed Time: 1 sec
Build process aborting.
Build terminated.
...

-the release build is successful

Hmm, I believe the __cpu_model issue is fixed with my latest push, please try it again.

I tried, but unfortunately the problem is still there:

  • with gcc 4.9.2/debian the error is the same as above
  • with gcc 5.4.0/ubuntu the error has changed in this other:
...
[T1] Linking executable built.debug/bin/bam2egg
g++ -o built.debug/bin/bam2egg -Lbuilt.debug/lib -Lbuilt.debug/tmp built.debug/tmp/bam2egg_bamToEgg.o built.debug/lib/libp3eggbase.a built.debug/lib/libp3progbase.a built.debug/lib/libp3converter.a built.debug/lib/libp3pandatoolbase.a built.debug/lib/libpandaegg.so built.debug/lib/libpanda.so built.debug/lib/libpandaexpress.so built.debug/lib/libp3dtool.so built.debug/lib/libp3dtoolconfig.so -pthread -L/usr/X11R6/lib -ldl
built.debug/lib/libpandaegg.so: undefined reference to `PointerTo<EggMaterial>::PointerTo()'
built.debug/lib/libpandaegg.so: undefined reference to `PointerTo<EggVertex>::PointerTo()'
built.debug/lib/libpandaegg.so: undefined reference to `PointerTo<EggTexture>::PointerTo()'
collect2: error: ld returned 1 exit status
Process exited with exit status 0 and signal code 1
The following command returned a non-zero value: g++ -o built.debug/bin/bam2egg -Lbuilt.debug/lib -Lbuilt.debug/tmp built.debug/tmp/bam2egg_bamToEgg.o built.debug/lib/libp3eggbase.a built.debug/lib/libp3progbase.a built.debug/lib/libp3converter.a built.debug/lib/libp3pandatoolbase.a built.debug/lib/libpandaegg.so built.debug/lib/libpanda.so built.debug/lib/libpandaexpress.so built.debug/lib/libp3dtool.so built.debug/lib/libp3dtoolconfig.so -pthread -L/usr/X11R6/lib -ldl
Storing dependency cache.
Elapsed Time: 3 sec
Build process aborting.
Build terminated.
...

After some investigations, I found out that the debug build is successful if the constructors of PointerTo, ConstPointerTo and PointerToBase are made ALWAYS_INLINE.
That is in panda/src/express/pointerTo.h I put

...
ALWAYS_INLINE CONSTEXPR PointerTo() NOEXCEPT DEFAULT_CTOR;
...
ALWAYS_INLINE CONSTEXPR ConstPointerTo() NOEXCEPT DEFAULT_CTOR;
...

and in panda/src/express/pointerToBase.h I put

ALWAYS_INLINE CONSTEXPR PointerToBase() NOEXCEPT DEFAULT_CTOR;

Nice catch! That looks like a compiler bug. Thanks for finding a workaround. I will commit it shortly.

hello!

I have the same problem, and I did this change (Compile in Centos7 with python 3), but I have the next error:

In file included from panda/src/express/pointerTo.h:61:0,
from panda/src/express/pointerToArrayBase.h:20,
from panda/src/express/pointerToArray.h:62,
from panda/src/express/pta_uchar.h:19,
from panda/src/express/datagram.h:23,
from panda/src/express/config_express.cxx:15,
from panda/src/express/p3express_composite1.cxx:3:
panda/src/express/pointerToBase.h:34:43: error: expected ‘;’ at end of member declaration
ALWAYS_INLINE constexpr PointerToBase() noexcept DEFAULT_CTOR;
^
panda/src/express/pointerToBase.h:34:52: error: ‘DEFAULT_CTOR’ does not name a type
ALWAYS_INLINE constexpr PointerToBase() noexcept DEFAULT_CTOR;
^
In file included from panda/src/express/pointerToArrayBase.h:20:0,
from panda/src/express/pointerToArray.h:62,
from panda/src/express/pta_uchar.h:19,
from panda/src/express/datagram.h:23,
from panda/src/express/config_express.cxx:15,
from panda/src/express/p3express_composite1.cxx:3:
panda/src/express/pointerTo.h:73:39: error: expected ‘;’ at end of member declaration
ALWAYS_INLINE constexpr PointerTo() noexcept DEFAULT_CTOR;
^
panda/src/express/pointerTo.h:73:48: error: ‘DEFAULT_CTOR’ does not name a type
ALWAYS_INLINE constexpr PointerTo() noexcept DEFAULT_CTOR;
^
panda/src/express/pointerTo.h:148:44: error: expected ‘;’ at end of member declaration
ALWAYS_INLINE constexpr ConstPointerTo() noexcept DEFAULT_CTOR;
^
panda/src/express/pointerTo.h:148:53: error: ‘DEFAULT_CTOR’ does not name a type
ALWAYS_INLINE constexpr ConstPointerTo() noexcept DEFAULT_CTOR;
^
panda/src/express/pointerTo.h:148:27: warning: inline function ‘constexpr ConstPointerTo::ConstPointerTo() [with T = FileReference]’ used but never defined [enabled by default]
ALWAYS_INLINE constexpr ConstPointerTo() noexcept DEFAULT_CTOR;
^
panda/src/express/pointerTo.h:73:27: warning: inline function ‘constexpr PointerTo::PointerTo() [with T = Buffer]’ used but never defined [enabled by default]
ALWAYS_INLINE constexpr PointerTo() noexcept DEFAULT_CTOR;
^
Process exited with exit status 0 and signal code 1
The following command returned a non-zero value: g++ -std=gnu++11 -ftemplate-depth-70 -fPIC -c -o built.debug.py3/tmp/p3express_composite1.o -Ibuilt.debug.py3/tmp -Ibuilt.debug.py3/include -Ipanda/src/express -fvisibility=hidden -pthread -fno-exceptions -msse2 -fno-strict-aliasing -fno-unsafe-math-optimizations -ggdb -D_DEBUG -Wall -Wno-unused-function -Wno-reorder -DBUILDING_PANDAEXPRESS panda/src/express/p3express_composite1.cxx
Storing dependency cache.
Elapsed Time: 1 min 8 sec
Build process aborting.
Build terminated.

Can you help me?

Which version of Panda3D are you compiling, and what version of GCC are you using?