MacOS Build with `-DBUILD_CUDA_MODULE=OFF`: PyBind attempts to link symbol `open3d_core_cuda_device_count`
- Dominant language
- C++
- Stars
- 14k
- Forks
- 2.6k
- Avg merge
- 5d 18h
- Merged PRs (30d)
- 6
Description
### Checklist
- [x] I have searched for [similar issues](https://github.com/isl-org/Open3D/issues).
- [x] For Python issues, I have tested with the [latest development wheel](https://www.open3d.org/docs/latest/getting_started.html#development-version-pip).
- [x] I have checked the [release documentation](https://www.open3d.org/docs/release/) and the [latest documentation](https://www.open3d.org/docs/latest/) (for `main` branch).
### Steps to reproduce the issue
I’ve submitted a MacPorts Portfile for Open3D at https://github.com/macports/macports-ports/pull/32787
When building with `-DBUILD_CUDA_MODULE=OFF`, PyBind attempts to link symbol `open3d_core_cuda_device_count`, which of course breaks the build.
A temporary fix is in this [patch](https://github.com/macports/macports-ports/pull/32787/changes#diff-a27befe0378125d789219d1bc5c3a0afbb7beae91384c2911f29e41af71b37d8) of `cpp/pybind/CMakeLists.txt`, which simply deletes the incorrect symbol added to `pybind.map`:
```diff
--- ./cpp/pybind/CMakeLists.txt 2026-05-16 00:05:32
+++ ./cpp/pybind/CMakeLists.txt 2026-05-16 06:29:46
@@ -43,6 +43,15 @@
open3d_set_global_properties(pybind)
target_link_libraries(pybind PRIVATE Open3D::Open3D)
+# symbol open3d_core_cuda_device_count, function defined to return 0
+# target_link_libraries(pybind PRIVATE "${CMAKE_BINARY_DIR}/cpp/open3d/core/CMakeFiles/core.dir/CUDAUtils.cpp.o")
+if(NOT BUILD_CUDA_MODULE)
+ add_custom_command(
+ TARGET pybind PRE_LINK
+ COMMAND sed -i '' '/open3d_core_cuda_device_count/d' "${CMAKE_CURRENT_BINARY_DIR}/pybind.map"
+ COMMENT "Strip CUDA device symbol from pybind.map"
+ )
+endif()
if (WIN32)
target_link_options(pybind PUBLIC "/force:multiple")
```
### Error message
```shell
Symbol `open3d_core_cuda_device_count` not found
```
### Open3D, Python and System information
```markdown
- Operating system: macOS 26
- Python version: Python 3.14`
- Open3D version: 0.19.0`
- System architecture: arm64
- Is this a remote workstation?: no
- How did you install Open3D?: build from source
- Compiler version (if built from source): clang
```
### Additional information
_No response_
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.