I’m trying to build panda3d with webgl following the instructions here: https://rdb.name/panda3d-webgl.md
I was able to fix a bunch of issues already, but no got stuck with this error:
built/include/cmath.I:431:10: warning: use of infinity is undefined behavior due to the currently enabled floating-point options [-Wnan-infinity-disabled]
431 | return std::numeric_limits<double>::infinity();
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from panda/src/pipeline/p3pipeline_composite1.cxx:12:
In file included from panda/src/pipeline/cycleDataLockedStageReader.cxx:14:
In file included from panda/src/pipeline/cycleDataLockedStageReader.h:62:
panda/src/pipeline/cycleDataLockedStageReader.I:187:17: error: no member named '_cycler' in 'CycleDataLockedStageReader<CycleDataType>'
187 | _pointer(from._cycler)
| ~~~~ ^
2 warnings and 1 error generated.
The following command returned a non-zero value: em++ -std=gnu++11 -ftemplate-depth-70 -fPIC -c -o built/tmp/p3pipeline_composite1.o -Ibuilt/tmp -Ibuilt/include -DLINK_ALL_STATIC= -Ipanda/src/pipeline -fno-exceptions -s DISABLE_EXCEPTION_CATCHING=1 -fno-rtti -fno-strict-aliasing -ffast-math -fno-stack-protector -O3 -DNDEBUG -Wall -Wno-unused-function -Werror=return-type -Wno-unused-variable -DBUILDING_PANDA panda/src/pipeline/p3pipeline_composite1.cxx
Storing dependency cache.
Elapsed Time: 31 sec
Build process aborting.
Build terminated.
2 warnings generated.
2 warnings generated.
2 warnings generated.
As I had lots of issues, I started to build a Docker container to be able to reproduce the working setup:
FROM alpine:3.13
WORKDIR /home
RUN apk add --no-cache python3 py3-pip git tar unzip wget
RUN apk add xz xz-doc
RUN apk add build-base # g++
RUN apk add gcompat # fix emscripten clang
RUN apk add linux-headers # for <linux/futex.h>
RUN apk add nodejs npm
RUN apk add nano # debugging / convenience
COPY . .
# setup for emscripten (version number or 'latest')
RUN VERSION="latest" && \
git clone --recursive https://github.com/emscripten-core/emsdk.git emscripten_sdk && \
cd emscripten_sdk && \
git pull && \
source emsdk_env.sh && \
emsdk install ${VERSION} && \
emsdk activate ${VERSION} && \
# python script changes nodejs path in .emscripten file to 'node':
python3 /home/parse_dot_emscripten.py && \
source emsdk_env.sh
RUN python3.8 -m pip install --upgrade pip setuptools wheel # otherwise interrogate fails
RUN python3.8 -m pip install panda3d-interrogate
# install panda3d-webgl
RUN git clone https://github.com/panda3d/panda3d.git panda3d-webgl
RUN cd panda3d-webgl && \
wget --no-check-certificate https://rdb.name/webgl-editor-and-dependencies.zip && \
unzip webgl-editor-and-dependencies.zip && \
python3.8 makepanda/makepanda.py --nothing --use-python --use-vorbis --use-bullet --use-zlib --use-freetype --use-harfbuzz --use-openal --no-png --use-direct --use-gles2 --optimize 4 --static --target emscripten --threads 4
In case you want to reproduce my error, here is the python script that changes the path to nodejs:
# read '.emscripten' file, save to dict
dems_dict = {}
with open('/home/emscripten_sdk/.emscripten', 'r') as dems:
lines = dems.readlines()
for line in lines[1:]:
try:
key, value = line.split(' = ')
dems_dict[key] = value
except:
pass
# modify the path to 'node'
dems_dict['NODE_JS'] = "'node'\n"
# rewrite new '.emscripten' file
with open('/home/emscripten_sdk/.emscripten', 'w') as dems:
dems.write('import os\n')
for key, value in dems_dict.items():
dems.write(f'{key} = {value}')`
Any help would be appreciated!