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

Allow setting linker args that only apply to bin or lib targets #5881

Open
konstin opened this issue Aug 9, 2018 · 1 comment
Open

Allow setting linker args that only apply to bin or lib targets #5881

konstin opened this issue Aug 9, 2018 · 1 comment
Labels
A-linkage Area: linker issues, dylib, cdylib, shared libraries, so C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` S-needs-team-input Status: Needs input from team on whether/how to proceed.

Comments

@konstin
Copy link
Contributor

konstin commented Aug 9, 2018

For crates built on pyo3, you need to link libpython for binaries and you must not link libpython for libraries (the latter is required by PEP 513). The current workaround is that there is an extension-module feature for libraries, which tells pyo3's build script to not link libpython.

Unfortunately, this doesn't work anymore when the same crate contains a bin (or test or bench) and a lib target. Take hyperjson as an example. It's Cargo.toml contains the following

[dependencies.pyo3]
version = "0.4.0"
features = ["extension-module"]

[lib]
name = "hyperjson"
crate-type = ["rlib", "cdylib"]


[[bin]]
name = "hyperjson-bench"
path = "src/bench.rs"

cargo build fails on linux bacause it tries to build the bench target, which is lacking symbols the linker arguments to link libpython. Removing the features = ["extension-module"] is also not an option as it makes libhyperjson.so also link libpython, which ldd confirms.

cargo build output
   Compiling hyperjson v0.1.0 (file:///home/konsti/hyperjson)                                                                                                                
warning: unused variable: `py`
  |
  = note: #[warn(unused_variables)] on by default

warning: unused variable: `ensure_ascii`
  --> src/lib.rs:79:1
   |
79 | #[pymodinit]
   | ^^^^^^^^^^^^ help: consider using `_ensure_ascii` instead

warning: unused `std::result::Result` which must be used
  |
  = note: #[warn(unused_must_use)] on by default
  = note: this `Result` may be an `Err` variant, which should be handled

error: linking with `cc` failed: exit code: 1
  |
  = note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-L" "/home/konsti/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "/home/konsti/hyperjson/target/debug/deps/hyperjson_bench-99f0b8c6ec5a2de4.15kq92zzbmxot4k9.rcgu.o" "/home/konsti/hyperjson/target/debug/deps/hyperjson_bench-99f0b8c6ec5a2de4.16u6js6g0l3k1ic6.rcgu.o" "/home/konsti/hyperjson/target/debug/deps/hyperjson_bench-99f0b8c6ec5a2de4.1c67wfz8x9hrqx7u.rcgu.o" "/home/konsti/hyperjson/target/debug/deps/hyperjson_bench-99f0b8c6ec5a2de4.1im38lueib99jsk0.rcgu.o" "/home/konsti/hyperjson/target/debug/deps/hyperjson_bench-99f0b8c6ec5a2de4.1kduva7sc7em934m.rcgu.o" "/home/konsti/hyperjson/target/debug/deps/hyperjson_bench-99f0b8c6ec5a2de4.1y16o1qfye96o7m0.rcgu.o" "/home/konsti/hyperjson/target/debug/deps/hyperjson_bench-99f0b8c6ec5a2de4.2jqywn86b2gsqohu.rcgu.o" "/home/konsti/hyperjson/target/debug/deps/hyperjson_bench-99f0b8c6ec5a2de4.2k9pgpf8e3hg3tuh.rcgu.o" "/home/konsti/hyperjson/target/debug/deps/hyperjson_bench-99f0b8c6ec5a2de4.2qhkzqx5zqexj20y.rcgu.o" "/home/konsti/hyperjson/target/debug/deps/hyperjson_bench-99f0b8c6ec5a2de4.3rngp6bm2u2q5z0y.rcgu.o" "/home/konsti/hyperjson/target/debug/deps/hyperjson_bench-99f0b8c6ec5a2de4.49a7n47po4ttqjl7.rcgu.o" "/home/konsti/hyperjson/target/debug/deps/hyperjson_bench-99f0b8c6ec5a2de4.49lx1q7cxvpykyv0.rcgu.o" "/home/konsti/hyperjson/target/debug/deps/hyperjson_bench-99f0b8c6ec5a2de4.4oc10dk278mpk1vy.rcgu.o" "/home/konsti/hyperjson/target/debug/deps/hyperjson_bench-99f0b8c6ec5a2de4.4vp4wqj2v29i7mgy.rcgu.o" "/home/konsti/hyperjson/target/debug/deps/hyperjson_bench-99f0b8c6ec5a2de4.4xq48u46a1pwiqn7.rcgu.o" "/home/konsti/hyperjson/target/debug/deps/hyperjson_bench-99f0b8c6ec5a2de4.57qy3vyd9bhiuaon.rcgu.o" "/home/konsti/hyperjson/target/debug/deps/hyperjson_bench-99f0b8c6ec5a2de4.8xzrsc1ux72v29j.rcgu.o" "/home/konsti/hyperjson/target/debug/deps/hyperjson_bench-99f0b8c6ec5a2de4.98g0d9x8aw3akpe.rcgu.o" "/home/konsti/hyperjson/target/debug/deps/hyperjson_bench-99f0b8c6ec5a2de4.c6lbtaiefvx3wya.rcgu.o" "/home/konsti/hyperjson/target/debug/deps/hyperjson_bench-99f0b8c6ec5a2de4.oa3rad818d8sgn4.rcgu.o" "/home/konsti/hyperjson/target/debug/deps/hyperjson_bench-99f0b8c6ec5a2de4.spyjbt69vcsrx9q.rcgu.o" "/home/konsti/hyperjson/target/debug/deps/hyperjson_bench-99f0b8c6ec5a2de4.u4foieswxujsg02.rcgu.o" "-o" "/home/konsti/hyperjson/target/debug/deps/hyperjson_bench-99f0b8c6ec5a2de4" "/home/konsti/hyperjson/target/debug/deps/hyperjson_bench-99f0b8c6ec5a2de4.crate.allocator.rcgu.o" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro" "-Wl,-znow" "-nodefaultlibs" "-L" "/home/konsti/hyperjson/target/debug/deps" "-L" "/home/konsti/hyperjson/target/debug/build/backtrace-sys-da0498922fb85157/out" "-L" "/home/konsti/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/home/konsti/hyperjson/target/debug/deps/libhyperjson.rlib" "/home/konsti/hyperjson/target/debug/deps/libserde_json-614441785941a424.rlib" "/home/konsti/hyperjson/target/debug/deps/libitoa-c331b65970716665.rlib" "/home/konsti/hyperjson/target/debug/deps/libdtoa-d7ce2c18367a8934.rlib" "/home/konsti/hyperjson/target/debug/deps/libpyo3-0afac51c0840a4c1.rlib" "/home/konsti/hyperjson/target/debug/deps/libnum_traits-9a591a8a934c9467.rlib" "/home/konsti/hyperjson/target/debug/deps/libmashup-cde9a1c4249858ac.rlib" "/home/konsti/hyperjson/target/debug/deps/libproc_macro_hack-97bd68dd3cc20f5c.rlib" "/home/konsti/hyperjson/target/debug/deps/libspin-c9a689554627b4a8.rlib" "/home/konsti/hyperjson/target/debug/deps/libfailure-104153f679fe72cd.rlib" "/home/konsti/hyperjson/target/debug/deps/libbacktrace-03ba09153044ada2.rlib" "/home/konsti/hyperjson/target/debug/deps/libbacktrace_sys-9463d6f31f1c7d3a.rlib" "/home/konsti/hyperjson/target/debug/deps/librustc_demangle-d47dab3a42f1b297.rlib" "/home/konsti/hyperjson/target/debug/deps/libcfg_if-9e502a1482b8cc66.rlib" "/home/konsti/hyperjson/target/debug/deps/liblibc-6d8c8dccf24bbdac.rlib" "/home/konsti/hyperjson/target/debug/deps/libserde-e7b691cbbe20a215.rlib" "/home/konsti/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libtest-836507ccdc580ba2.rlib" "/home/konsti/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libterm-4bdb7a916d7f28e3.rlib" "/home/konsti/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgetopts-eefbf875e5d16271.rlib" "-Wl,--start-group" "/home/konsti/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-d703ae3dfb5b7629.rlib" "/home/konsti/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-88d65ea6a8b77df3.rlib" "/home/konsti/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc_jemalloc-5921515f8029967f.rlib" "/home/konsti/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-ea070beded7754ad.rlib" "/home/konsti/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc_system-652f8ca126d641ee.rlib" "/home/konsti/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-06e5c0d7dbac4270.rlib" "/home/konsti/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-dee08d52640c13bd.rlib" "/home/konsti/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-c69751746ddc6f5a.rlib" "-Wl,--end-group" "/home/konsti/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-d1ef8f916e593b62.rlib" "-Wl,-Bdynamic" "-lutil" "-lutil" "-ldl" "-lrt" "-lpthread" "-lpthread" "-lgcc_s" "-lc" "-lm" "-lrt" "-lpthread" "-lutil" "-lutil"
  = note: /home/konsti/hyperjson/target/debug/deps/libhyperjson.rlib(hyperjson.ti9hmxpeoxxvmiq.rcgu.o): In Funktion »pyo3::object::PyObject::call1«:
          /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.4.0/src/object.rs:207: Warnung: undefinierter Verweis auf »PyObject_Call«
          /home/konsti/hyperjson/target/debug/deps/libhyperjson.rlib(hyperjson.ti9hmxpeoxxvmiq.rcgu.o): In Funktion »pyo3::objects::list::<impl pyo3::conversion::ToPyObject for [T]>::to_object«:
          /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.4.0/src/objects/list.rs:154: Warnung: undefinierter Verweis auf »PyList_New«
          /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.4.0/src/objects/list.rs:157: Warnung: undefinierter Verweis auf »PyList_SetItem«
          /home/konsti/hyperjson/target/debug/deps/libhyperjson.rlib(hyperjson.1mbt5o6ghl58ds5f.rcgu.o): In Funktion »pyo3::objects::boolobject::<impl pyo3::conversion::ToPyObject for bool>::to_object«:
          /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.4.0/src/objects/boolobject.rs:(.text._ZN4pyo37objects10boolobject63_$LT$impl$u20$pyo3..conversion..ToPyObject$u20$for$u20$bool$GT$9to_object17h64341bf130ac6ebcE+0x16): Warnung: undefinierter Verweis auf »_Py_TrueStruct«
          /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.4.0/src/objects/boolobject.rs:(.text._ZN4pyo37objects10boolobject63_$LT$impl$u20$pyo3..conversion..ToPyObject$u20$for$u20$bool$GT$9to_object17h64341bf130ac6ebcE+0x24): Warnung: undefinierter Verweis auf »_Py_FalseStruct«
          /home/konsti/hyperjson/target/debug/deps/libhyperjson.rlib(hyperjson.1zwd8n7bcl3vhvvh.rcgu.o): In Funktion »pyo3::objects::tuple::<impl pyo3::conversion::IntoPyTuple for (A,)>::into_tuple«:
          /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.4.0/src/objects/tuple.rs:184: Warnung: undefinierter Verweis auf »PyTuple_New«
          /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.4.0/src/objects/tuple.rs:185: Warnung: undefinierter Verweis auf »PyTuple_SetItem«
          /home/konsti/hyperjson/target/debug/deps/libhyperjson.rlib(hyperjson.1zwd8n7bcl3vhvvh.rcgu.o): In Funktion »pyo3::objects::tuple::<impl pyo3::conversion::ToPyObject for (A, B, C)>::to_object«:
          /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.4.0/src/objects/tuple.rs:165: Warnung: undefinierter Verweis auf »PyTuple_New«
          /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.4.0/src/objects/tuple.rs:166: Warnung: undefinierter Verweis auf »PyTuple_SetItem«
          /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.4.0/src/objects/tuple.rs:166: Warnung: undefinierter Verweis auf »PyTuple_SetItem«
          /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.4.0/src/objects/tuple.rs:166: Warnung: undefinierter Verweis auf »PyTuple_SetItem«
          /home/konsti/hyperjson/target/debug/deps/libhyperjson.rlib(hyperjson.1zwd8n7bcl3vhvvh.rcgu.o): In Funktion »pyo3::objects::tuple::<impl pyo3::conversion::ToPyObject for (A, B, C)>::to_object«:
          /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.4.0/src/objects/tuple.rs:165: Warnung: undefinierter Verweis auf »PyTuple_New«
          /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.4.0/src/objects/tuple.rs:166: Warnung: undefinierter Verweis auf »PyTuple_SetItem«
          /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.4.0/src/objects/tuple.rs:166: Warnung: undefinierter Verweis auf »PyTuple_SetItem«
          /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.4.0/src/objects/tuple.rs:166: Warnung: undefinierter Verweis auf »PyTuple_SetItem«
          /home/konsti/hyperjson/target/debug/deps/libhyperjson.rlib(hyperjson.27kop7q9akdq42zc.rcgu.o): In Funktion »pyo3::objects::dict::PyDict::set_item::{{closure}}::{{closure}}«:
          /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.4.0/src/objects/dict.rs:89: Warnung: undefinierter Verweis auf »PyDict_SetItem«
          /home/konsti/hyperjson/target/debug/deps/libhyperjson.rlib(hyperjson.2k9pgpf8e3hg3tuh.rcgu.o): In Funktion »pyo3::python::Python::None«:
          /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.4.0/src/python.rs:226: Warnung: undefinierter Verweis auf »_Py_NoneStruct«
          /home/konsti/hyperjson/target/debug/deps/libhyperjson.rlib(hyperjson.2k9pgpf8e3hg3tuh.rcgu.o): In Funktion »pyo3::ffi3::object::Py_DECREF«:
          /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.4.0/src/ffi3/object.rs:795: Warnung: undefinierter Verweis auf »_Py_Dealloc«
          /home/konsti/hyperjson/target/debug/deps/libhyperjson.rlib(hyperjson.3gzcj4x2qer94nyt.rcgu.o): In Funktion »pyo3::buffer::PyBuffer::to_vec_impl«:
          /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.4.0/src/buffer.rs:511: Warnung: undefinierter Verweis auf »PyBuffer_ToContiguous«
          /home/konsti/hyperjson/target/debug/deps/libhyperjson.rlib(hyperjson.3qtv8tcqmzv2ik04.rcgu.o): In Funktion »pyo3::objects::list::<impl pyo3::conversion::ToPyObject for [T]>::to_object«:
          /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.4.0/src/objects/list.rs:154: Warnung: undefinierter Verweis auf »PyList_New«
          /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.4.0/src/objects/list.rs:157: Warnung: undefinierter Verweis auf »PyList_SetItem«
          /home/konsti/hyperjson/target/debug/deps/libhyperjson.rlib(hyperjson.4e425f9v4du09dxs.rcgu.o): In Funktion »pyo3::objects::num3::<impl pyo3::conversion::ToPyObject for u64>::to_object«:
          /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.4.0/src/objects/num3.rs:73: Warnung: undefinierter Verweis auf »PyLong_FromUnsignedLongLong«
          /home/konsti/hyperjson/target/debug/deps/libhyperjson.rlib(hyperjson.4pv07ddc1d0k149s.rcgu.o): In Funktion »pyo3::objects::iterator::PyIterator::from_object«:
          /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.4.0/src/objects/iterator.rs:24: Warnung: undefinierter Verweis auf »PyObject_GetIter«
          /home/konsti/hyperjson/target/debug/deps/libhyperjson.rlib(hyperjson.1h7gh96bi6br94hm.rcgu.o): In Funktion »pyo3::objects::sequence::PySequence::len«:
          /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.4.0/src/objects/sequence.rs:25: Warnung: undefinierter Verweis auf »PySequence_Size«
          /home/konsti/hyperjson/target/debug/deps/libhyperjson.rlib(hyperjson.3mhxbq8ufh6uodc4.rcgu.o): In Funktion »pyo3::ffi3::objectabstract::PyIter_Check«:
          /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.4.0/src/ffi3/objectabstract.rs:(.text._ZN4pyo34ffi314objectabstract12PyIter_Check17h0291c73f338700a4E+0x4a): Warnung: undefinierter Verweis auf »_PyObject_NextNotImplemented«
          /home/konsti/hyperjson/target/debug/deps/libpyo3-0afac51c0840a4c1.rlib(pyo3-0afac51c0840a4c1.pyo30.rcgu.o): In Funktion »pyo3::err::PyErr::occurred«:
          /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.4.0/src/err.rs:240: Warnung: undefinierter Verweis auf »PyErr_Occurred«
          /home/konsti/hyperjson/target/debug/deps/libpyo3-0afac51c0840a4c1.rlib(pyo3-0afac51c0840a4c1.pyo30.rcgu.o): In Funktion »pyo3::err::PyErr::fetch«:
          /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.4.0/src/err.rs:251: Warnung: undefinierter Verweis auf »PyErr_Fetch«
          /home/konsti/hyperjson/target/debug/deps/libpyo3-0afac51c0840a4c1.rlib(pyo3-0afac51c0840a4c1.pyo30.rcgu.o): In Funktion »pyo3::err::PyErr::print«:
          /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.4.0/src/err.rs:317: Warnung: undefinierter Verweis auf »PyErr_PrintEx«
          /home/konsti/hyperjson/target/debug/deps/libpyo3-0afac51c0840a4c1.rlib(pyo3-0afac51c0840a4c1.pyo30.rcgu.o): In Funktion »pyo3::err::PyErr::restore«:
          /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.4.0/src/err.rs:410: Warnung: undefinierter Verweis auf »PyErr_Restore«
          /home/konsti/hyperjson/target/debug/deps/libpyo3-0afac51c0840a4c1.rlib(pyo3-0afac51c0840a4c1.pyo30.rcgu.o): In Funktion »pyo3::err::panic_after_error«:
          /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.4.0/src/err.rs:602: Warnung: undefinierter Verweis auf »PyErr_Print«
          /home/konsti/hyperjson/target/debug/deps/libpyo3-0afac51c0840a4c1.rlib(pyo3-0afac51c0840a4c1.pyo31.rcgu.o): In Funktion »pyo3::objects::module::PyModule::import«:
          /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.4.0/src/objects/module.rs:35: Warnung: undefinierter Verweis auf »PyImport_ImportModule«
          /home/konsti/hyperjson/target/debug/deps/libpyo3-0afac51c0840a4c1.rlib(pyo3-0afac51c0840a4c1.pyo313.rcgu.o): In Funktion »<pyo3::objects::iterator::PyIterator<'p> as core::iter::iterator::Iterator>::next«:
          /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.4.0/src/objects/iterator.rs:47: Warnung: undefinierter Verweis auf »PyIter_Next«
          /home/konsti/hyperjson/target/debug/deps/libpyo3-0afac51c0840a4c1.rlib(pyo3-0afac51c0840a4c1.pyo313.rcgu.o): In Funktion »pyo3::ffi3::object::Py_DECREF«:
          /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.4.0/src/ffi3/object.rs:795: Warnung: undefinierter Verweis auf »_Py_Dealloc«
          /home/konsti/hyperjson/target/debug/deps/libpyo3-0afac51c0840a4c1.rlib(pyo3-0afac51c0840a4c1.pyo315.rcgu.o): In Funktion »pyo3::python::Python::None«:
          /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.4.0/src/python.rs:226: Warnung: undefinierter Verweis auf »_Py_NoneStruct«
          /home/konsti/hyperjson/target/debug/deps/libpyo3-0afac51c0840a4c1.rlib(pyo3-0afac51c0840a4c1.pyo315.rcgu.o): In Funktion »pyo3::ffi3::object::Py_DECREF«:
          /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.4.0/src/ffi3/object.rs:795: Warnung: undefinierter Verweis auf »_Py_Dealloc«
          /home/konsti/hyperjson/target/debug/deps/libpyo3-0afac51c0840a4c1.rlib(pyo3-0afac51c0840a4c1.pyo32.rcgu.o): In Funktion »pyo3::objects::num3::<impl pyo3::conversion::ToPyObject for u8>::to_object«:
          /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.4.0/src/objects/num3.rs:35: Warnung: undefinierter Verweis auf »PyLong_FromLong«
          /home/konsti/hyperjson/target/debug/deps/libpyo3-0afac51c0840a4c1.rlib(pyo3-0afac51c0840a4c1.pyo32.rcgu.o): In Funktion »pyo3::objects::num3::<impl pyo3::conversion::FromPyObject<'source> for u8>::extract«:
          /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.4.0/src/objects/num3.rs:105: Warnung: undefinierter Verweis auf »PyNumber_Index«
          /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.4.0/src/objects/num3.rs:105: Warnung: undefinierter Verweis auf »PyLong_AsLong«
          /home/konsti/hyperjson/target/debug/deps/libpyo3-0afac51c0840a4c1.rlib(pyo3-0afac51c0840a4c1.pyo32.rcgu.o): In Funktion »pyo3::ffi3::object::Py_DECREF«:
          /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.4.0/src/ffi3/object.rs:795: Warnung: undefinierter Verweis auf »_Py_Dealloc«
          /home/konsti/hyperjson/target/debug/deps/libpyo3-0afac51c0840a4c1.rlib(pyo3-0afac51c0840a4c1.pyo32.rcgu.o): In Funktion »pyo3::objects::num3::<impl pyo3::conversion::ToPyObject for i32>::to_object«:
          /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.4.0/src/objects/num3.rs:35: Warnung: undefinierter Verweis auf »PyLong_FromLong«
          /home/konsti/hyperjson/target/debug/deps/libpyo3-0afac51c0840a4c1.rlib(pyo3-0afac51c0840a4c1.pyo32.rcgu.o): In Funktion »pyo3::objects::num3::<impl pyo3::conversion::ToPyObject for i64>::to_object«:
          /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.4.0/src/objects/num3.rs:35: Warnung: undefinierter Verweis auf »PyLong_FromLong«
          /home/konsti/hyperjson/target/debug/deps/libpyo3-0afac51c0840a4c1.rlib(pyo3-0afac51c0840a4c1.pyo33.rcgu.o): In Funktion »<T as pyo3::objectprotocol::ObjectProtocol>::getattr::{{closure}}«:
          /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.4.0/src/objectprotocol.rs:220: Warnung: undefinierter Verweis auf »PyObject_GetAttr«
          /home/konsti/hyperjson/target/debug/deps/libpyo3-0afac51c0840a4c1.rlib(pyo3-0afac51c0840a4c1.pyo33.rcgu.o): In Funktion »pyo3::objects::dict::PyDict::new«:
          /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.4.0/src/objects/dict.rs:25: Warnung: undefinierter Verweis auf »PyDict_New«
          /home/konsti/hyperjson/target/debug/deps/libpyo3-0afac51c0840a4c1.rlib(pyo3-0afac51c0840a4c1.pyo34.rcgu.o): In Funktion »pyo3::objects::string::PyString::new«:
          /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.4.0/src/objects/string.rs:39: Warnung: undefinierter Verweis auf »PyUnicode_FromStringAndSize«
          /home/konsti/hyperjson/target/debug/deps/libpyo3-0afac51c0840a4c1.rlib(pyo3-0afac51c0840a4c1.pyo34.rcgu.o): In Funktion »pyo3::objects::string::PyString::data«:
          /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.4.0/src/objects/string.rs:63: Warnung: undefinierter Verweis auf »PyUnicode_AsUTF8AndSize«
          /home/konsti/hyperjson/target/debug/deps/libpyo3-0afac51c0840a4c1.rlib(pyo3-0afac51c0840a4c1.pyo34.rcgu.o): In Funktion »pyo3::pythonrun::prepare_freethreaded_python::{{closure}}«:
          /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.4.0/src/pythonrun.rs:39: Warnung: undefinierter Verweis auf »Py_IsInitialized«
          /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.4.0/src/pythonrun.rs:42: Warnung: undefinierter Verweis auf »PyEval_ThreadsInitialized«
          /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.4.0/src/pythonrun.rs:47: Warnung: undefinierter Verweis auf »PyEval_ThreadsInitialized«
          /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.4.0/src/pythonrun.rs:53: Warnung: undefinierter Verweis auf »Py_InitializeEx«
          /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.4.0/src/pythonrun.rs:54: Warnung: undefinierter Verweis auf »PyEval_InitThreads«
          /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.4.0/src/pythonrun.rs:59: Warnung: undefinierter Verweis auf »PyEval_SaveThread«
          /home/konsti/hyperjson/target/debug/deps/libpyo3-0afac51c0840a4c1.rlib(pyo3-0afac51c0840a4c1.pyo34.rcgu.o): In Funktion »<pyo3::pythonrun::GILGuard as core::ops::drop::Drop>::drop«:
          /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.4.0/src/pythonrun.rs:104: Warnung: undefinierter Verweis auf »PyGILState_Release«
          /home/konsti/hyperjson/target/debug/deps/libpyo3-0afac51c0840a4c1.rlib(pyo3-0afac51c0840a4c1.pyo34.rcgu.o): In Funktion »pyo3::ffi3::object::Py_DECREF«:
          /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.4.0/src/ffi3/object.rs:795: Warnung: undefinierter Verweis auf »_Py_Dealloc«
          /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.4.0/src/ffi3/object.rs:795: Warnung: undefinierter Verweis auf »_Py_Dealloc«
          /home/konsti/hyperjson/target/debug/deps/libpyo3-0afac51c0840a4c1.rlib(pyo3-0afac51c0840a4c1.pyo34.rcgu.o): In Funktion »pyo3::pythonrun::GILGuard::acquire«:
          /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.4.0/src/pythonrun.rs:263: Warnung: undefinierter Verweis auf »PyGILState_Ensure«
          /home/konsti/hyperjson/target/debug/deps/libpyo3-0afac51c0840a4c1.rlib(pyo3-0afac51c0840a4c1.pyo36.rcgu.o): In Funktion »pyo3::objects::exc::UnicodeDecodeError::new_err«:
          /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.4.0/src/objects/exc.rs:143: Warnung: undefinierter Verweis auf »PyUnicodeDecodeError_Create«
          /home/konsti/hyperjson/target/debug/deps/libpyo3-0afac51c0840a4c1.rlib(pyo3-0afac51c0840a4c1.pyo36.rcgu.o): In Funktion »pyo3::objects::floatob::PyFloat::new«:
          /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.4.0/src/objects/floatob.rs:29: Warnung: undefinierter Verweis auf »PyFloat_FromDouble«
          /home/konsti/hyperjson/target/debug/deps/libpyo3-0afac51c0840a4c1.rlib(pyo3-0afac51c0840a4c1.pyo36.rcgu.o): In Funktion »<pyo3::objects::sequence::PySequence as pyo3::conversion::PyTryFrom>::try_from«:
          /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.4.0/src/objects/sequence.rs:286: Warnung: undefinierter Verweis auf »PySequence_Check«
          /home/konsti/hyperjson/target/debug/deps/libpyo3-0afac51c0840a4c1.rlib(pyo3-0afac51c0840a4c1.pyo36.rcgu.o): In Funktion »<pyo3::objects::exc::BufferError as pyo3::typeob::PyTypeObject>::type_object«:
          /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.4.0/src/objects/exc.rs:45: Warnung: undefinierter Verweis auf »PyExc_BufferError«
          /home/konsti/hyperjson/target/debug/deps/libpyo3-0afac51c0840a4c1.rlib(pyo3-0afac51c0840a4c1.pyo36.rcgu.o): In Funktion »<pyo3::objects::exc::OverflowError as pyo3::typeob::PyTypeObject>::type_object«:
          /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.4.0/src/objects/exc.rs:45: Warnung: undefinierter Verweis auf »PyExc_OverflowError«
          /home/konsti/hyperjson/target/debug/deps/libpyo3-0afac51c0840a4c1.rlib(pyo3-0afac51c0840a4c1.pyo36.rcgu.o): In Funktion »<pyo3::objects::exc::SystemError as pyo3::typeob::PyTypeObject>::type_object«:
          /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.4.0/src/objects/exc.rs:45: Warnung: undefinierter Verweis auf »PyExc_SystemError«
          /home/konsti/hyperjson/target/debug/deps/libpyo3-0afac51c0840a4c1.rlib(pyo3-0afac51c0840a4c1.pyo36.rcgu.o): In Funktion »<pyo3::objects::exc::TypeError as pyo3::typeob::PyTypeObject>::type_object«:
          /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.4.0/src/objects/exc.rs:45: Warnung: undefinierter Verweis auf »PyExc_TypeError«
          /home/konsti/hyperjson/target/debug/deps/libpyo3-0afac51c0840a4c1.rlib(pyo3-0afac51c0840a4c1.pyo36.rcgu.o): In Funktion »<pyo3::objects::exc::ValueError as pyo3::typeob::PyTypeObject>::type_object«:
          /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.4.0/src/objects/exc.rs:45: Warnung: undefinierter Verweis auf »PyExc_ValueError«
          /home/konsti/hyperjson/target/debug/deps/libpyo3-0afac51c0840a4c1.rlib(pyo3-0afac51c0840a4c1.pyo39.rcgu.o): In Funktion »pyo3::buffer::PyBuffer::get«:
          /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.4.0/src/buffer.rs:171: Warnung: undefinierter Verweis auf »PyObject_GetBuffer«
          /home/konsti/hyperjson/target/debug/deps/libpyo3-0afac51c0840a4c1.rlib(pyo3-0afac51c0840a4c1.pyo39.rcgu.o): In Funktion »pyo3::buffer::PyBuffer::release«:
          /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.4.0/src/buffer.rs:589: Warnung: undefinierter Verweis auf »PyBuffer_Release«
          /home/konsti/hyperjson/target/debug/deps/libpyo3-0afac51c0840a4c1.rlib(pyo3-0afac51c0840a4c1.pyo39.rcgu.o): In Funktion »<pyo3::buffer::PyBuffer as core::ops::drop::Drop>::drop«:
          /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.4.0/src/buffer.rs:608: Warnung: undefinierter Verweis auf »PyBuffer_Release«
          collect2: error: ld returned 1 exit status
          

error: aborting due to previous error

error: Could not compile `hyperjson`.

To learn more, run the command again with --verbose.

This would be solved by allowing build scripts to define linker args that only apply to binaries or only to shared libraries.

Cargo version: cargo 1.29.0-nightly (2cd36b4ed 2018-07-25)

@alexcrichton alexcrichton added the C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` label Aug 10, 2018
@ehuss ehuss added the A-linkage Area: linker issues, dylib, cdylib, shared libraries, so label Nov 8, 2019
@epage
Copy link
Contributor

epage commented Oct 23, 2023

At first I thought this was going to be about #4349 but this is about BIN_RUSTFLAGS vs LIB_RUSTFLAGS which can both be root crates.

@epage epage added the S-needs-team-input Status: Needs input from team on whether/how to proceed. label Oct 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-linkage Area: linker issues, dylib, cdylib, shared libraries, so C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` S-needs-team-input Status: Needs input from team on whether/how to proceed.
Projects
None yet
Development

No branches or pull requests

4 participants