Build: nanobind error
Open
Nobody has claimed this yet.
question
- Dominant language
- C++
- Stars
- 1k
- Forks
- 152
- PR merge metrics
- No merged PRs in 30d
Description
When updating my nanobind build recipe from 1.0.1 to current git I'm encountering:
- gcc 15.2.1
- nanobind 2.13.0
- Python 3.10
g++ -shared -Wl,-O1,--as-needed,-z,relro,-z,now -Wl,--undefined-version -Wl,-O1,--as-needed,-z,relro,-z,now -Wl,--undefined-version -Wl,-O1,--as-needed,-z,relro,-z,now -Wl,--undefined-version -march=native -mtune=native -O3 -pipe -fpermissive -fno-plt -fexceptions -Wno-unused-parameter -Wno-tautological-compare -Wno-deprecated-declarations -Wno-unknown-pragmas -Wno-error=incompatible-pointer-types -fPIC -Wno-implicit-function-declaration -Wno-incompatible-pointer-type build/temp.linux-x86_64-cpython-310/src/main.o -L/usr/lib -o build/lib.linux-x86_64-cpython-310/mapbox_earcut.cpython-310-x86_64-linux-gnu.so
/usr/bin/ld: build/temp.linux-x86_64-cpython-310/src/main.o: in function `nanobind__core_exec(_object*)':
main.cpp:(.text+0x436): undefined reference to `nanobind::detail::nb_module_exec(char const*, _object*)'
/usr/bin/ld: main.cpp:(.text+0x469): undefined reference to `nanobind::detail::setattr(_object*, char const*, _object*)'
/usr/bin/ld: main.cpp:(.text+0x522): undefined reference to `nanobind::detail::setattr(_object*, char const*, _object*)'
/usr/bin/ld: main.cpp:(.text+0x580): undefined reference to `nanobind::detail::nb_func_new(nanobind::detail::func_data_prelim_base const*)'
/usr/bin/ld: main.cpp:(.text+0x5ca): undefined reference to `nanobind::detail::nb_func_new(nanobind::detail::func_data_prelim_base const*)'
/usr/bin/ld: main.cpp:(.text+0x614): undefined reference to `nanobind::detail::nb_func_new(nanobind::detail::func_data_prelim_base const*)'
/usr/bin/ld: main.cpp:(.text+0x65e): undefined reference to `nanobind::detail::nb_func_new(nanobind::detail::func_data_prelim_base const*)'
/usr/bin/ld: main.cpp:(.text+0x6ce): undefined reference to `nanobind::detail::raise_python_or_cast_error()'
/usr/bin/ld: main.cpp:(.text+0x6e2): undefined reference to `nanobind::detail::raise_python_or_cast_error()'
/usr/bin/ld: build/temp.linux-x86_64-cpython-310/src/main.o: in function `nanobind__core_exec(_object*) [clone .cold]':
main.cpp:(.text.unlikely+0xce): undefined reference to `nanobind::python_error::restore()'
/usr/bin/ld: main.cpp:(.text.unlikely+0xe6): undefined reference to `nanobind::chain_error(nanobind::handle, char const*, ...)'
/usr/bin/ld: build/temp.linux-x86_64-cpython-310/src/main.o: in function `nanobind::detail::func_create<false, true, nanobind::detail::ndarray_object<unsigned int, nanobind::numpy, nanobind::detail::shape<-1l> > (*&)(nanobind::ndarray<long, nanobind::detail::shape<-1l, 2l>, nanobind::device::cpu> const&, nanobind::ndarray<unsigned int, nanobind::detail::shape<-1l>, nanobind::device::cpu> const&), nanobind::detail::ndarray_object<unsigned int, nanobind::numpy, nanobind::detail::shape<-1l> >, nanobind::ndarray<long, nanobind::detail::shape<-1l, 2l>, nanobind::device::cpu> const&, nanobind::ndarray<unsigned int, nanobind::detail::shape<-1l>, nanobind::device::cpu> const&, 0ul, 1ul, nanobind::scope, nanobind::name>(nanobind::detail::ndarray_object<unsigned int, nanobind::numpy, nanobind::detail::shape<-1l> > (*&)(nanobind::ndarray<long, nanobind::detail::shape<-1l, 2l>, nanobind::device::cpu> const&, nanobind::ndarray<unsigned int, nanobind::detail::shape<-1l>, nanobind::device::cpu> const&), nanobind::detail::ndarray_object<unsigned int, nanobind::numpy, nanobind::detail::shape<-1l> > (*)(nanobind::ndarray<long, nanobind::detail::shape<-1l, 2l>, nanobind::device::cpu> const&, nanobind::ndarray<unsigned int, nanobind::detail::shape<-1l>, nanobind::device::cpu> const&), std::integer_sequence<unsigned long, 0ul, 1ul>, nanobind::scope const&, nanobind::name const&)::{lambda(void*, _object**, unsigned char*, nanobind::rv_policy, nanobind::detail::cleanup_list*)#1}::_FUN(void*, _object**, unsigned char*, nanobind::rv_policy, nanobind::detail::cleanup_list*)':
main.cpp:(.text._ZZN8nanobind6detail11func_createILb0ELb1ERPFNS0_14ndarray_objectIJjNS_5numpyENS0_5shapeIJLln1EEEEEEERKNS_7ndarrayIJlNS4_IJLln1ELl2EEEENS_6device3cpuEEEERKNS7_IJjS5_SA_EEEES6_JSD_SG_EJLm0ELm1EEJNS_5scopeENS_4nameEEEEP7_objectOT1_PFT2_DpT3_ESt16integer_sequenceImJXspT4_EEEDpRKT5_ENUlPvPSN_PhNS_9rv_policyEPNS0_12cleanup_listEE_4_FUNES11_S12_S13_S14_S16_[_ZZN8nanobind6detail11func_createILb0ELb1ERPFNS0_14ndarray_objectIJjNS_5numpyENS0_5shapeIJLln1EEEEEEERKNS_7ndarrayIJlNS4_IJLln1ELl2EEEENS_6device3cpuEEEERKNS7_IJjS5_SA_EEEES6_JSD_SG_EJLm0ELm1EEJNS_5scopeENS_4nameEEEEP7_objectOT1_PFT2_DpT3_ESt16integer_sequenceImJXspT4_EEEDpRKT5_ENUlPvPSN_PhNS_9rv_policyEPNS0_12cleanup_listEE_4_FUNES11_S12_S13_S14_S16_]+0xd4): undefined reference to `nanobind::detail::ndarray_import(_object*, nanobind::detail::ndarray_config const*, bool, nanobind::detail::cleanup_list*)'
Before I've had been using nanobind 2.7
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the build command and linker errors for src/main.o, comparing the nanobind 2.7 and 2.13 configurations used with Python 3.10. Check how the extension is linked against nanobind and confirm that the build completes without the reported undefined references.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, python
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100