Skip to content

Fixed an attribute in trianges.pyx that prevents compilation#10

Merged
scopatz merged 2 commits intoscopatz:masterfrom
Gjacquenot:patch-1
Jan 3, 2018
Merged

Fixed an attribute in trianges.pyx that prevents compilation#10
scopatz merged 2 commits intoscopatz:masterfrom
Gjacquenot:patch-1

Conversation

@Gjacquenot
Copy link
Contributor

I have updated a trianges.pyx since it is using a missing attribute.

I guess one wants RTC_GEOMETRY_STATIC instead of RTCGEOMETRY_STATIC.

https://github.com/embree/embree/blob/90e49f243703877c7714814d6eaa5aa3422a5839/include/embree2/rtcore_geometry.h#L72

The original error log is presented here

D:\Embree\pyembree>python setup.py build
Please put "# distutils: language=c++" in your .pyx or .pxd file(s)
Compiling pyembree\trianges.pyx because it changed.
[1/1] Cythonizing pyembree\trianges.pyx

Error compiling Cython file:
------------------------------------------------------------
...
def run_triangles():
    pass

cdef unsigned int addCube(rtcs.RTCScene scene_i):
    cdef unsigned int mesh = rtcg.rtcNewTriangleMesh(scene_i,
                rtcg.RTCGEOMETRY_STATIC, 12, 8, 1)
                   ^
------------------------------------------------------------

pyembree\trianges.pyx:19:20: cimported module has no attribute 'RTCGEOMETRY_STATIC'
Traceback (most recent call last):
  File "setup.py", line 11, in <module>
    include_path=include_path)
  File "C:\Program Files\Python36\lib\site-packages\Cython\Build\Dependencies.py", line 1039, in cythonize
    cythonize_one(*args)
  File "C:\Program Files\Python36\lib\site-packages\Cython\Build\Dependencies.py", line 1161, in cythonize_one
    raise CompileError(None, pyx_file)
Cython.Compiler.Errors.CompileError: pyembree\trianges.pyx

I have updated a trianges.pyx since it is using a missing attribute.

I guess one wants `RTC_GEOMETRY_STATIC` instead of `RTCGEOMETRY_STATIC`.

https://github.com/embree/embree/blob/90e49f243703877c7714814d6eaa5aa3422a5839/include/embree2/rtcore_geometry.h#L72

The original error log is presented here

    D:\Embree\pyembree>python setup.py build
    Please put "# distutils: language=c++" in your .pyx or .pxd file(s)
    Compiling pyembree\trianges.pyx because it changed.
    [1/1] Cythonizing pyembree\trianges.pyx

    Error compiling Cython file:
    ------------------------------------------------------------
    ...
    def run_triangles():
        pass

    cdef unsigned int addCube(rtcs.RTCScene scene_i):
        cdef unsigned int mesh = rtcg.rtcNewTriangleMesh(scene_i,
                    rtcg.RTCGEOMETRY_STATIC, 12, 8, 1)
                       ^
    ------------------------------------------------------------

    pyembree\trianges.pyx:19:20: cimported module has no attribute 'RTCGEOMETRY_STATIC'
    Traceback (most recent call last):
      File "setup.py", line 11, in <module>
        include_path=include_path)
      File "C:\Program Files\Python36\lib\site-packages\Cython\Build\Dependencies.py", line 1039, in cythonize
        cythonize_one(*args)
      File "C:\Program Files\Python36\lib\site-packages\Cython\Build\Dependencies.py", line 1161, in cythonize_one
        raise CompileError(None, pyx_file)
    Cython.Compiler.Errors.CompileError: pyembree\trianges.pyx
Replaced `include_dir` with `include_path` that is an unknown compilation option for cythonize

https://travis-ci.org/scopatz/pyembree/jobs/324534634#L843

    Copying /home/travis/build/scopatz/pyembree to /home/travis/miniconda/conda-bld/pyembree_1514977538913/work
    source tree in: /home/travis/miniconda/conda-bld/pyembree_1514977538913/work
    Traceback (most recent call last):
      File "setup.py", line 11, in <module>
        include_dirs=include_path)
      File "/home/travis/miniconda/conda-bld/pyembree_1514977538913/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl/lib/python2.7/site-packages/Cython/Build/Dependencies.py", line 909, in cythonize
        c_options = CompilationOptions(**options)
      File "/home/travis/miniconda/conda-bld/pyembree_1514977538913/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl/lib/python2.7/site-packages/Cython/Compiler/Main.py", line 559, in __init__
        raise ValueError(message)
    ValueError: got unknown compilation option, please remove: include_dirs
@scopatz
Copy link
Owner

scopatz commented Jan 3, 2018

Thanks for putting this in @Gjacquenot!


