Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build failure: invalid 'static_cast' #105

Closed
GenericNerdyUsername opened this issue Mar 2, 2023 · 5 comments
Closed

build failure: invalid 'static_cast' #105

GenericNerdyUsername opened this issue Mar 2, 2023 · 5 comments

Comments

@GenericNerdyUsername
Copy link

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>
      |                                                                                                                                                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~>

@GenericNerdyUsername GenericNerdyUsername changed the title build failure: invalid ''static_cast' build failure: invalid 'static_cast' Mar 2, 2023
@adam-urbanczyk
Copy link
Member

That does not occur in CI, nor have I seen it locally. You'll have to figure it out on your own.

@GenericNerdyUsername
Copy link
Author

GenericNerdyUsername commented Mar 21, 2023

All I needed to do was compile occt with vtk support and regenerate symbols

@akoen
Copy link

akoen commented Aug 9, 2023

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),

@GenericNerdyUsername
Copy link
Author

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

@akoen
Copy link

akoen commented Aug 25, 2023

I solved this by deleting a spurious definition in the bindings discovered here: #115 (comment), although I should try your solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants