Closed apocalotus closed 1 year ago
Check your Python environment and probably look up some pyo3 docs here.
Check your Python environment and probably look up some pyo3 docs here.
Thanks! I figured it out by using maturin to build the module. Still, there are unknown problems while building mannually, and for anyone running into the error please try this workaround.
Hi! When I try to build libriichi module, the compilation stops at the link stage and returns a very long linker error message. I compile this code on Linux. I find that this error is related to pyo3's feature extension module, since when disabling this feature, cargo can build or test smoothly. Also, this linker erro only occurs in linux environment, and everything is fine when building libriichi on my windows system. Did you run into the same problem, and can you help me with that? Thank you very much
error: linking with
cc
failed: exit status: 1 | = note: "cc" "-m64" "/tmp/rustcPH0w39/symbols.o" "/home/zcwang/riichi/Mortal/target/debug/deps/validate_logs-4c192e21484bc300.10v5efmy67kgnpfa.rcgu.o" "/home/zcwang/riichi/Mortal/target/debug/deps/validate_logs-4c192e21484bc300.13ofdr15yow88mrx.rcgu.o" "/home/zcwang/riichi/Mortal/target/debug/deps/validate_logs-4c192e21484bc300.17mqin63awxyphus.rcgu.o" "/home/zcwang/riichi/Mortal/target/debug/deps/validate_logs-4c192e21484bc300.18a77o4x61eeizd.rcgu.o" "/home/zcwang/riichi/Mortal/target/debug/deps/validate_logs-4c192e21484bc300.1ctjkrd5bqnxird4.rcgu.o" "/home/zcwang/riichi/Mortal/target/debug/deps/validate_logs-4c192e21484bc300.1g8g6r00hn6k1dky.rcgu.o" "/home/zcwang/riichi/Mortal/target/debug/deps/validate_logs-4c192e21484bc300.1gq3as0zljndkm50.rcgu.o" "/home/zcwang/riichi/Mortal/target/debug/deps/validate_logs-4c192e21484bc300.1iqnz75m4nq7ecb8.rcgu.o" "/home/zcwang/riichi/Mortal/target/debug/deps/validate_logs-4c192e21484bc300.1k78n75cuy8wtllt.rcgu.o" "/home/zcwang/riichi/Mortal/target/debug/deps/validate_logs-4c192e21484bc300.1ldm5a1reef9zwwg.rcgu.o" "/home/zcwang/riichi/Mortal/target/debug/deps/validate_logs-4c192e21484bc300.1lz2wjxnc410lpsx.rcgu.o" "/home/zcwang/riichi/Mortal/target/debug/deps/validate_logs-4c192e21484bc300.1noref0ejh9vm4g9.rcgu.o" "/home/zcwang/riichi/Mortal/target/debug/deps/validate_logs-4c192e21484bc300.1pj1dmktnrd3wiz2.rcgu.o" "/home/zcwang/riichi/Mortal/target/debug/deps/validate_logs-4c192e21484bc300.1shna44j1h84y18i.rcgu.o" "/home/zcwang/riichi/Mortal/target/debug/deps/validate_logs-4c192e21484bc300.1t4qa9y1pb1q0xub.rcgu.o" "/home/zcwang/riichi/Mortal/target/debug/deps/validate_logs-4c192e21484bc300.1uxsj5jzdc0wgjpx.rcgu.o" "/home/zcwang/riichi/Mortal/target/debug/deps/validate_logs-4c192e21484bc300.1wtvk7r7zldukbki.rcgu.o" "/home/zcwang/riichi/Mortal/target/debug/deps/validate_logs-4c192e21484bc300.1xhvg7r6rgkfzw5n.rcgu.o" "/home/zcwang/riichi/Mortal/target/debug/deps/validate_logs-4c192e21484bc300.20n0tbpx2vx07bp5.rcgu.o" "/home/zcwang/riichi/Mortal/target/debug/deps/validate_logs-4c192e21484bc300.22zn4i7ubkvg1yqb.rcgu.o" "/home/zcwang/riichi/Mortal/target/debug/deps/validate_logs-4c192e21484bc300.24oxszmnamx0aq2l.rcgu.o" "/home/zcwang/riichi/Mortal/target/debug/deps/validate_logs-4c192e21484bc300.29fh9pi8e6uxgphy.rcgu.o" "/home/zcwang/riichi/Mortal/target/debug/deps/validate_logs-4c192e21484bc300.2d66fxm448jtgoqk.rcgu.o" "/home/zcwang/riichi/Mortal/target/debug/deps/validate_logs-4c192e21484bc300.2e0jcq6hho2wjd4.rcgu.o" "/home/zcwang/riichi/Mortal/target/debug/deps/validate_logs-4c192e21484bc300.2hw18hkilahqahl4.rcgu.o" "/home/zcwang/riichi/Mortal/target/debug/deps/validate_logs-4c192e21484bc300.2ik26157irjegx3b.rcgu.o" "/home/zcwang/riichi/Mortal/target/debug/deps/validate_logs-4c192e21484bc300.2kmprtcc8x97zsm2.rcgu.o" "/home/zcwang/riichi/Mortal/target/debug/deps/validate_logs-4c192e21484bc300.2rr4x0opbwooo8bq.rcgu.o" "/home/zcwang/riichi/Mortal/target/debug/deps/validate_logs-4c192e21484bc300.2x575inubnfetg3l.rcgu.o" "/home/zcwang/riichi/Mortal/target/debug/deps/validate_logs-4c192e21484bc300.2zk9exuhzqqaytil.rcgu.o" "/home/zcwang/riichi/Mortal/target/debug/deps/validate_logs-4c192e21484bc300.30e27ottgo2yahe0.rcgu.o" "/home/zcwang/riichi/Mortal/target/debug/deps/validate_logs-4c192e21484bc300.38h8nf3clxwvm4i3.rcgu.o" "/home/zcwang/riichi/Mortal/target/debug/deps/validate_logs-4c192e21484bc300.3aa8vd496gb7xe2v.rcgu.o" "/home/zcwang/riichi/Mortal/target/debug/deps/validate_logs-4c192e21484bc300.3anhchmfd2t1jnjf.rcgu.o" "/home/zcwang/riichi/Mortal/target/debug/deps/validate_logs-4c192e21484bc300.3fyiyy5i10hw94uz.rcgu.o" "/home/zcwang/riichi/Mortal/target/debug/deps/validate_logs-4c192e21484bc300.3je8xugqv3qnqs8a.rcgu.o" "/home/zcwang/riichi/Mortal/target/debug/deps/validate_logs-4c192e21484bc300.3jgafmcuht3arg11.rcgu.o" "/home/zcwang/riichi/Mortal/target/debug/deps/validate_logs-4c192e21484bc300.3n3r256431mwe2b0.rcgu.o" "/home/zcwang/riichi/Mortal/target/debug/deps/validate_logs-4c192e21484bc300.3ymdntaf4ywyqhqg.rcgu.o" "/home/zcwang/riichi/Mortal/target/debug/deps/validate_logs-4c192e21484bc300.44jq980p8p1wo0mm.rcgu.o" "/home/zcwang/riichi/Mortal/target/debug/deps/validate_logs-4c192e21484bc300.46a4fijgc9tf3erw.rcgu.o" "/home/zcwang/riichi/Mortal/target/debug/deps/validate_logs-4c192e21484bc300.4790rjuaimaiix6r.rcgu.o" "/home/zcwang/riichi/Mortal/target/debug/deps/validate_logs-4c192e21484bc300.498su1d4jcp3nkt3.rcgu.o" "/home/zcwang/riichi/Mortal/target/debug/deps/validate_logs-4c192e21484bc300.49gwllk0h9l3e6rr.rcgu.o" "/home/zcwang/riichi/Mortal/target/debug/deps/validate_logs-4c192e21484bc300.4apksw1au7z3knah.rcgu.o" "/home/zcwang/riichi/Mortal/target/debug/deps/validate_logs-4c192e21484bc300.4cblk16be8ui10nh.rcgu.o" "/home/zcwang/riichi/Mortal/target/debug/deps/validate_logs-4c192e21484bc300.4d53jrlx3hg9750o.rcgu.o" "/home/zcwang/riichi/Mortal/target/debug/deps/validate_logs-4c192e21484bc300.4h7ag912qg1w5q1k.rcgu.o" "/home/zcwang/riichi/Mortal/target/debug/deps/validate_logs-4c192e21484bc300.4iqc8jn2nwg5gxnr.rcgu.o" "/home/zcwang/riichi/Mortal/target/debug/deps/validate_logs-4c192e21484bc300.4m72ma58cgwle6k5.rcgu.o" "/home/zcwang/riichi/Mortal/target/debug/deps/validate_logs-4c192e21484bc300.4sxlyijxfshcxbgu.rcgu.o" "/home/zcwang/riichi/Mortal/target/debug/deps/validate_logs-4c192e21484bc300.4tsg4mzo7mffj5mt.rcgu.o" "/home/zcwang/riichi/Mortal/target/debug/deps/validate_logs-4c192e21484bc300.4uyigpg14bqri04g.rcgu.o" "/home/zcwang/riichi/Mortal/target/debug/deps/validate_logs-4c192e21484bc300.58eyz3gymszkanbq.rcgu.o" "/home/zcwang/riichi/Mortal/target/debug/deps/validate_logs-4c192e21484bc300.5ffprosdt517v0j1.rcgu.o" "/home/zcwang/riichi/Mortal/target/debug/deps/validate_logs-4c192e21484bc300.5fziidf7ilpt031n.rcgu.o" "/home/zcwang/riichi/Mortal/target/debug/deps/validate_logs-4c192e21484bc300.7zlp9fvs3ql0cdh.rcgu.o" "/home/zcwang/riichi/Mortal/target/debug/deps/validate_logs-4c192e21484bc300.92et92jl4dksrna.rcgu.o" "/home/zcwang/riichi/Mortal/target/debug/deps/validate_logs-4c192e21484bc300.bu0ccgjk85acmuf.rcgu.o" "/home/zcwang/riichi/Mortal/target/debug/deps/validate_logs-4c192e21484bc300.dqioxsykxdnemti.rcgu.o" "/home/zcwang/riichi/Mortal/target/debug/deps/validate_logs-4c192e21484bc300.gci44w1mfywgw5l.rcgu.o" "/home/zcwang/riichi/Mortal/target/debug/deps/validate_logs-4c192e21484bc300.i94usgo17uc5sqa.rcgu.o" "/home/zcwang/riichi/Mortal/target/debug/deps/validate_logs-4c192e21484bc300.jiguoa08gxk0xob.rcgu.o" "/home/zcwang/riichi/Mortal/target/debug/deps/validate_logs-4c192e21484bc300.ki1fge18g8g0ots.rcgu.o" "/home/zcwang/riichi/Mortal/target/debug/deps/validate_logs-4c192e21484bc300.krt4f04ycmkwsfs.rcgu.o" "/home/zcwang/riichi/Mortal/target/debug/deps/validate_logs-4c192e21484bc300.o3yw41oy9xssd0i.rcgu.o" "/home/zcwang/riichi/Mortal/target/debug/deps/validate_logs-4c192e21484bc300.pvvloaj5xpcywy3.rcgu.o" "/home/zcwang/riichi/Mortal/target/debug/deps/validate_logs-4c192e21484bc300.sjl10va7ewhyxih.rcgu.o" "/home/zcwang/riichi/Mortal/target/debug/deps/validate_logs-4c192e21484bc300.wd95pbxwi11539u.rcgu.o" "/home/zcwang/riichi/Mortal/target/debug/deps/validate_logs-4c192e21484bc300.3wrud4jobickhfii.rcgu.o" "-Wl,--as-needed" "-L" "/home/zcwang/riichi/Mortal/target/debug/deps" "-L" "/home/zcwang/riichi/Mortal/target/debug/build/libmimalloc-sys-6e38240a4e3aa23f/out" "-L" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/home/zcwang/riichi/Mortal/target/debug/deps/libriichi.rlib" "/home/zcwang/riichi/Mortal/target/debug/deps/libpyo3_log-8dcda3a1ac38e31d.rlib" "/home/zcwang/riichi/Mortal/target/debug/deps/libarc_swap-e1fdd8e3f9170c99.rlib" "/home/zcwang/riichi/Mortal/target/debug/deps/libmimalloc-4c0b48abe61389a7.rlib" "/home/zcwang/riichi/Mortal/target/debug/deps/liblibmimalloc_sys-68d9ad77157f3561.rlib" "/home/zcwang/riichi/Mortal/target/debug/deps/libbyteorder-5f7435338104d45b.rlib" "/home/zcwang/riichi/Mortal/target/debug/deps/libboomphf-2ef9f47145aeadb5.rlib" "/home/zcwang/riichi/Mortal/target/debug/deps/libwyhash-db52949e4468a1ba.rlib" "/home/zcwang/riichi/Mortal/target/debug/deps/liblog-9ba82ae789949f1a.rlib" "/home/zcwang/riichi/Mortal/target/debug/deps/libglob-09d67aea6e036533.rlib" "/home/zcwang/riichi/Mortal/target/debug/deps/libserde_with-a08bcdc2650f9f08.rlib" "/home/zcwang/riichi/Mortal/target/debug/deps/libnumpy-e55762671f6be14d.rlib" "/home/zcwang/riichi/Mortal/target/debug/deps/librustc_hash-dba33981d384e54c.rlib" "/home/zcwang/riichi/Mortal/target/debug/deps/libahash-56c084b50baf3c4e.rlib" "/home/zcwang/riichi/Mortal/target/debug/deps/libonce_cell-406ec8035d14a065.rlib" "/home/zcwang/riichi/Mortal/target/debug/deps/libserde_json-4996a893a2b68b60.rlib" "/home/zcwang/riichi/Mortal/target/debug/deps/libryu-0b5fa5715bb0d01a.rlib" "/home/zcwang/riichi/Mortal/target/debug/deps/libitoa-7b8a3ee6006bf7d8.rlib" "/home/zcwang/riichi/Mortal/target/debug/deps/libpyo3-365fe8b69d5212bb.rlib" "/home/zcwang/riichi/Mortal/target/debug/deps/libparking_lot-66101a7ea323d866.rlib" "/home/zcwang/riichi/Mortal/target/debug/deps/libparking_lot_core-a566e571b8028509.rlib" "/home/zcwang/riichi/Mortal/target/debug/deps/libsmallvec-eff21c5aff60ab5c.rlib" "/home/zcwang/riichi/Mortal/target/debug/deps/liblock_api-085ab99679bcd5c0.rlib" "/home/zcwang/riichi/Mortal/target/debug/deps/libpyo3_ffi-c2ac8ce566c6b819.rlib" "/home/zcwang/riichi/Mortal/target/debug/deps/libinventory-869aa4ad51c25b87.rlib" "/home/zcwang/riichi/Mortal/target/debug/deps/libunindent-4711929fc6abf911.rlib" "/home/zcwang/riichi/Mortal/target/debug/deps/libflate2-1ada63e168383969.rlib" "/home/zcwang/riichi/Mortal/target/debug/deps/libminiz_oxide-dadb4324db4b23c8.rlib" "/home/zcwang/riichi/Mortal/target/debug/deps/libadler-c379f1fd15ae26d4.rlib" "/home/zcwang/riichi/Mortal/target/debug/deps/libcrc32fast-85506f1f6fc33fcf.rlib" "/home/zcwang/riichi/Mortal/target/debug/deps/libindicatif-5baf76df4c9b2d7a.rlib" "/home/zcwang/riichi/Mortal/target/debug/deps/libportable_atomic-ae2d1f307fd78b73.rlib" "/home/zcwang/riichi/Mortal/target/debug/deps/librayon-9bdba68f95147a8c.rlib" "/home/zcwang/riichi/Mortal/target/debug/deps/librayon_core-7cd1fa23c3c6358d.rlib" "/home/zcwang/riichi/Mortal/target/debug/deps/libnum_cpus-61fb7447d47ff89b.rlib" "/home/zcwang/riichi/Mortal/target/debug/deps/libcrossbeam_deque-78883dc4f04621e3.rlib" "/home/zcwang/riichi/Mortal/target/debug/deps/libcrossbeam_epoch-d9f7e1e048644832.rlib" "/home/zcwang/riichi/Mortal/target/debug/deps/libmemoffset-e7ef8e5a73af8af8.rlib" "/home/zcwang/riichi/Mortal/target/debug/deps/libscopeguard-7001a141a39e01e2.rlib" "/home/zcwang/riichi/Mortal/target/debug/deps/libcrossbeam_channel-d3df9c01e90b4fc8.rlib" "/home/zcwang/riichi/Mortal/target/debug/deps/libcrossbeam_utils-df9ff32d998ccc95.rlib" "/home/zcwang/riichi/Mortal/target/debug/deps/libeither-494454c5804442fc.rlib" "/home/zcwang/riichi/Mortal/target/debug/deps/libnumber_prefix-6163d702f4a62401.rlib" "/home/zcwang/riichi/Mortal/target/debug/deps/libconsole-7c78ce8282e00882.rlib" "/home/zcwang/riichi/Mortal/target/debug/deps/libunicode_width-7617736720435385.rlib" "/home/zcwang/riichi/Mortal/target/debug/deps/liblazy_static-b8e931bc1934af0c.rlib" "/home/zcwang/riichi/Mortal/target/debug/deps/libtinyvec-865a77be667159b8.rlib" "/home/zcwang/riichi/Mortal/target/debug/deps/libtinyvec_macros-3d7b4db04965d89a.rlib" "/home/zcwang/riichi/Mortal/target/debug/deps/libserde-31053e9ceccc8acb.rlib" "/home/zcwang/riichi/Mortal/target/debug/deps/libsha3-d36e6281b575e45c.rlib" "/home/zcwang/riichi/Mortal/target/debug/deps/libkeccak-51ee9301273e298f.rlib" "/home/zcwang/riichi/Mortal/target/debug/deps/libdigest-0af189b3f3bb8008.rlib" "/home/zcwang/riichi/Mortal/target/debug/deps/libblock_buffer-ba4f8cb1f6991d67.rlib" "/home/zcwang/riichi/Mortal/target/debug/deps/libcrypto_common-f1020b06d07e922c.rlib" "/home/zcwang/riichi/Mortal/target/debug/deps/libgeneric_array-b9b323084fc006c6.rlib" "/home/zcwang/riichi/Mortal/target/debug/deps/libtypenum-64711f45ff693bd7.rlib" "/home/zcwang/riichi/Mortal/target/debug/deps/librand-cf793c220e4ffe2c.rlib" "/home/zcwang/riichi/Mortal/target/debug/deps/librand_chacha-d22f03fe1ace7757.rlib" "/home/zcwang/riichi/Mortal/target/debug/deps/libppv_lite86-e7978653219548f0.rlib" "/home/zcwang/riichi/Mortal/target/debug/deps/librand_core-13020919910cf3ba.rlib" "/home/zcwang/riichi/Mortal/target/debug/deps/libgetrandom-9cd8334c95dec545.rlib" "/home/zcwang/riichi/Mortal/target/debug/deps/liblibc-8212084bd967f467.rlib" "/home/zcwang/riichi/Mortal/target/debug/deps/libcfg_if-06b0b01aa334fc1b.rlib" "/home/zcwang/riichi/Mortal/target/debug/deps/libndarray-67ad3167c8027991.rlib" "/home/zcwang/riichi/Mortal/target/debug/deps/libmatrixmultiply-1c42e633fb8d8839.rlib" "/home/zcwang/riichi/Mortal/target/debug/deps/libnum_complex-e9e5cea14ba58d63.rlib" "/home/zcwang/riichi/Mortal/target/debug/deps/libnum_integer-39e365f965ea383a.rlib" "/home/zcwang/riichi/Mortal/target/debug/deps/libnum_traits-b469ff2240fcf287.rlib" "/home/zcwang/riichi/Mortal/target/debug/deps/librawpointer-97946820b0d25a50.rlib" "/home/zcwang/riichi/Mortal/target/debug/deps/libanyhow-2bfd9dc32153eec0.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-cc54747a4cc2b42a.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-64c2149e46f4b352.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libobject-b2c727373694f03a.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libmemchr-2a47a846ca0c41be.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libaddr2line-794a77eb0c487d83.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgimli-23c4931a4edea386.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-1e140f87d627e46d.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd_detect-f396ed5291fd3454.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-401d7002ec69df8e.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libminiz_oxide-afcf3708f7250165.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libadler-afb73f721c839ff5.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-1e56c8705be9ad51.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-c2085ef1fa30c0b6.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-b1838ea366d802c9.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-6d5e9308242df554.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-922a5da03a4b65c7.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-e0c666df99a8c710.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-9550e2105c24ab24.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-3f7dd70c559ae534.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-znoexecstack" "-L" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/home/zcwang/riichi/Mortal/target/debug/deps/validate_logs-4c192e21484bc300" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro,-znow" "-nodefaultlibs" = note: /usr/bin/ld: /home/zcwang/riichi/Mortal/target/debug/deps/libriichi.rlib(riichi.1tccjjd3b9609jl1.rcgu.o): in functionpyo3::types::string::PyString::to_str': /home/zcwang/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.19.0/src/types/string.rs:189: undefined reference to
PyUnicode_AsUTF8AndSize' /usr/bin/ld: /home/zcwang/riichi/Mortal/target/debug/deps/libriichi.rlib(riichi.1tccjjd3b9609jl1.rcgu.o): in function `pyo3_ffi::object::PyObject_TypeCheck':= help: 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 thecargo:rustc-link-lib
directive to specify the native libraries to link with Cargo (see https://doc.rust-lang.org/cargo/reference/build-scripts.html#cargorustc-link-libkindname)error: could not compile
libriichi
due to previous error