ext_modules = cythonize('pyembree/*.pyx', language='c++',
include_dirs=include_path)
include_path=include_path)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems as though include_path has been broken in some very recent (0.24) versions of Cython. I would rather we stay away from it. Was this line causing you problems for some reason?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I did not have Cython. I installed it with pip, which gave me the lastest version( 0.27.3). With this version, I had the following error : ValueError: got unknown compilation option, please remove: include_dirs

With CI, we have the same error, as you can see: 57199d9

IMHO, I think you can accept it.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh yeah, I see the below now.

cdef unsigned int addCube(rtcs.RTCScene scene_i):
cdef unsigned int mesh = rtcg.rtcNewTriangleMesh(scene_i,
rtcg.RTCGEOMETRY_STATIC, 12, 8, 1)
rtcg.RTC_GEOMETRY_STATIC, 12, 8, 1)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great catch!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. I think you can rename the file trianges.pyx in triangles.pyx.

BTW, the example attenaute.py also creates an error

>python attenuate.py
Ran region 1 in 0.075 s
Ran region 2 in 0.039 s
Ran region 3 in 0.005 s
Traceback (most recent call last):
  File "attenuate.py", line 60, in <module>
    maxdist[exists] = triangles[intersects[gi],:,0]  # get x coord
ValueError: shape mismatch: value array of shape (1565,3) could not be broadcast to indexing result of shape (1565,)

@scopatz scopatz merged commit 57199d9 into scopatz:master Jan 3, 2018
@scopatz
Copy link
Owner

scopatz commented Jan 3, 2018

Thanks @Gjacquenot!

@scopatz
Copy link
Owner

scopatz commented Jan 4, 2018

I have now released 0.1.2 with this fix!

pbsds added a commit to pbsds/pyembree that referenced this pull request Apr 21, 2025
…reeDevice

pytest + gdb backtrace output, with embree v2.17.7 compiled with `-DCMAKE_BUILD_TYPE=RelWithDebInfo`:

    ============================= test session starts ==============================
    platform linux -- Python 3.12.9, pytest-8.3.5, pluggy-1.5.0 -- /nix/store/fqm9bqqlmaqqr02qbalm1bazp810qfiw-python3-3.12.9/bin/python3.12
    cachedir: .pytest_cache
    rootdir: /build/source
    configfile: pyproject.toml
    collected 13 items

    tests/test_intersection.py::TestPyEmbree::test_pyembree_should_be_able_to_create_a_device_if_not_provided PASSED [  7%]
    tests/test_intersection.py::TestPyEmbree::test_pyembree_should_be_able_to_create_a_scene PASSED [ 15%]
    tests/test_intersection.py::TestPyEmbree::test_pyembree_should_be_able_to_create_several_scenes PASSED [ 23%]
    tests/test_intersection.py::TestPyEmbree::test_pyembree_should_be_able_to_display_embree_version PASSED [ 30%]
    tests/test_intersection.py::TestIntersectionTriangles::test_intersect PASSED [ 38%]
    Thread 1 "python3.12" received signal SIGSEGV, Segmentation fault.
    0x0000000000000000 in ?? ()
    #0  0x0000000000000000 in ?? ()
    adam-grant-hendry#1  0x00007fffb1e7e76f in embree::APIBuffer<embree::Vec3fa>::free (this=0x8cb7b0) at /build/source/kernels/common/buffer.h:212
    adam-grant-hendry#2  embree::APIBuffer<embree::Vec3fa>::~APIBuffer (this=0x8cb7b0, __in_chrg=<optimized out>) at /build/source/kernels/common/buffer.h:137
    scopatz#3  std::__new_allocator<embree::APIBuffer<embree::Vec3fa> >::destroy<embree::APIBuffer<embree::Vec3fa> > (this=0x9357a8, __p=0x8cb7b0) at /nix/store/qs54xir5n4vhhbi22aydbkvyyq4v8p0l-gcc-14.2.1.20250322/include/c++/14.2.1.20250322/bits/new_allocator.h:198
    scopatz#4  embree::vector_t<embree::APIBuffer<embree::Vec3fa>, std::allocator<embree::APIBuffer<embree::Vec3fa> > >::clear (this=0x9357a8) at /build/source/kernels/common/../../common/sys/vector.h:148
            i = 0
    scopatz#5  embree::vector_t<embree::APIBuffer<embree::Vec3fa>, std::allocator<embree::APIBuffer<embree::Vec3fa> > >::~vector_t (this=0x9357a8, __in_chrg=<optimized out>) at /build/source/kernels/common/../../common/sys/vector.h:42
    scopatz#6  embree::TriangleMesh::~TriangleMesh (this=0x9356b0, __in_chrg=<optimized out>) at /build/source/kernels/common/scene_triangle_mesh.h:25
    scopatz#7  embree::avx::TriangleMeshISA::~TriangleMeshISA (this=0x9356b0, __in_chrg=<optimized out>) at /build/source/kernels/common/scene_triangle_mesh.h:220
    scopatz#8  embree::avx::TriangleMeshISA::~TriangleMeshISA (this=0x9356b0, __in_chrg=<optimized out>) at /build/source/kernels/common/scene_triangle_mesh.h:220
    scopatz#9  0x00007fffb174744f in embree::Scene::~Scene (this=0xb45dc0, __in_chrg=<optimized out>) at /build/source/kernels/common/scene.cpp:594
            i = 0
            i = <optimized out>
    scopatz#10 0x00007fffb17475e9 in embree::Scene::~Scene (this=0xb45dc0, __in_chrg=<optimized out>) at /build/source/kernels/common/scene.cpp:599
            i = <optimized out>
    scopatz#11 0x00007ffff3565de8 in __pyx_pf_8pyembree_12rtcore_scene_11EmbreeScene_4__dealloc__ (__pyx_v_self=0x7fffb3055e00) at pyembree/rtcore_scene.cpp:3957
pbsds added a commit to pbsds/pyembree that referenced this pull request Apr 23, 2025
…reeDevice

pytest + gdb backtrace output, with embree v2.17.7 compiled with `-DCMAKE_BUILD_TYPE=RelWithDebInfo`:

    ============================= test session starts ==============================
    platform linux -- Python 3.12.9, pytest-8.3.5, pluggy-1.5.0 -- /nix/store/fqm9bqqlmaqqr02qbalm1bazp810qfiw-python3-3.12.9/bin/python3.12
    cachedir: .pytest_cache
    rootdir: /build/source
    configfile: pyproject.toml
    collected 13 items

    tests/test_intersection.py::TestPyEmbree::test_pyembree_should_be_able_to_create_a_device_if_not_provided PASSED [  7%]
    tests/test_intersection.py::TestPyEmbree::test_pyembree_should_be_able_to_create_a_scene PASSED [ 15%]
    tests/test_intersection.py::TestPyEmbree::test_pyembree_should_be_able_to_create_several_scenes PASSED [ 23%]
    tests/test_intersection.py::TestPyEmbree::test_pyembree_should_be_able_to_display_embree_version PASSED [ 30%]
    tests/test_intersection.py::TestIntersectionTriangles::test_intersect PASSED [ 38%]
    Thread 1 "python3.12" received signal SIGSEGV, Segmentation fault.
    0x0000000000000000 in ?? ()
    #0  0x0000000000000000 in ?? ()
    adam-grant-hendry#1  0x00007fffb1e7e76f in embree::APIBuffer<embree::Vec3fa>::free (this=0x8cb7b0) at /build/source/kernels/common/buffer.h:212
    adam-grant-hendry#2  embree::APIBuffer<embree::Vec3fa>::~APIBuffer (this=0x8cb7b0, __in_chrg=<optimized out>) at /build/source/kernels/common/buffer.h:137
    scopatz#3  std::__new_allocator<embree::APIBuffer<embree::Vec3fa> >::destroy<embree::APIBuffer<embree::Vec3fa> > (this=0x9357a8, __p=0x8cb7b0) at /nix/store/qs54xir5n4vhhbi22aydbkvyyq4v8p0l-gcc-14.2.1.20250322/include/c++/14.2.1.20250322/bits/new_allocator.h:198
    scopatz#4  embree::vector_t<embree::APIBuffer<embree::Vec3fa>, std::allocator<embree::APIBuffer<embree::Vec3fa> > >::clear (this=0x9357a8) at /build/source/kernels/common/../../common/sys/vector.h:148
            i = 0
    scopatz#5  embree::vector_t<embree::APIBuffer<embree::Vec3fa>, std::allocator<embree::APIBuffer<embree::Vec3fa> > >::~vector_t (this=0x9357a8, __in_chrg=<optimized out>) at /build/source/kernels/common/../../common/sys/vector.h:42
    scopatz#6  embree::TriangleMesh::~TriangleMesh (this=0x9356b0, __in_chrg=<optimized out>) at /build/source/kernels/common/scene_triangle_mesh.h:25
    scopatz#7  embree::avx::TriangleMeshISA::~TriangleMeshISA (this=0x9356b0, __in_chrg=<optimized out>) at /build/source/kernels/common/scene_triangle_mesh.h:220
    scopatz#8  embree::avx::TriangleMeshISA::~TriangleMeshISA (this=0x9356b0, __in_chrg=<optimized out>) at /build/source/kernels/common/scene_triangle_mesh.h:220
    scopatz#9  0x00007fffb174744f in embree::Scene::~Scene (this=0xb45dc0, __in_chrg=<optimized out>) at /build/source/kernels/common/scene.cpp:594
            i = 0
            i = <optimized out>
    scopatz#10 0x00007fffb17475e9 in embree::Scene::~Scene (this=0xb45dc0, __in_chrg=<optimized out>) at /build/source/kernels/common/scene.cpp:599
            i = <optimized out>
    scopatz#11 0x00007ffff3565de8 in __pyx_pf_8pyembree_12rtcore_scene_11EmbreeScene_4__dealloc__ (__pyx_v_self=0x7fffb3055e00) at pyembree/rtcore_scene.cpp:3957

(ported from e64a2fa)
pbsds added a commit to pbsds/pyembree that referenced this pull request Apr 23, 2025
…reeDevice

pytest + gdb backtrace output, with embree v2.17.7 compiled with `-DCMAKE_BUILD_TYPE=RelWithDebInfo`:

    ============================= test session starts ==============================
    platform linux -- Python 3.12.9, pytest-8.3.5, pluggy-1.5.0 -- /nix/store/fqm9bqqlmaqqr02qbalm1bazp810qfiw-python3-3.12.9/bin/python3.12
    cachedir: .pytest_cache
    rootdir: /build/source
    configfile: pyproject.toml
    collected 13 items

    tests/test_intersection.py::TestPyEmbree::test_pyembree_should_be_able_to_create_a_device_if_not_provided PASSED [  7%]
    tests/test_intersection.py::TestPyEmbree::test_pyembree_should_be_able_to_create_a_scene PASSED [ 15%]
    tests/test_intersection.py::TestPyEmbree::test_pyembree_should_be_able_to_create_several_scenes PASSED [ 23%]
    tests/test_intersection.py::TestPyEmbree::test_pyembree_should_be_able_to_display_embree_version PASSED [ 30%]
    tests/test_intersection.py::TestIntersectionTriangles::test_intersect PASSED [ 38%]
    Thread 1 "python3.12" received signal SIGSEGV, Segmentation fault.
    0x0000000000000000 in ?? ()
    #0  0x0000000000000000 in ?? ()
    adam-grant-hendry#1  0x00007fffb1e7e76f in embree::APIBuffer<embree::Vec3fa>::free (this=0x8cb7b0) at /build/source/kernels/common/buffer.h:212
    adam-grant-hendry#2  embree::APIBuffer<embree::Vec3fa>::~APIBuffer (this=0x8cb7b0, __in_chrg=<optimized out>) at /build/source/kernels/common/buffer.h:137
    scopatz#3  std::__new_allocator<embree::APIBuffer<embree::Vec3fa> >::destroy<embree::APIBuffer<embree::Vec3fa> > (this=0x9357a8, __p=0x8cb7b0) at /nix/store/qs54xir5n4vhhbi22aydbkvyyq4v8p0l-gcc-14.2.1.20250322/include/c++/14.2.1.20250322/bits/new_allocator.h:198
    scopatz#4  embree::vector_t<embree::APIBuffer<embree::Vec3fa>, std::allocator<embree::APIBuffer<embree::Vec3fa> > >::clear (this=0x9357a8) at /build/source/kernels/common/../../common/sys/vector.h:148
            i = 0
    scopatz#5  embree::vector_t<embree::APIBuffer<embree::Vec3fa>, std::allocator<embree::APIBuffer<embree::Vec3fa> > >::~vector_t (this=0x9357a8, __in_chrg=<optimized out>) at /build/source/kernels/common/../../common/sys/vector.h:42
    scopatz#6  embree::TriangleMesh::~TriangleMesh (this=0x9356b0, __in_chrg=<optimized out>) at /build/source/kernels/common/scene_triangle_mesh.h:25
    scopatz#7  embree::avx::TriangleMeshISA::~TriangleMeshISA (this=0x9356b0, __in_chrg=<optimized out>) at /build/source/kernels/common/scene_triangle_mesh.h:220
    scopatz#8  embree::avx::TriangleMeshISA::~TriangleMeshISA (this=0x9356b0, __in_chrg=<optimized out>) at /build/source/kernels/common/scene_triangle_mesh.h:220
    scopatz#9  0x00007fffb174744f in embree::Scene::~Scene (this=0xb45dc0, __in_chrg=<optimized out>) at /build/source/kernels/common/scene.cpp:594
            i = 0
            i = <optimized out>
    scopatz#10 0x00007fffb17475e9 in embree::Scene::~Scene (this=0xb45dc0, __in_chrg=<optimized out>) at /build/source/kernels/common/scene.cpp:599
            i = <optimized out>
    scopatz#11 0x00007ffff3565de8 in __pyx_pf_8pyembree_12rtcore_scene_11EmbreeScene_4__dealloc__ (__pyx_v_self=0x7fffb3055e00) at pyembree/rtcore_scene.cpp:3957

(ported from e64a2fa)
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

Successfully merging this pull request may close these issues.

2 participants