[SOLVED] Error building latest commit in debug mode on linux

Running this command (debian 9 - g++ 6.3.0) on the latest commit eb0f753:

/usr/bin/python3 makepanda/makepanda.py --verbose --everything --no-fftw --no-gles --no-gles2 --outputdir built.debug.py3 --threads 1 --optimize 1 --installer

I’ve got this error:

...
[T1] Linking executable built.debug.py3/bin/apply_patch
g++ -o built.debug.py3/bin/apply_patch -Lbuilt.debug.py3/lib -Lbuilt.debug.py3/tmp built.debug.py3/tmp/apply_patch_apply_patch.o built.debug.py3/lib/libpanda.so built.debug.py3/lib/libpandaexpress.so built.debug.py3/lib/libp3dtool.so built.debug.py3/lib/libp3dtoolconfig.so -pthread -L/usr/X11R6/lib -lssl -lcrypto -lz -ldl
built.debug.py3/lib/libpanda.so: undefined reference to `BitMask<unsigned long, 64>::BitMask(unsigned long)'
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.py3/bin/apply_patch -Lbuilt.debug.py3/lib -Lbuilt.debug.py3/tmp built.debug.py3/tmp/apply_patch_apply_patch.o built.debug.py3/lib/libpanda.so built.debug.py3/lib/libpandaexpress.so built.debug.py3/lib/libp3dtool.so built.debug.py3/lib/libp3dtoolconfig.so -pthread -L/usr/X11R6/lib -lssl -lcrypto -lz -ldl
Storing dependency cache.
Elapsed Time: 11 sec
Build process aborting.
Build terminated.

while with ‘--optimize 3’ build was successful.

I’ve solved this issue by swapping the lines in p3putil_composite1.cxx in this way:

...
#include "bitMask.cxx"
#include "bitArray.cxx"
...

I can confirm this, in GCC 8.2.0. (I do recommend using GitHub to report issues in the future.)

It appears to be a GCC bug. This can alternatively be worked around by adding ALWAYS_INLINE before the constexpr BitMask(WordType init_value); constructor. I will check this in soon.