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

cargo test --workspace fails with linker errors #4125

Open
MusicalNinjaDad opened this issue Apr 25, 2024 · 0 comments
Open

cargo test --workspace fails with linker errors #4125

MusicalNinjaDad opened this issue Apr 25, 2024 · 0 comments
Labels

Comments

@MusicalNinjaDad
Copy link

MusicalNinjaDad commented Apr 25, 2024

Bug Description

Running cargo test --workspace in the pyo3 root directory leads to linker error.
This means that it is not possible to run tests from the test explorer section in VSCode. (See rust-lang/rust-analyzer#17136 and #4030)

Steps to Reproduce

  1. cargo test --workspace

Backtrace

Compiling pyo3 v0.21.2 (/workspaces/pyo3/pyo3)
error: linking with `cc` failed: exit status: 1
  |
  = note: LC_ALL="C" PATH="/opt/rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:/vscode/vscode-server/bin/linux-x64/e170252f762678dec6ca2cc69aba1570769a5d39/bin/remote-cli:/home/pyo3/.local/bin:/home/pyo3/bin:/opt/cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" VSLANG="1033" "cc" "-m64" "/tmp/rustcC3UUtq/symbols.o" "/workspaces/pyo3/pyo3/target/debug/deps/test_datetime_import-41cbbabf1256d4a3.1rl4ewvsvsfd250d.rcgu.o" "/workspaces/pyo3/pyo3/target/debug/deps/test_datetime_import-41cbbabf1256d4a3.1v6ezthkeltpdypf.rcgu.o" "/workspaces/pyo3/pyo3/target/debug/deps/test_datetime_import-41cbbabf1256d4a3.1vm2aukr3s1f29en.rcgu.o" "/workspaces/pyo3/pyo3/target/debug/deps/test_datetime_import-41cbbabf1256d4a3.2bml6sz7673oofn8.rcgu.o" "/workspaces/pyo3/pyo3/target/debug/deps/test_datetime_import-41cbbabf1256d4a3.2go7f5nsx579htem.rcgu.o" "/workspaces/pyo3/pyo3/target/debug/deps/test_datetime_import-41cbbabf1256d4a3.2vae2dwfqjxngr5u.rcgu.o" "/workspaces/pyo3/pyo3/target/debug/deps/test_datetime_import-41cbbabf1256d4a3.2yqc6ahigpxcsih7.rcgu.o" "/workspaces/pyo3/pyo3/target/debug/deps/test_datetime_import-41cbbabf1256d4a3.34nw6tg8anrt9euf.rcgu.o" "/workspaces/pyo3/pyo3/target/debug/deps/test_datetime_import-41cbbabf1256d4a3.3a3cp57v4b5uwkdn.rcgu.o" "/workspaces/pyo3/pyo3/target/debug/deps/test_datetime_import-41cbbabf1256d4a3.3h2kycr7lq2ygqlq.rcgu.o" "/workspaces/pyo3/pyo3/target/debug/deps/test_datetime_import-41cbbabf1256d4a3.3i26nyp6ogjicze6.rcgu.o" "/workspaces/pyo3/pyo3/target/debug/deps/test_datetime_import-41cbbabf1256d4a3.49t33qt1qdn55gui.rcgu.o" "/workspaces/pyo3/pyo3/target/debug/deps/test_datetime_import-41cbbabf1256d4a3.4v9mgegriw4ti96j.rcgu.o" "/workspaces/pyo3/pyo3/target/debug/deps/test_datetime_import-41cbbabf1256d4a3.4wy28mamviylp1w0.rcgu.o" "/workspaces/pyo3/pyo3/target/debug/deps/test_datetime_import-41cbbabf1256d4a3.4z5u32tqpi3hap0z.rcgu.o" "/workspaces/pyo3/pyo3/target/debug/deps/test_datetime_import-41cbbabf1256d4a3.fkggyhk7w1rnd72.rcgu.o" "/workspaces/pyo3/pyo3/target/debug/deps/test_datetime_import-41cbbabf1256d4a3.hr1bmbtyk190fab.rcgu.o" "/workspaces/pyo3/pyo3/target/debug/deps/test_datetime_import-41cbbabf1256d4a3.k9x24qt1lyfgmzf.rcgu.o" "/workspaces/pyo3/pyo3/target/debug/deps/test_datetime_import-41cbbabf1256d4a3.3zukopkxffnbltpe.rcgu.o" "-Wl,--as-needed" "-L" "/workspaces/pyo3/pyo3/target/debug/deps" "-L" "/opt/rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/opt/rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libtest-cb9f55643d3ef0c6.rlib" "/opt/rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgetopts-b256c4f6b61aecc9.rlib" "/opt/rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunicode_width-eaa163d48490c742.rlib" "/opt/rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_std-899ab04420e64755.rlib" "/workspaces/pyo3/pyo3/target/debug/deps/libpyo3-9649731cde181be3.rlib" "/workspaces/pyo3/pyo3/target/debug/deps/libmemoffset-255b43fa711f757a.rlib" "/workspaces/pyo3/pyo3/target/debug/deps/libportable_atomic-b4b065425689c94c.rlib" "/workspaces/pyo3/pyo3/target/debug/deps/libparking_lot-a7d6d684dfbdb426.rlib" "/workspaces/pyo3/pyo3/target/debug/deps/libparking_lot_core-3f288029b1f31a4f.rlib" "/workspaces/pyo3/pyo3/target/debug/deps/libcfg_if-3705568b3b302f3c.rlib" "/workspaces/pyo3/pyo3/target/debug/deps/libsmallvec-94336547f9d6f95d.rlib" "/workspaces/pyo3/pyo3/target/debug/deps/liblock_api-ce1db1a8e5e23a83.rlib" "/workspaces/pyo3/pyo3/target/debug/deps/libscopeguard-1ed9ab10b8209cca.rlib" "/workspaces/pyo3/pyo3/target/debug/deps/libpyo3_ffi-0c4e27e4d423666f.rlib" "/workspaces/pyo3/pyo3/target/debug/deps/liblibc-f8a9c2e6410450c2.rlib" "/workspaces/pyo3/pyo3/target/debug/deps/libunindent-0b9f41402a463856.rlib" "/opt/rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-2d08990d644ac786.rlib" "/opt/rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-6f2d4ec7ff80253d.rlib" "/opt/rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libobject-c194d68892442324.rlib" "/opt/rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libmemchr-9a71c52c5946f83b.rlib" "/opt/rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libaddr2line-ae9aec4ce2dabc4f.rlib" "/opt/rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgimli-6a207457d27610cc.rlib" "/opt/rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-fb1d2514710eef16.rlib" "/opt/rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd_detect-e36e7ed4b08caeac.rlib" "/opt/rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-9e8dafdf0a1b7ecd.rlib" "/opt/rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-b218f37fe3c9ce2e.rlib" "/opt/rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libminiz_oxide-20c30954fd9b5ef4.rlib" "/opt/rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libadler-6d3dfaf536d51163.rlib" "/opt/rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-cb4ce50789112af8.rlib" "/opt/rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-9897980a3b548e05.rlib" "/opt/rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-b7bd4d010c784af2.rlib" "/opt/rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-6d4515df28ba3369.rlib" "/opt/rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-e28568c1a21499f7.rlib" "/opt/rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-eedf3675950a13c2.rlib" "/opt/rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-715e69127681e2e0.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/opt/rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/workspaces/pyo3/pyo3/target/debug/deps/test_datetime_import-41cbbabf1256d4a3" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs"
  = note: /usr/bin/ld: /workspaces/pyo3/pyo3/target/debug/deps/libpyo3-9649731cde181be3.rlib(pyo3-9649731cde181be3.2dhk6n42mpxrpxtu.rcgu.o): in function `pyo3::err::PyErr::print_panic_and_unwind':
          /workspaces/pyo3/pyo3/src/err/mod.rs:480:(.text._ZN4pyo33err5PyErr22print_panic_and_unwind17h3a7d01a635fdc8ffE+0xec): undefined reference to `PyErr_PrintEx'
          /usr/bin/ld: /workspaces/pyo3/pyo3/target/debug/deps/libpyo3-9649731cde181be3.rlib(pyo3-9649731cde181be3.2dhk6n42mpxrpxtu.rcgu.o): in function `pyo3::err::PyErr::new_type_bound':
          /workspaces/pyo3/pyo3/src/err/mod.rs:577:(.text._ZN4pyo33err5PyErr14new_type_bound17h6b68d2c25dc74660E+0x46e): undefined reference to `PyErr_NewExceptionWithDoc'
          /usr/bin/ld: /workspaces/pyo3/pyo3/target/debug/deps/libpyo3-9649731cde181be3.rlib(pyo3-9649731cde181be3.2dhk6n42mpxrpxtu.rcgu.o): in function `pyo3::err::PyErr::write_unraisable_bound':
          /workspaces/pyo3/pyo3/src/err/mod.rs:721:(.text._ZN4pyo33err5PyErr22write_unraisable_bound17hdabd990e8abbfccdE+0x4b): undefined reference to `PyErr_WriteUnraisable'
          /usr/bin/ld: /workspaces/pyo3/pyo3/target/debug/deps/libpyo3-9649731cde181be3.rlib(pyo3-9649731cde181be3.2dhk6n42mpxrpxtu.rcgu.o): in function `pyo3::err::panic_after_error':
          /workspaces/pyo3/pyo3/src/err/mod.rs:1097:(.text._ZN4pyo33err17panic_after_error17h3d16f19a78dd65f3E+0xc): undefined reference to `PyErr_Print'
          /usr/bin/ld: /workspaces/pyo3/pyo3/target/debug/deps/libpyo3-9649731cde181be3.rlib(pyo3-9649731cde181be3.2rjincuy7jspau2k.rcgu.o): in function `<pyo3::instance::Bound<pyo3::types::any::PyAny> as pyo3::types::any::PyAnyMethods>::getattr::inner':
          /workspaces/pyo3/pyo3/src/types/any.rs:1767:(.text._ZN103_$LT$pyo3..instance..Bound$LT$pyo3..types..any..PyAny$GT$$u20$as$u20$pyo3..types..any..PyAnyMethods$GT$7getattr5inner17h21776d296146f5fbE+0x77): undefined reference to `PyObject_GetAttr'
          /usr/bin/ld: /workspaces/pyo3/pyo3/target/debug/deps/libpyo3-9649731cde181be3.rlib(pyo3-9649731cde181be3.2rjincuy7jspau2k.rcgu.o): in function `<pyo3::instance::Bound<pyo3::types::any::PyAny> as pyo3::types::any::PyAnyMethods>::call::inner':
          /workspaces/pyo3/pyo3/src/types/any.rs:1961:(.text._ZN103_$LT$pyo3..instance..Bound$LT$pyo3..types..any..PyAny$GT$$u20$as$u20$pyo3..types..any..PyAnyMethods$GT$4call5inner17he6f4f449fe12e213E+0xe4): undefined reference to `PyObject_Call'
          /usr/bin/ld: /workspaces/pyo3/pyo3/target/debug/deps/libpyo3-9649731cde181be3.rlib(pyo3-9649731cde181be3.3uv13khv6fparsz7.rcgu.o): in function `pyo3::err::err_state::PyErrStateNormalized::ptraceback':
          /workspaces/pyo3/pyo3/src/err/err_state.rs:41:(.text._ZN4pyo33err9err_state20PyErrStateNormalized10ptraceback17h374727512c7f14ebE+0x14): undefined reference to `PyException_GetTraceback'
          /usr/bin/ld: /workspaces/pyo3/pyo3/target/debug/deps/libpyo3-9649731cde181be3.rlib(pyo3-9649731cde181be3.3uv13khv6fparsz7.rcgu.o): in function `pyo3::err::err_state::PyErrStateNormalized::take':
          /workspaces/pyo3/pyo3/src/err/err_state.rs:49:(.text._ZN4pyo33err9err_state20PyErrStateNormalized4take17h3494aafbba047e0eE+0x3): undefined reference to `PyErr_GetRaisedException'
          /usr/bin/ld: /workspaces/pyo3/pyo3/target/debug/deps/libpyo3-9649731cde181be3.rlib(pyo3-9649731cde181be3.3uv13khv6fparsz7.rcgu.o): in function `pyo3::err::err_state::PyErrState::restore':
          /workspaces/pyo3/pyo3/src/err/err_state.rs:194:(.text._ZN4pyo33err9err_state10PyErrState7restore17h40b173e214044e77E+0x54): undefined reference to `PyErr_SetRaisedException'
          /usr/bin/ld: /workspaces/pyo3/pyo3/target/debug/deps/libpyo3-9649731cde181be3.rlib(pyo3-9649731cde181be3.3uv13khv6fparsz7.rcgu.o): in function `pyo3::err::err_state::raise_lazy':
          /workspaces/pyo3/pyo3/src/err/err_state.rs:229:(.text._ZN4pyo33err9err_state10raise_lazy17hb3729facdbbca54aE+0xd3): undefined reference to `PyErr_SetString'
          /usr/bin/ld: /workspaces/pyo3/pyo3/src/err/err_state.rs:236:(.text._ZN4pyo33err9err_state10raise_lazy17hb3729facdbbca54aE+0x10d): undefined reference to `PyErr_SetObject'
          /usr/bin/ld: /workspaces/pyo3/pyo3/target/debug/deps/libpyo3-9649731cde181be3.rlib(pyo3-9649731cde181be3.47by7g5ijodvoobn.rcgu.o): in function `<pyo3::gil::GILGuard as core::ops::drop::Drop>::drop':
          /workspaces/pyo3/pyo3/src/gil.rs:241:(.text._ZN61_$LT$pyo3..gil..GILGuard$u20$as$u20$core..ops..drop..Drop$GT$4drop17h2df5979449bba3edE+0x1e): undefined reference to `PyGILState_Release'
          /usr/bin/ld: /workspaces/pyo3/pyo3/target/debug/deps/libpyo3-9649731cde181be3.rlib(pyo3-9649731cde181be3.47by7g5ijodvoobn.rcgu.o): in function `pyo3_ffi::object::Py_DECREF':
          /workspaces/pyo3/pyo3/pyo3-ffi/src/object.rs:624:(.text._ZN60_$LT$pyo3..gil..GILPool$u20$as$u20$core..ops..drop..Drop$GT$4drop17h972807350f5023f0E+0x26e): undefined reference to `_Py_Dealloc'
          /usr/bin/ld: /workspaces/pyo3/pyo3/pyo3-ffi/src/object.rs:624:(.text._ZN72_$LT$pyo3..instance..Bound$LT$T$GT$$u20$as$u20$core..ops..drop..Drop$GT$4drop17h0af5c701d9411f2eE+0x142): undefined reference to `_Py_Dealloc'
          /usr/bin/ld: /workspaces/pyo3/pyo3/pyo3-ffi/src/object.rs:624:(.text._ZN72_$LT$pyo3..instance..Bound$LT$T$GT$$u20$as$u20$core..ops..drop..Drop$GT$4drop17h0df14bb3f26883a8E+0x142): undefined reference to `_Py_Dealloc'
          /usr/bin/ld: /workspaces/pyo3/pyo3/pyo3-ffi/src/object.rs:624:(.text._ZN72_$LT$pyo3..instance..Bound$LT$T$GT$$u20$as$u20$core..ops..drop..Drop$GT$4drop17h1f8a04d50bab5dfbE+0x142): undefined reference to `_Py_Dealloc'
          /usr/bin/ld: /workspaces/pyo3/pyo3/pyo3-ffi/src/object.rs:624:(.text._ZN72_$LT$pyo3..instance..Bound$LT$T$GT$$u20$as$u20$core..ops..drop..Drop$GT$4drop17ha1acdca7f9368186E+0x142): undefined reference to `_Py_Dealloc'
          /usr/bin/ld: /workspaces/pyo3/pyo3/target/debug/deps/libpyo3-9649731cde181be3.rlib(pyo3-9649731cde181be3.47by7g5ijodvoobn.rcgu.o):/workspaces/pyo3/pyo3/pyo3-ffi/src/object.rs:624: more undefined references to `_Py_Dealloc' follow
          /usr/bin/ld: /workspaces/pyo3/pyo3/target/debug/deps/libpyo3-9649731cde181be3.rlib(pyo3-9649731cde181be3.49po8o5qwmtmbzdd.rcgu.o): in function `pyo3::types::tuple::array_into_tuple':
          /workspaces/pyo3/pyo3/src/types/tuple.rs:714:(.text._ZN4pyo35types5tuple16array_into_tuple17hf8525f71f5e6f516E+0x94): undefined reference to `PyTuple_New'
          /usr/bin/ld: /workspaces/pyo3/pyo3/target/debug/deps/libpyo3-9649731cde181be3.rlib(pyo3-9649731cde181be3.avdhmsfrav2bbd8.rcgu.o): in function `pyo3::conversions::std::num::<impl pyo3::conversion::IntoPy<pyo3::instance::Py<pyo3::types::any::PyAny>> for i32>::into_py':
          /workspaces/pyo3/pyo3/src/conversions/std/num.rs:120:(.text._ZN4pyo311conversions3std3num115_$LT$impl$u20$pyo3..conversion..IntoPy$LT$pyo3..instance..Py$LT$pyo3..types..any..PyAny$GT$$GT$$u20$for$u20$i32$GT$7into_py17hb50390f4bc34e908E+0xd): undefined reference to `PyLong_FromLong'
          /usr/bin/ld: /workspaces/pyo3/pyo3/target/debug/deps/libpyo3-9649731cde181be3.rlib(pyo3-9649731cde181be3.b7lzwfpnet4pvi0.rcgu.o): in function `pyo3::types::string::PyString::new_bound':
          /workspaces/pyo3/pyo3/src/types/string.rs:155:(.text._ZN4pyo35types6string8PyString9new_bound17hb6d06b9d07f877d3E+0x36): undefined reference to `PyUnicode_FromStringAndSize'
          /usr/bin/ld: /workspaces/pyo3/pyo3/target/debug/deps/libpyo3-9649731cde181be3.rlib(pyo3-9649731cde181be3.siq625zt8eo0azz.rcgu.o): in function `pyo3::gil::GILGuard::acquire_unchecked':
          /workspaces/pyo3/pyo3/src/gil.rs:226:(.text._ZN4pyo33gil8GILGuard17acquire_unchecked17h80a57395a6e0314bE+0x2d): undefined reference to `PyGILState_Ensure'
          /usr/bin/ld: /workspaces/pyo3/pyo3/target/debug/deps/libpyo3-9649731cde181be3.rlib(pyo3-9649731cde181be3.siq625zt8eo0azz.rcgu.o): in function `pyo3_ffi::object::Py_DECREF':
          /workspaces/pyo3/pyo3/pyo3-ffi/src/object.rs:624:(.text._ZN4pyo33gil13ReferencePool13update_counts17hbc997397f32a0242E+0x549): undefined reference to `_Py_Dealloc'
          /usr/bin/ld: /workspaces/pyo3/pyo3/pyo3-ffi/src/object.rs:624:(.text._ZN4pyo33gil15register_decref17he11ad97bd3bd6d8eE+0x17a): undefined reference to `_Py_Dealloc'
          /usr/bin/ld: /workspaces/pyo3/pyo3/target/debug/deps/libpyo3-9649731cde181be3.rlib(pyo3-9649731cde181be3.1r44oqfh6phnnttq.rcgu.o): in function `pyo3::types::module::PyModule::import_bound':
          /workspaces/pyo3/pyo3/src/types/module.rs:107:(.text._ZN4pyo35types6module8PyModule12import_bound17h863b0125350505a1E+0x7f): undefined reference to `PyImport_Import'
          /usr/bin/ld: /workspaces/pyo3/pyo3/target/debug/deps/libpyo3-9649731cde181be3.rlib(pyo3-9649731cde181be3.1v6ldtecwldmqpu6.rcgu.o): in function `<pyo3::instance::Bound<pyo3::types::any::PyAny> as pyo3::types::any::PyAnyMethods>::repr':
          /workspaces/pyo3/pyo3/src/types/any.rs:2197:(.text._ZN103_$LT$pyo3..instance..Bound$LT$pyo3..types..any..PyAny$GT$$u20$as$u20$pyo3..types..any..PyAnyMethods$GT$4repr17h39d1f9afc30b8a21E+0x29): undefined reference to `PyObject_Repr'
          /usr/bin/ld: /workspaces/pyo3/pyo3/target/debug/deps/libpyo3-9649731cde181be3.rlib(pyo3-9649731cde181be3.1v6ldtecwldmqpu6.rcgu.o): in function `<pyo3::instance::Bound<pyo3::types::any::PyAny> as pyo3::types::any::PyAnyMethods>::str':
          /workspaces/pyo3/pyo3/src/types/any.rs:2205:(.text._ZN103_$LT$pyo3..instance..Bound$LT$pyo3..types..any..PyAny$GT$$u20$as$u20$pyo3..types..any..PyAnyMethods$GT$3str17hb97560953e9a6315E+0x29): undefined reference to `PyObject_Str'
          /usr/bin/ld: /workspaces/pyo3/pyo3/target/debug/deps/libpyo3-9649731cde181be3.rlib(pyo3-9649731cde181be3.1v6ldtecwldmqpu6.rcgu.o): in function `pyo3::types::bytes::<impl pyo3::instance::Borrowed<pyo3::types::bytes::PyBytes>>::as_bytes':
          /workspaces/pyo3/pyo3/src/types/bytes.rs:163:(.text._ZN4pyo35types5bytes77_$LT$impl$u20$pyo3..instance..Borrowed$LT$pyo3..types..bytes..PyBytes$GT$$GT$8as_bytes17h8f9bd74bd6117bd8E+0x22): undefined reference to `PyBytes_AsString'
          /usr/bin/ld: /workspaces/pyo3/pyo3/src/types/bytes.rs:164:(.text._ZN4pyo35types5bytes77_$LT$impl$u20$pyo3..instance..Borrowed$LT$pyo3..types..bytes..PyBytes$GT$$GT$8as_bytes17h8f9bd74bd6117bd8E+0x48): undefined reference to `PyBytes_Size'
          /usr/bin/ld: /workspaces/pyo3/pyo3/target/debug/deps/libpyo3-9649731cde181be3.rlib(pyo3-9649731cde181be3.1v6ldtecwldmqpu6.rcgu.o): in function `pyo3::types::string::<impl pyo3::instance::Borrowed<pyo3::types::string::PyString>>::to_str':
          /workspaces/pyo3/pyo3/src/types/string.rs:355:(.text._ZN4pyo35types6string79_$LT$impl$u20$pyo3..instance..Borrowed$LT$pyo3..types..string..PyString$GT$$GT$6to_str17hd8747368d81c25ffE+0x3a): undefined reference to `PyUnicode_AsUTF8AndSize'
          /usr/bin/ld: /workspaces/pyo3/pyo3/target/debug/deps/libpyo3-9649731cde181be3.rlib(pyo3-9649731cde181be3.1v6ldtecwldmqpu6.rcgu.o): in function `pyo3::types::string::<impl pyo3::instance::Borrowed<pyo3::types::string::PyString>>::to_string_lossy':
          /workspaces/pyo3/pyo3/src/types/string.rs:394:(.text._ZN4pyo35types6string79_$LT$impl$u20$pyo3..instance..Borrowed$LT$pyo3..types..string..PyString$GT$$GT$15to_string_lossy17hf6cd07c3ca732213E+0x103): undefined reference to `PyUnicode_AsEncodedString'
          /usr/bin/ld: /workspaces/pyo3/pyo3/target/debug/deps/libpyo3-9649731cde181be3.rlib(pyo3-9649731cde181be3.28l71zdh4r8n6wuo.rcgu.o): in function `<pyo3::exceptions::PyBaseException as pyo3::type_object::PyTypeInfo>::type_object_raw::{{closure}}':
          /workspaces/pyo3/pyo3/src/exceptions.rs:305:(.text._ZN83_$LT$pyo3..exceptions..PyBaseException$u20$as$u20$pyo3..type_object..PyTypeInfo$GT$15type_object_raw28_$u7b$$u7b$closure$u7d$$u7d$17he880910edc61ce0aE+0x8): undefined reference to `PyExc_BaseException'
          /usr/bin/ld: /workspaces/pyo3/pyo3/target/debug/deps/libpyo3-9649731cde181be3.rlib(pyo3-9649731cde181be3.28l71zdh4r8n6wuo.rcgu.o): in function `<pyo3::exceptions::PyTypeError as pyo3::type_object::PyTypeInfo>::type_object_raw::{{closure}}':
          /workspaces/pyo3/pyo3/src/exceptions.rs:305:(.text._ZN79_$LT$pyo3..exceptions..PyTypeError$u20$as$u20$pyo3..type_object..PyTypeInfo$GT$15type_object_raw28_$u7b$$u7b$closure$u7d$$u7d$17h40ebad0da7f9adb4E+0x8): undefined reference to `PyExc_TypeError'
          /usr/bin/ld: /workspaces/pyo3/pyo3/target/debug/deps/libpyo3-9649731cde181be3.rlib(pyo3-9649731cde181be3.28l71zdh4r8n6wuo.rcgu.o): in function `<pyo3::exceptions::PyUnicodeDecodeError as pyo3::type_object::PyTypeInfo>::type_object_raw::{{closure}}':
          /workspaces/pyo3/pyo3/src/exceptions.rs:305:(.text._ZN88_$LT$pyo3..exceptions..PyUnicodeDecodeError$u20$as$u20$pyo3..type_object..PyTypeInfo$GT$15type_object_raw28_$u7b$$u7b$closure$u7d$$u7d$17hcd770eae4e87ebe5E+0x8): undefined reference to `PyExc_UnicodeDecodeError'
          /usr/bin/ld: /workspaces/pyo3/pyo3/target/debug/deps/libpyo3-9649731cde181be3.rlib(pyo3-9649731cde181be3.2bole5elw5l9z14x.rcgu.o): in function `pyo3::gil::prepare_freethreaded_python::{{closure}}':
          /workspaces/pyo3/pyo3/src/gil.rs:88:(.text._ZN4pyo33gil27prepare_freethreaded_python28_$u7b$$u7b$closure$u7d$$u7d$17h334858d24395bcfaE+0xa): undefined reference to `Py_IsInitialized'
          /usr/bin/ld: /workspaces/pyo3/pyo3/src/gil.rs:89:(.text._ZN4pyo33gil27prepare_freethreaded_python28_$u7b$$u7b$closure$u7d$$u7d$17h334858d24395bcfaE+0x17): undefined reference to `Py_InitializeEx'
          /usr/bin/ld: /workspaces/pyo3/pyo3/src/gil.rs:92:(.text._ZN4pyo33gil27prepare_freethreaded_python28_$u7b$$u7b$closure$u7d$$u7d$17h334858d24395bcfaE+0x1d): undefined reference to `PyEval_SaveThread'
          /usr/bin/ld: /workspaces/pyo3/pyo3/target/debug/deps/libpyo3-9649731cde181be3.rlib(pyo3-9649731cde181be3.35xvn7whrdz60mvx.rcgu.o): in function `pyo3::conversions::std::osstr::<impl pyo3::conversion::ToPyObject for std::ffi::os_str::OsStr>::to_object':
          /workspaces/pyo3/pyo3/src/conversions/std/osstr.rs:31:(.text._ZN4pyo311conversions3std5osstr82_$LT$impl$u20$pyo3..conversion..ToPyObject$u20$for$u20$std..ffi..os_str..OsStr$GT$9to_object17h879037313f315ec1E+0x9f): undefined reference to `PyUnicode_DecodeFSDefaultAndSize'
          /usr/bin/ld: /workspaces/pyo3/pyo3/target/debug/deps/libpyo3_ffi-0c4e27e4d423666f.rlib(pyo3_ffi-0c4e27e4d423666f.1vue2luu468m5l4y.rcgu.o): in function `pyo3_ffi::datetime::PyDateTime_IMPORT':
          /workspaces/pyo3/pyo3/pyo3-ffi/src/datetime.rs:626:(.text._ZN8pyo3_ffi8datetime17PyDateTime_IMPORT17hc9eecdbc8cb6c8f8E+0x13e): undefined reference to `PyCapsule_Import'
          collect2: error: ld returned 1 exit status
          
  = note: some `extern` functions couldn't be found; some native libraries may need to be installed or have their path specified
  = note: use the `-l` flag to specify native libraries to link
  = note: use the `cargo:rustc-link-lib` directive to specify the native libraries to link with Cargo (see https://doc.rust-lang.org/cargo/reference/build-scripts.html#rustc-link-lib)

...

Your operating system and version

Fedora 23 (in Docker), WSL2 (Ubuntu) on Win 11: Linux 0c9148830d0e 5.15.146.1-microsoft-standard-WSL2 #1 SMP Thu Jan 11 04:09:03 UTC 2024 x86_64 GNU/Linux

Your Python version (python --version)

Python 3.12.2

Your Rust version (rustc --version)

rustc 1.77.2 (25ef9e3d8 2024-04-09)

Your PyO3 version

0.21.2

How did you install python? Did you use a virtualenv?

dnf install python
full details in https://github.com/MusicalNinjaDad/devcontainers-python-rust/blob/50a15a3556a55559b347387c76d27467cbd130e1/Dockerfile

Additional Info

cargo test, nox -s test-rust, cargo test -F full all run fine.

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

No branches or pull requests

1 participant