cc
failed: exit code: 1...
"/Users/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcompiler_builtins-35232c4af1148867.rlib" "-lSystem" "-lresolv" "-lc" "-lm" "-dynamiclib" "-Wl,-dylib"
"_PyGILState_Ensure", referenced from:
cpython::pythonrun::GILGuard::acquire::h5d9105c4ec778456 in libcpython-bb286e0f8eea1bd6.rlib(cpython-bb286e0f8eea1bd6.cpython.1n9xevhm-cgu.5.rcgu.o)
"_Py_IsInitialized", referenced from:
cpython::pythonrun::prepare_freethreaded_python::_$u7b$$u7b$closure$u7d$$u7d$::h36005de61bc73817 in libcpython-bb286e0f8eea1bd6.rlib(cpython-bb286e0f8eea1bd6.cpython.1n9xevhm-cgu.5.rcgu.o)
"_Py_InitializeEx", referenced from:
cpython::pythonrun::prepare_freethreaded_python::_$u7b$$u7b$closure$u7d$$u7d$::h36005de61bc73817 in libcpython-bb286e0f8eea1bd6.rlib(cpython-bb286e0f8eea1bd6.cpython.1n9xevhm-cgu.5.rcgu.o)
"_PyExc_TypeError", referenced from:
_$LT$cpython..objects..exc..TypeError$u20$as$u20$cpython..python..PythonObjectWithTypeObject$GT$::type_object::hcbe2b62528903270 in libcpython-bb286e0f8eea1bd6.rlib(cpython-bb286e0f8eea1bd6.cpython.1n9xevhm-cgu.2.rcgu.o)
"_PyEval_ThreadsInitialized", referenced from:
cpython::pythonrun::prepare_freethreaded_python::_$u7b$$u7b$closure$u7d$$u7d$::h36005de61bc73817 in libcpython-bb286e0f8eea1bd6.rlib(cpython-bb286e0f8eea1bd6.cpython.1n9xevhm-cgu.5.rcgu.o)
"_PyDict_Next", referenced from:
cpython::objects::dict::PyDict::items::he1515b7b41c2e175 in libcpython-bb286e0f8eea1bd6.rlib(cpython-bb286e0f8eea1bd6.cpython.1n9xevhm-cgu.2.rcgu.o)
"_PyModule_Type", referenced from:
_$LT$cpython..objects..module..PyModule$u20$as$u20$cpython..python..PythonObjectWithCheckedDowncast$GT$::downcast_from::h987bc9e7dbf35530 in libcpython-bb286e0f8eea1bd6.rlib(cpython-bb286e0f8eea1bd6.cpython.1n9xevhm-cgu.13.rcgu.o)
"_PyErr_Print", referenced from:
cpython::err::panic_after_error::h7734eef80b89461e in libcpython-bb286e0f8eea1bd6.rlib(cpython-bb286e0f8eea1bd6.cpython.1n9xevhm-cgu.4.rcgu.o)
"_PyDict_GetItem", referenced from:
cpython::objects::dict::PyDict::get_item::_$u7b$$u7b$closure$u7d$$u7d$::h57b4a830f902b7e4 in libcpython-bb286e0f8eea1bd6.rlib(cpython-bb286e0f8eea1bd6.cpython.1n9xevhm-cgu.2.rcgu.o)
"_PyLong_FromUnsignedLongLong", referenced from:
cpython::objects::num::_$LT$impl$u20$cpython..conversion..ToPyObject$u20$for$u20$u64$GT$::to_py_object::h0bfaf3c8ab3b3312 in libcpython-bb286e0f8eea1bd6.rlib(cpython-bb286e0f8eea1bd6.cpython.1n9xevhm-cgu.15.rcgu.o)
"_PyModule_Create2", referenced from:
python3_sys::modsupport::PyModule_Create::hd1dadf4f0d5ba512 in libcpython-bb286e0f8eea1bd6.rlib(cpython-bb286e0f8eea1bd6.cpython.1n9xevhm-cgu.2.rcgu.o)
"_PyObject_SetAttr", referenced from:
cpython::objectprotocol::ObjectProtocol::setattr::_$u7b$$u7b$closure$u7d$$u7d$::_$u7b$$u7b$closure$u7d$$u7d$::h6b93663c35ca1e4e in rust_bindings.294h0q408pvbnoze.rcgu.o
"_PyUnicode_AsUTF8AndSize", referenced from:
cpython::objects::string::PyString::data_impl::h4b32139303e1ec11 in libcpython-bb286e0f8eea1bd6.rlib(cpython-bb286e0f8eea1bd6.cpython.1n9xevhm-cgu.9.rcgu.o)
"_PyUnicode_FromStringAndSize", referenced from:
cpython::objects::string::PyString::new::new_impl::hf45c1a79d8223ee9 in libcpython-bb286e0f8eea1bd6.rlib(cpython-bb286e0f8eea1bd6.cpython.1n9xevhm-cgu.9.rcgu.o)
"_PyExc_UnicodeDecodeError", referenced from:
_$LT$cpython..objects..exc..UnicodeDecodeError$u20$as$u20$cpython..python..PythonObjectWithCheckedDowncast$GT$::downcast_from::h1722cd258436f850 in libcpython-bb286e0f8eea1bd6.rlib(cpython-bb286e0f8eea1bd6.cpython.1n9xevhm-cgu.2.rcgu.o)
"_PyCFunction_NewEx", referenced from:
cpython::function::py_fn_impl::ha3b678379f9c466f in libcpython-bb286e0f8eea1bd6.rlib(cpython-bb286e0f8eea1bd6.cpython.1n9xevhm-cgu.3.rcgu.o)
"_PyUnicodeDecodeError_Create", referenced from:
cpython::objects::exc::UnicodeDecodeError::new::h1de774c6719b332c in libcpython-bb286e0f8eea1bd6.rlib(cpython-bb286e0f8eea1bd6.cpython.1n9xevhm-cgu.2.rcgu.o)
"_PyErr_Fetch", referenced from:
cpython::err::PyErr::fetch::h5ce5d83e33a9d5f0 in libcpython-bb286e0f8eea1bd6.rlib(cpython-bb286e0f8eea1bd6.cpython.1n9xevhm-cgu.4.rcgu.o)
"_PyErr_Restore", referenced from:
cpython::err::PyErr::restore::h6b8e0ff92a83dbdf in rust_bindings.510youx40d1lskcb.rcgu.o
cpython::err::PyErr::restore::h97940e90eef0375b in libcpython-bb286e0f8eea1bd6.rlib(cpython-bb286e0f8eea1bd6.cpython.1n9xevhm-cgu.4.rcgu.o)
"__Py_Dealloc", referenced from:
_$LT$T$u20$as$u20$cpython..python..PyDrop$GT$::release_ref::hf77b969aade7107b in rust_bindings.2suf8et7itskf9vu.rcgu.o
_$LT$T$u20$as$u20$cpython..python..PyDrop$GT$::release_ref::h661bf78a05311f89 in rust_bindings.2v1weyvw3b7mhwth.rcgu.o
_$LT$T$u20$as$u20$cpython..python..PyDrop$GT$::release_ref::hb380990e69b08b9f in libcpython-bb286e0f8eea1bd6.rlib(cpython-bb286e0f8eea1bd6.cpython.1n9xevhm-cgu.3.rcgu.o)
_$LT$cpython..objects..object..PyObject$u20$as$u20$core..ops..drop..Drop$GT$::drop::h70e3f1960b057f37 in libcpython-bb286e0f8eea1bd6.rlib(cpython-bb286e0f8eea1bd6.cpython.1n9xevhm-cgu.3.rcgu.o)
"_PyExc_SystemError", referenced from:
cpython::function::handle_panic::h323073e26a8499e3 in libcpython-bb286e0f8eea1bd6.rlib(cpython-bb286e0f8eea1bd6.cpython.1n9xevhm-cgu.3.rcgu.o)
_$LT$cpython..objects..exc..SystemError$u20$as$u20$cpython..python..PythonObjectWithTypeObject$GT$::type_object::ha412729647de6a34 in libcpython-bb286e0f8eea1bd6.rlib(cpython-bb286e0f8eea1bd6.cpython.1n9xevhm-cgu.2.rcgu.o)
"_PyErr_SetString", referenced from:
cpython::function::handle_panic::h323073e26a8499e3 in libcpython-bb286e0f8eea1bd6.rlib(cpython-bb286e0f8eea1bd6.cpython.1n9xevhm-cgu.3.rcgu.o)
"_PyType_IsSubtype", referenced from:
_$LT$cpython..objects..exc..UnicodeDecodeError$u20$as$u20$cpython..python..PythonObjectWithCheckedDowncast$GT$::downcast_from::h1722cd258436f850 in libcpython-bb286e0f8eea1bd6.rlib(cpython-bb286e0f8eea1bd6.cpython.1n9xevhm-cgu.2.rcgu.o)
_$LT$cpython..objects..module..PyModule$u20$as$u20$cpython..python..PythonObjectWithCheckedDowncast$GT$::downcast_from::h987bc9e7dbf35530 in libcpython-bb286e0f8eea1bd6.rlib(cpython-bb286e0f8eea1bd6.cpython.1n9xevhm-cgu.13.rcgu.o)
"_PyErr_PrintEx", referenced from:
cpython::err::PyErr::print::he92fc8ad5554de52 in libcpython-bb286e0f8eea1bd6.rlib(cpython-bb286e0f8eea1bd6.cpython.1n9xevhm-cgu.4.rcgu.o)
"_PyGILState_Release", referenced from:
_$LT$cpython..pythonrun..GILGuard$u20$as$u20$core..ops..drop..Drop$GT$::drop::hb136c7bc4f6eec1b in libcpython-bb286e0f8eea1bd6.rlib(cpython-bb286e0f8eea1bd6.cpython.1n9xevhm-cgu.5.rcgu.o)
"_PyEval_SaveThread", referenced from:
cpython::pythonrun::prepare_freethreaded_python::_$u7b$$u7b$closure$u7d$$u7d$::h36005de61bc73817 in libcpython-bb286e0f8eea1bd6.rlib(cpython-bb286e0f8eea1bd6.cpython.1n9xevhm-cgu.5.rcgu.o)
"_PyDict_Size", referenced from:
cpython::objects::dict::PyDict::len::hde84f2cf2aff77a3 in libcpython-bb286e0f8eea1bd6.rlib(cpython-bb286e0f8eea1bd6.cpython.1n9xevhm-cgu.2.rcgu.o)
"_PyEval_InitThreads", referenced from:
cpython::py_module_initializer_impl::ha26bb6c638c8c914 in libcpython-bb286e0f8eea1bd6.rlib(cpython-bb286e0f8eea1bd6.cpython.1n9xevhm-cgu.6.rcgu.o)
cpython::pythonrun::prepare_freethreaded_python::_$u7b$$u7b$closure$u7d$$u7d$::h36005de61bc73817 in libcpython-bb286e0f8eea1bd6.rlib(cpython-bb286e0f8eea1bd6.cpython.1n9xevhm-cgu.5.rcgu.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Created functionality to for rust binding to python using cpython crate. But on creating the build it throws the error for linking with 'cc' failed.
Any reason you believe this to be a bug in rustc and not in your environment or the cpython
crate?
creating build with the cargo.toml as :
[dependencies]
cpython = "0.2"
works fine
But updating the same to
[dependencies.cpython]
version = "0.2"
features = ["extension-module"]
throws error #error: linking with cc failed: exit code: 1
MacBook-Pro:rust_to_python $ cargo build
Compiling cpython v0.2.1
Compiling python3-sys v0.2.1
Compiling rust_to_python v0.1.0 (/Users/Projects/demoPojects/Rust/rust_to_python)
error: linking with cc
failed: exit code: 1
|
= note: "cc" "-m64" "-L" ".....
Have you read the last part of the cpython readme?
On windows and linux, you can build normally with cargo build --release. On Mac Os, you need to set additional linker arguments. The simplest solution is to create a
.cargo/config
with the following content:
[target.x86_64-apple-darwin]
rustflags = [
"-C", "link-arg=-undefined",
"-C", "link-arg=dynamic_lookup",
]
GREAT, it worked.
you don't install toolchain ,please exec this commond to install “ xcode-select --install ”
If You are Mac user then try below command into terminal,
xcode-select --install
I have tried for Mac and now my rust is started using it.....
After. updating the OS from 10.12 to 10.14 Catalina then I have started getting this issue, So to solve this incompatible issue I have updated my Xcode developer kit using. below command and its started working out, so please try it once, I have tried and its solved now...I can execute my cargo and its working as expected
xcode-select --install
Most helpful comment
Have you read the last part of the cpython readme?