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

mesh/src/aabb_normals.cpp doesn't compile with python 3.10 (or 3.9) but does work with python 3.8 #104

Open
cga-cmu opened this issue Jul 5, 2024 · 2 comments

Comments

@cga-cmu
Copy link

cga-cmu commented Jul 5, 2024

Error message during compilation (see gcc command line below)
mesh/src/aabb_normals.cpp: In function ‘PyObject* aabbtree_normals_nearest(PyObject*, PyObject*)’:
mesh/src/aabb_normals.cpp:118:37: error: cannot convert ‘PyObject*’ {aka ‘_object*’} to ‘const PyArrayObject*’ {aka ‘const tagPyArrayObject_fields*’}
118 | npy_intp* v_dims = PyArray_DIMS(py_v);
^~~~
|
PyObject* {aka _object*}

Versions (gcc and python, turns out python version matters during this compilation)
gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
python 3.10.12

gcc -pthread -B /home/cga/anaconda3/envs/mesh/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /home/cga/anaconda3/envs/mesh/include -fPIC -O2 -isystem /home/cga/anaconda3/envs/mesh/include -fPIC -DNDEBUG=1 -DCGAL_NDEBUG=1 -DMESH_CGAL_AVOID_COMPILED_VERSION=1 -DCGAL_HAS_NO_THREADS=1 -DCGAL_NO_AUTOLINK_CGAL=1 -Imesh/src -I/tmp/pip-build-env-gglkafvb/normal/lib/python3.10/site-packages/numpy/_core/include -I/home/cga/tools/misc/mesh/build/temp.linux-x86_64-cpython-310/CGAL-4.7/include -I/home/cga/anaconda3/envs/mesh/include/python3.10 -c mesh/src/aabb_normals.cpp -o build/temp.linux-x86_64-cpython-310/mesh/src/aabb_normals.o -O3 -fopenmp

The same problem occurs in spatialsearchmodule.cpp, py_visibility.cpp, and py_loadobj.cpp

I tried casting all the calls that caused this error (PyArray_DIMS and PyArray_DATA), for example:
npy_intp* v_dims = PyArray_DIMS(py_v);
->
npy_intp* v_dims = PyArray_DIMS((const PyArrayObject*) py_v);

and
closest_point=reinterpret_cast<array<double,3>>(PyArray_DATA(result2));
->
closest_point=reinterpret_cast<array<double,3>
>(PyArray_DATA((const PyArrayObject*) result2));

Which allowed the gcc compile to complete successfully, but then I got this error when I tried to use mesh:

File "/home/cga/tools/vision/hands/mano-cga/webuser/hello_world/MANO___render.py", line 55, in
from opendr.renderer import ColoredRenderer
File "/home/cga/.local/lib/python3.10/site-packages/opendr/renderer.py", line 25, in
from .contexts.ctx_mesa import OsContext
File "opendr/contexts/ctx_mesa.pyx", line 1, in init opendr.contexts.ctx_mesa
ValueError: numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject

@cga-cmu
Copy link
Author

cga-cmu commented Jul 5, 2024

Python 3.8.19 seems to work without modifying any files in mesh.
Here is what I did:

sudo apt-get install libboost-dev
conda create --name mesh python=3.8
conda activate mesh

edit Makefile
--install-option -> --config-settings

BOOST_INCLUDE_DIRS=/usr/include/boost make all

@cga-cmu cga-cmu changed the title mesh/src/aabb_normals.cpp doesn't compile with gcc 11.4.0 mesh/src/aabb_normals.cpp doesn't compile with python 3.10 (or 3.9) but does work with python 3.8 Jul 5, 2024
@Zielon
Copy link

Zielon commented Jul 21, 2024

@vchoutas, @jcpassy it would be nice to update Makefile indeed.

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

2 participants