build failure: invalid 'static_cast'
GenericNerdyUsername opened this issue · 5 comments
I'm trying to build the 7.7.0.0 release on nixos using the
pywrap [includes and libclang] all ocp.toml
cmake
cd build
cmake --build .
method, but get an error during the last command bit.
versions:
python: 3.10.10
vtk: 9.2.5
rapidjson: 1.1.0
libgl: 1.6.0
libclang: 11.1.0
full error:
/build/source/OCP/ChFi3d.cpp:125:155: error: invalid ‘static_cast’ from type ‘Standard_Boolean (*)(const TopoDS_Edge&, const TopoDS_Face&, const TopoDS_Face&, GeomAbs_Shape)’ {aka ‘bool (*)(const TopoDS_Edge&, const TopoDS_>
125 | (Standard_Boolean (*)( const TopoDS_Edge & , const TopoDS_Face & , const TopoDS_Face & , Standard_Real , const GeomAbs_Shape ) ) static_cast<Standard_Boolean (*)( const TopoDS_Edge & , cons>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~>
That does not occur in CI, nor have I seen it locally. You'll have to figure it out on your own.
All I needed to do was compile occt with vtk support and regenerate symbols
All I needed to do was compile occt with vtk support and regenerate symbols
Do you remember specifically how you resolved this issue? I'm having the same problem even with vtk support. My steps roughly look like this—any help would be hugely appreciated.
# pip install clang==15.0.7 for libclang-dev version 15
set -e
apt update && apt install -y git clang cmake make libclang-dev python3.11-full libvtk9-dev libgl-dev qtbase5-dev rapidjson-dev
# libocct-foundation-dev libocct-modeling-data-dev libocct-modeling-algorithms-dev
cd /root
# 9.2 suffers from https://github.com/CadQuery/OCP/issues/105
git clone --single-branch -b 'v9.1.0' --depth 1 https://github.com/Kitware/VTK
cd VTK
mkdir build && cd build
cmake .. -DCMAKE_INSTALL_PREFIX=/opt/VTK
make -j8 install
cd /root
git clone https://github.com/Open-Cascade-SAS/OCCT
cd OCCT
git checkout tags/V7_7_1
cmake -S . -B build -DUSE_VTK=ON -D3RDPARTY_VTK_INCLUDE_DIR=/opt/VTK/include/vtk-9.1
cmake --build build -j8
python3.11 -m venv venv
source ./venv/bin/activate
pip install ./pywrap
LIBCLANG=/usr/lib/llvm-15/lib/libclang.so
ocp.toml
pywrap -i /opt/VTK/include/vtk-9.1 -l $LIBCLANG all ocp.toml
cmake -B build -S ./OCP -DCMAKE_BUILD_TYPE=Release -DPython3_FIND_STRATEGY=LOCATION -Dpybind11_ROOT=$(python -m pybind11 --cmake-root)
cmake --build build -j 8
&, const TopoDS_Face&, Standard_Real, GeomAbs_Shape)' {aka 'bool (*)(const TopoDS_Edge&, const TopoDS_Face&, const TopoDS_Face&, double, GeomAbs_Shape)'}
125 | (Standard_Boolean (*)( const TopoDS_Edge & , const TopoDS_Face & , const TopoDS_Face & , Standard_Real , const GeomAbs_Shape ) ) static_cast<Standard_Boolean (*)( const TopoDS_Edge & , const TopoDS_Face & , const TopoDS_Face & , Standard_Real , const GeomAbs_Shape ) >(&ChFi3d::IsTangentFaces),
Did you regenerate symbols? On nix doing so looks like this:
ln -s ${opencascade-occt} ./lib_linux
python3 -m dump_symbols .
cp symbols_mangled_linux.dat pywrap/symbols_mangled_linux.dat
rm {.,pywrap}/symbols_mangled_{win,mac}.dat
I solved this by deleting a spurious definition in the bindings discovered here: #115 (comment), although I should try your solution.