guillaume-be / rust-bert

Rust native ready-to-use NLP pipelines and transformer-based models (BERT, DistilBERT, GPT2,...)
https://docs.rs/crate/rust-bert
Apache License 2.0
2.65k stars 214 forks source link

macOS ARM compiling error #326

Open jianshu93 opened 1 year ago

jianshu93 commented 1 year ago

Hello Team,

I have the following error when running cargo build - - release, I am pretty sure that libtorch are installed via brew install PyTorch. I do not have any problems on intel macOS

Compiling rust-bert v0.19.0 (/Users/jianshuzhao/Github/rust-bert) error: linking with cc failed: exit status: 1 | = note: LC_ALL="C" PATH="/Users/jianshuzhao/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/bin:/Users/jianshuzhao/Github/bowtie2-2.5.0-macos-arm64:/opt/homebrew/bin:/Users/jianshuzhao/bin:/opt/homebrew/opt/bzip2/bin:/Users/jianshuzhao/Github/mummer-4.0.0beta5/bin:/Users/jianshuzhao/go/bin:/Users/jianshuzhao/Github/hmmer-h3-arm/bin:/opt/homebrew/opt/llvm/bin:/opt/homebrew/opt/openjdk/bin:/opt/homebrew/Cellar/coreutils/9.0/bin:/opt/homebrew/opt/ruby/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/Users/jianshuzhao/.cargo/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/usr/local/go/bin:/opt/X11/bin" VSLANG="1033" ZERO_AR_DATE="1" "cc" "-arch" "arm64" "/var/folders/mr/8qybn91j5fgdbrcdmq7ckftw0000gn/T/rustcAP7Cth/symbols.o" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/convert_tensor-87379f38cef18962.convert_tensor.79ce315b-cgu.0.rcgu.o" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/convert_tensor-87379f38cef18962.convert_tensor.79ce315b-cgu.1.rcgu.o" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/convert_tensor-87379f38cef18962.convert_tensor.79ce315b-cgu.10.rcgu.o" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/convert_tensor-87379f38cef18962.convert_tensor.79ce315b-cgu.11.rcgu.o" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/convert_tensor-87379f38cef18962.convert_tensor.79ce315b-cgu.12.rcgu.o" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/convert_tensor-87379f38cef18962.convert_tensor.79ce315b-cgu.13.rcgu.o" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/convert_tensor-87379f38cef18962.convert_tensor.79ce315b-cgu.14.rcgu.o" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/convert_tensor-87379f38cef18962.convert_tensor.79ce315b-cgu.15.rcgu.o" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/convert_tensor-87379f38cef18962.convert_tensor.79ce315b-cgu.2.rcgu.o" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/convert_tensor-87379f38cef18962.convert_tensor.79ce315b-cgu.3.rcgu.o" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/convert_tensor-87379f38cef18962.convert_tensor.79ce315b-cgu.4.rcgu.o" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/convert_tensor-87379f38cef18962.convert_tensor.79ce315b-cgu.5.rcgu.o" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/convert_tensor-87379f38cef18962.convert_tensor.79ce315b-cgu.6.rcgu.o" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/convert_tensor-87379f38cef18962.convert_tensor.79ce315b-cgu.7.rcgu.o" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/convert_tensor-87379f38cef18962.convert_tensor.79ce315b-cgu.8.rcgu.o" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/convert_tensor-87379f38cef18962.convert_tensor.79ce315b-cgu.9.rcgu.o" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/convert_tensor-87379f38cef18962.4hilfw2knwbjjb3v.rcgu.o" "-L" "/Users/jianshuzhao/Github/rust-bert/target/release/deps" "-L" "/Users/jianshuzhao/Github/rust-bert/target/release/build/bzip2-sys-cbdbb6651a43e8cb/out/lib" "-L" "/Users/jianshuzhao/Github/rust-bert/target/release/build/zstd-sys-02faa9c384ac6a7d/out" "-L" "/Users/jianshuzhao/Github/rust-bert/target/release/build/torch-sys-dfad9b078cf4fcfc/out/libtorch/libtorch/lib" "-L" "/Users/jianshuzhao/Github/rust-bert/target/release/build/torch-sys-dfad9b078cf4fcfc/out" "-L" "/Users/jianshuzhao/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/librust_bert-32fca9169b432c86.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libhalf-8f67b1f26b693526.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libuuid-6ade69e2fe8f81cc.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libdirs-d6d0ec03a9fc0fdb.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libdirs_sys-bfca19a8f2c53a30.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libcached_path-49c30aa8832a7eab.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libindicatif-2e62890a4732a914.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libconsole-876e04d81afca60e.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libnumber_prefix-6bfca70a357266ef.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libtar-e63024df07b24d69.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libxattr-64090153947075fa.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libfiletime-136b0fad69844494.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libreqwest-b615ccb123b99daf.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libhyper_tls-10fe5ef2a2a50917.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libbase64-c62ff6f91641b82b.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libipnet-9d32b9619a7fcc99.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libtokio_native_tls-17e4af650b57b9a3.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libserde_urlencoded-cd62e543f3932aac.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libmime-0743e0418a5ee599.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libencoding_rs-d2841f759c09e426.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libnative_tls-81c18b10f2ac1c31.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libsecurity_framework-3f6667e1144db1f0.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libbitflags-2bbfbfade6407190.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libsecurity_framework_sys-af5d01c1f27616ca.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libcore_foundation-8b281bec36c7057d.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libcore_foundation_sys-81f076a79a89cd6c.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libhyper-0877f65102bc81b1.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libwant-9b3184993407900d.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libtry_lock-b8df31e932a54c13.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libhttparse-247aa33d08052553.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libh2-1e6f0fac05151c3a.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libindexmap-b7faf498210573a4.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libtokio_util-71b55b62a5f3f88e.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libfutures_sink-41a12e8531e046b4.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libtower_service-86f7669c57af8511.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libtracing-e7f09387bed478c5.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libtracing_core-c372f4d92bc329e4.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libfutures_channel-cdd878194155d5b0.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libtokio-0b628332267adb9a.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libsocket2-a28ded1022ce0fac.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libmio-9647800e56858cfe.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libhttp_body-d48a72f966e0d7f9.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libfutures_util-15f739ba0425fb9f.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libfutures_io-0cd1412a51a48fcb.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libslab-0c9f25ca10511b98.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libpin_project_lite-329566b13e6e45f0.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libfutures_task-2789fafbc44f5e1d.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libpin_utils-f629fb86d1cbfb4d.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libfutures_core-73e77728ac8dd423.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/liburl-fe46f095861a0247.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libidna-8ffe74c5a6c0d7a5.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libunicode_bidi-7dbe1b2e8f6a471b.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libform_urlencoded-32bf11090fdb154b.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libpercent_encoding-f826ffdab1c80872.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libhttp-57f4553ddf4c5c26.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libbytes-ec9755da07ca81a7.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libfnv-0419508d61057d71.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/liblog-1986ba526b7bc84d.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libglob-879f755822df7039.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libfs2-35321b713bb99a68.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libzip_extensions-6c1826541c27e8e2.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libzip-bc1dbe8ba0632043.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libtime-de32e3de2ceb1f37.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libtempfile-4bc1a1e3f8bfd4d4.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libfastrand-fcefc726ebcf7521.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libremove_dir_all-5ec04e9bf355307f.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/librust_tokenizers-c009bd44f2db3aab.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libcsv-2648897d3e54d137.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libitoa-e54ec4b96ab73274.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libcsv_core-264eaa5b173218b5.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libbstr-b098920f2c037e75.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libregex_automata-244c1290d25e1bff.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libserde_json-07bfdb252402eec3.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libryu-1854acda574e24a0.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libhashbrown-ee33cfa1179a5f85.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libahash-52cc8c040364673b.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libonce_cell-83a0413f4d1c285a.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libprotobuf-5dbb19d90464d164.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libunicode_normalization_alignments-915306d6dac1c771.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libsmallvec-f8d5ff83c040a46c.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libunicode_normalization-ee648b9945147e9c.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libtinyvec-578cef4b7f7be158.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libtinyvec_macros-b04713a4a486580f.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libregex-50f06fea868859a0.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libaho_corasick-8eeda7432d268d83.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libmemchr-b9afceb11d89c5ca.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libregex_syntax-faba5c9c583a3a9b.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/librayon-b48ca69d3b966d8b.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/librayon_core-1ea7b083f51b8c2d.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libnum_cpus-ad0a157e2e5313d0.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libcrossbeam_deque-3d7daaf516279189.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libcrossbeam_epoch-3222921ff03e505f.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libmemoffset-d6471a3976b13309.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libscopeguard-15e20c72e8a90004.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libcrossbeam_channel-2a81eef04c2c8abe.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libcrossbeam_utils-ed9c65eaf2a78abe.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libitertools-dd634c1bb60f04aa.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libeither-e010383f73d8ad9f.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libserde-3058061dbb7fd7a9.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libordered_float-2839804764c0802a.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libtch-67a02d8c4e9fd23e.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libndarray-2e2eab41a924a089.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libmatrixmultiply-e89c629343d5cba6.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libnum_complex-3a2dff7350528a9b.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libnum_integer-55553d2a26bfd1fa.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libnum_traits-2950bcf483969631.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/librawpointer-15a6731e43da61f9.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/librand-6e09188e4ea99b46.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/librand_chacha-e15af77539f63212.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libppv_lite86-d0a5fa375fbcbedd.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libhalf-095c82dc4377813f.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libtorch_sys-d2e7f6b7852a90d0.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libzip-5fda128572e13f5f.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libpbkdf2-6517525ba57194b4.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libsha2-f49096aa93fec163.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libpassword_hash-86e7efaca1356cf5.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libbase64ct-40e9e96a12161b5e.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/librand_core-130546b3a19a05cb.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libgetrandom-14def4c7db906f1f.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libtime-c5425e10f5ce8733.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libitoa-d32ec8651c94bddb.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libtime_core-6c52639db87bab94.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libzstd-d9e112690abefe5a.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libzstd_safe-fbc8b41c371c81e6.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libzstd_sys-e32bdf3ad55d8bd1.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libbzip2-e55933a3777d489a.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libbzip2_sys-c32fda39196b6869.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/liblibc-1443ffe862df56a3.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libflate2-dfb802bfcc35305d.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libminiz_oxide-d28b718d5c9349b7.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libadler-39b2c7213db41305.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libcrc32fast-54beddddea2cb5fc.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libbyteorder-feb8a6d8cd38719b.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libaes-447439e9903e8b30.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libopaque_debug-e50119b40cb8b20b.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libcipher-daf589444397f491.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libsha1-1c47fd5295a4d8cd.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libcfg_if-0692cee5d0087e61.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libhmac-c402e3e8cf3aaa60.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libdigest-d55c5982e13e3515.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libsubtle-cca7bb8e7471c2a2.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libblock_buffer-7f65cef8f15453f2.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libcrypto_common-5bedc5b4692c4680.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libgeneric_array-54339a31f4836524.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libtypenum-88dc288c98f0df60.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libconstant_time_eq-0e23ac03864ec140.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/libthiserror-31e74de6e9ee7063.rlib" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/liblazy_static-ebd75cc0f36ef66d.rlib" "/Users/jianshuzhao/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libstd-65231eff973b4392.rlib" "/Users/jianshuzhao/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libpanic_unwind-c702f95a79b6a8c7.rlib" "/Users/jianshuzhao/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libobject-a11910e6b39a313d.rlib" "/Users/jianshuzhao/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libmemchr-98e2432a46ce6838.rlib" "/Users/jianshuzhao/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libaddr2line-f5edf9223bdf3271.rlib" "/Users/jianshuzhao/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libgimli-2ed9e16d77ae2572.rlib" "/Users/jianshuzhao/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/librustc_demangle-ebe023ba90cb145c.rlib" "/Users/jianshuzhao/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libstd_detect-51a1bb03a9e9d927.rlib" "/Users/jianshuzhao/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libhashbrown-f503a537f1b253d1.rlib" "/Users/jianshuzhao/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libminiz_oxide-84ee9cafbd4fd057.rlib" "/Users/jianshuzhao/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libadler-d137511abda54d92.rlib" "/Users/jianshuzhao/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/librustc_std_workspace_alloc-7aebb49ef1eedb7b.rlib" "/Users/jianshuzhao/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libunwind-bd5d5720720598df.rlib" "/Users/jianshuzhao/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libcfg_if-190c7abd6e8e03ea.rlib" "/Users/jianshuzhao/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/liblibc-c881fe47a0a6ef18.rlib" "/Users/jianshuzhao/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/liballoc-26076234e596ba3a.rlib" "/Users/jianshuzhao/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/librustc_std_workspace_core-a8a859a864856684.rlib" "/Users/jianshuzhao/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libcore-908209eee60fb642.rlib" "/Users/jianshuzhao/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libcompiler_builtins-5aa4ec02992215b2.rlib" "-framework" "Security" "-framework" "CoreFoundation" "-lc++" "-ltorch_cpu" "-ltorch" "-lc10" "-liconv" "-lSystem" "-lc" "-lm" "-L" "/Users/jianshuzhao/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib" "-o" "/Users/jianshuzhao/Github/rust-bert/target/release/deps/convert_tensor-87379f38cef18962" "-Wl,-dead_strip" "-nodefaultlibs" = note: ld: warning: ignoring file /Users/jianshuzhao/Github/rust-bert/target/release/build/torch-sys-dfad9b078cf4fcfc/out/libtorch/libtorch/lib/libtorch_cpu.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64 ld: warning: ignoring file /Users/jianshuzhao/Github/rust-bert/target/release/build/torch-sys-dfad9b078cf4fcfc/out/libtorch/libtorch/lib/libtorch.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64 ld: warning: ignoring file /Users/jianshuzhao/Github/rust-bert/target/release/build/torch-sys-dfad9b078cf4fcfc/out/libtorch/libtorch/lib/libc10.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64 Undefined symbols for architecture arm64: "ZN2at4_ops5zeros4callEN3c108ArrayRefINS2_6SymIntEEENS2_8optionalINS2_10ScalarTypeEEENS6_INS2_6LayoutEEENS6_INS2_6DeviceEEENS6_IbEE", referenced from: _at_tensor_of_data in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) "ZN3c1010TensorImpl17set_autograd_metaESt10unique_ptrINS_21AutogradMetaInterfaceESt14default_deleteIS2_EE", referenced from: ZN5torch8autograd13make_variableEN2at6TensorEbb in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) "ZN3c1019UndefinedTensorImpl10_singletonE", referenced from: ZN3c1013intrusive_ptrINS_10TensorImplENS_19UndefinedTensorImplEE7retain_Ev.isra.0 in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c106IValue7destroyEv in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c106ivalue6ObjectD1Ev in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c106ivalue6ObjectD0Ev in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c1013intrusive_ptrINS_10TensorImplENS_19UndefinedTensorImplEE6reset_Ev in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZSt11make_uniqueIN5torch8autograd12AutogradMetaEJPN3c1010TensorImplERbEENSt8detail9_MakeUniqIT_E15singleobjectEDpOT0 in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) _at_save_multi in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ... "ZN3c1021AutogradMetaInterfaceD2Ev", referenced from: ZSt11make_uniqueIN5torch8autograd12AutogradMetaEJPN3c1010TensorImplERbEENSt8detail9_MakeUniqIT_E15singleobjectEDpOT0 in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN5torch8autograd13make_variableEN2at6TensorEbb in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) "__ZN3c104impl23ExcludeDispatchKeyGuardC1ENS_14DispatchKeySetE", referenced from: _at_tensor_of_data in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) "ZN3c104impl23ExcludeDispatchKeyGuardD1Ev", referenced from: _at_tensor_of_data in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) "ZN3c106detail14torchCheckFailEPKcS2_jRKNSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", referenced from: ZN3c1013QualifiedName14cacheAccessorsEv in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) __ZN3c1015fromIntArrayRefENS_8ArrayRefIxEE in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) "ZN3c106detail14torchCheckFailEPKcS2jS2", referenced from: ZNK3c1010TensorImpl4dataEv in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c1013QualifiedNameC1ERKNSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEEE in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZSt11make_uniqueIN5torch8autograd12AutogradMetaEJPN3c1010TensorImplERbEENSt8detail9_MakeUniqIT_E15singleobjectEDpOT0 in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN5torch8autograd13make_variableEN2at6TensorEbb in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) _at_tensor_of_data in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) "ZN3c106detail23torchInternalAssertFailEPKcS2_jS2_RKNSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", referenced from: ZN3c106IValue7destroyEv in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c1020intrusive_ptr_targetD1Ev in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) __ZNR3c1013TensorOptions9set_dtypeENS_8optionalINS_10ScalarTypeEEE.constprop.0 in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c1020intrusive_ptr_targetD2Ev in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c106ivalue6ObjectD1Ev in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c106ivalue6ObjectD0Ev in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c106Device8validateEv.isra.0 in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ... "ZN3c106detail23torchInternalAssertFailEPKcS2_jS2S2", referenced from: ZN3c108ArrayRefIxE26debugCheckNullptrInvariantEv.part.0.isra.0 in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c1013intrusive_ptrINS_10TensorImplENS_19UndefinedTensorImplEE7retain_Ev.isra.0 in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c1020intrusive_ptr_targetD1Ev in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c1013QualifiedName14cacheAccessorsEv in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c1015fromIntArrayRefENS_8ArrayRefIxEE in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c1020intrusive_ptr_targetD2Ev in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN5torch8autograd13make_variableEN2at6TensorEbb in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ... "ZN5torch3jit6ModuleC1EN3c1013QualifiedNameESt10shared_ptrINS0_15CompilationUnitEEb", referenced from: _at_save_multi in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) "ZN5torch9serialize13OutputArchive5writeERKNSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKN2at6TensorEb", referenced from: _at_save_multi in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) "ZN5torch9serialize13OutputArchive7save_toERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", referenced from: _at_save_multi in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) "ZN6caffe28TypeMeta13typeMetaDatasEv", referenced from: ZNK3c1010TensorImpl4dataEv in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) _at_tensor_of_data in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) "ZN6caffe28TypeMeta26error_unsupportedtypemetaES0", referenced from: ZSt11make_uniqueIN5torch8autograd12AutogradMetaEJPN3c1010TensorImplERbEENSt8detail9_MakeUniqIT_E15singleobjectEDpOT0 in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) __ZN5torch8autograd13make_variableEN2at6TensorEbb in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) _at_tensor_of_data in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) "ZNKSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEE4findEcm", referenced from: ZN3c1013QualifiedNameC1ERKNSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEEE in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) "ZNKSt7cxx1115basic_stringbufIcSt11char_traitsIcESaIcEE3strEv", referenced from: ZN3c1020intrusive_ptr_targetD1Ev in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZNR3c1013TensorOptions9set_dtypeENS_8optionalINS_10ScalarTypeEEE.constprop.0 in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c1013QualifiedName14cacheAccessorsEv in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c1020intrusive_ptr_targetD2Ev in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c106Device8validateEv.isra.0 in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c1013QualifiedNameC1ERKNSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEEE in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) "ZNSo9_MinsertImEERSoT", referenced from: ZN3c1020intrusive_ptr_targetD1Ev in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c1013QualifiedName14cacheAccessorsEv in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c1020intrusive_ptr_targetD2Ev in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) "ZNSo9_MinsertIxEERSoT", referenced from: __ZN3c1015fromIntArrayRefENS_8ArrayRefIxEE in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) "ZNSolsEi", referenced from: ZN3c106detail12_str_wrapperIJPKcRKiEE4callB5cxx11ERKS3S5 in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c106Device8validateEv.isra.0 in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) "ZNSt16invalid_argumentC1EPKc", referenced from: _at_tensor_of_data in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) "ZNSt6localeC1Ev", referenced from: ZN3c106detail12_str_wrapperIJPKcRKiEE4callB5cxx11ERKS3S5 in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) __ZN3c1015fromIntArrayRefENS_8ArrayRefIxEE in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c106detail12_str_wrapperIJPKcRKNSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEEES3_EE4callERKS3_SBSE in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) "ZNSt6localeD1Ev", referenced from: ZNSt7cxx1115basic_stringbufIcSt11char_traitsIcESaIcEED1Ev in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c106detail12_str_wrapperIJPKcRKiEE4callB5cxx11ERKS3S5 in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c1015fromIntArrayRefENS_8ArrayRefIxEE in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c106Device8validateEv.isra.0 in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c106detail12_str_wrapperIJPKcRKNSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEEES3_EE4callERKS3_SBSE in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c1013QualifiedNameC1ERKNSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEEE in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) "ZNSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_replaceEmmPKcm", referenced from: ZN3c106detail12_str_wrapperIJPKcRKiEE4callB5cxx11ERKS3S5 in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c1015fromIntArrayRefENS_8ArrayRefIxEE in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c106detail12_str_wrapperIJPKcRKNSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEEES3_EE4callERKS3_SBSE in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) "ZNSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEE7reserveEm", referenced from: ZN3c1013QualifiedName14cacheAccessorsEv in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) "ZNSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_appendEPKcm", referenced from: ZN3c1013QualifiedName14cacheAccessorsEv in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) "ZNSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_MassignERKS4", referenced from: ZN3c106detail12_str_wrapperIJPKcRKiEE4callB5cxx11ERKS3S5 in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c1013QualifiedName14cacheAccessorsEv in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c1015fromIntArrayRefENS_8ArrayRefIxEE in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c106detail12_str_wrapperIJPKcRKNSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEEES3_EE4callERKS3_SBSE in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) "ZNSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_createERmm", referenced from: ZNSt7cxx1112basic_stringIcSt11chartraitsIcESaIcEEC1EPKcRKS3.constprop.0 in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c1013QualifiedNameC1ERKNSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEEE in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) _at_save_multi in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) "ZNSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_mutateEmmPKcm", referenced from: ZN3c1013QualifiedName14cacheAccessorsEv in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) "ZNSt7cxx1112basic_stringIcSt11chartraitsIcESaIcEEC1EOS4", referenced from: ZN3c1013QualifiedNameC1ERKNSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEEE in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) "ZNSt7cxx1119basic_ostringstreamIcSt11char_traitsIcESaIcEEC1Ev", referenced from: ZN3c1020intrusive_ptr_targetD1Ev in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZNR3c1013TensorOptions9set_dtypeENS_8optionalINS_10ScalarTypeEEE.constprop.0 in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c1013QualifiedName14cacheAccessorsEv in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c1020intrusive_ptr_targetD2Ev in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c106Device8validateEv.isra.0 in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c1013QualifiedNameC1ERKNSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEEE in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) "ZNSt7cxx1119basic_ostringstreamIcSt11char_traitsIcESaIcEED1Ev", referenced from: ZN3c106detail12_str_wrapperIJPKcRKiEE4callB5cxx11ERKS3S5 in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c1020intrusive_ptr_targetD1Ev in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZNR3c1013TensorOptions9set_dtypeENS_8optionalINS_10ScalarTypeEEE.constprop.0 in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c1013QualifiedName14cacheAccessorsEv in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c1015fromIntArrayRefENS_8ArrayRefIxEE in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c1020intrusive_ptr_targetD2Ev in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c106Device8validateEv.isra.0 in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ... "ZNSt8ios_base4InitC1Ev", referenced from: GLOBALsub_I_torch_api.cpp in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) "ZNSt8ios_base4InitD1Ev", referenced from: GLOBALsub_I_torch_api.cpp in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) "ZNSt8ios_baseC2Ev", referenced from: ZN3c106detail12_str_wrapperIJPKcRKiEE4callB5cxx11ERKS3S5 in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c1015fromIntArrayRefENS_8ArrayRefIxEE in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c106detail12_str_wrapperIJPKcRKNSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEEES3_EE4callERKS3_SBSE in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) "ZNSt8ios_baseD2Ev", referenced from: ZN3c106detail12_str_wrapperIJPKcRKiEE4callB5cxx11ERKS3S5 in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c1015fromIntArrayRefENS_8ArrayRefIxEE in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c106Device8validateEv.isra.0 in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c106detail12_str_wrapperIJPKcRKNSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEEES3_EE4callERKS3_SBSE in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c1013QualifiedNameC1ERKNSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEEE in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) "ZNSt9basic_iosIcSt11char_traitsIcEE4initEPSt15basic_streambufIcS1_E", referenced from: ZN3c106detail12_str_wrapperIJPKcRKiEE4callB5cxx11ERKS3S5 in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c1015fromIntArrayRefENS_8ArrayRefIxEE in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c106detail12_str_wrapperIJPKcRKNSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEEES3_EE4callERKS3_SBSE in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) "ZNSt9basic_iosIcSt11char_traitsIcEE5clearESt12_Ios_Iostate", referenced from: ZN3c106detail12_str_wrapperIJPKcRKiEE4callB5cxx11ERKS3S5 in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c106detail12_str_wrapperIJPKcRKNSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEEES3_EE4callERKS3_SBSE in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) "ZSt16ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l", referenced from: ZN3c106detail12_str_wrapperIJPKcRKiEE4callB5cxx11ERKS3S5 in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c1015fromIntArrayRefENS_8ArrayRefIxEE in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c106Device8validateEv.isra.0 in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c106detail12_str_wrapperIJPKcRKNSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEEES3_EE4callERKS3_SBSE in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c1013QualifiedNameC1ERKNSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEEE in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) "ZSt19throw_logic_errorPKc", referenced from: ZNSt7cxx1112basic_stringIcSt11chartraitsIcESaIcEEC1EPKcRKS3.constprop.0 in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) _at_save_multi in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) "ZSt20throw_length_errorPKc", referenced from: ZN3c1013QualifiedName14cacheAccessorsEv in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZNSt6vectorINSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE17_M_realloc_insertIJS5_EEEvN9gnu_cxx17normal_iteratorIPS5_S7EEDpOT in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) "ZSt24throw_out_of_range_fmtPKcz", referenced from: ZN3c1013QualifiedNameC1ERKNSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEEE in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) "ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc", referenced from: ZN3c1020intrusive_ptr_targetD1Ev in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZNR3c1013TensorOptions9set_dtypeENS_8optionalINS_10ScalarTypeEEE.constprop.0 in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c1013QualifiedName14cacheAccessorsEv in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c1020intrusive_ptr_targetD2Ev in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) "ZTTNSt7cxx1119basic_ostringstreamIcSt11char_traitsIcESaIcEEE", referenced from: ZN3c106detail12_str_wrapperIJPKcRKiEE4callB5cxx11ERKS3S5 in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c1015fromIntArrayRefENS_8ArrayRefIxEE in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c106Device8validateEv.isra.0 in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c106detail12_str_wrapperIJPKcRKNSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEEES3_EE4callERKS3_SBSE in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c1013QualifiedNameC1ERKNSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEEE in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) "ZTVN5torch8autograd12AutogradMetaE", referenced from: ZSt11make_uniqueIN5torch8autograd12AutogradMetaEJPN3c1010TensorImplERbEENSt8detail9_MakeUniqIT_E15singleobjectEDpOT0 in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) __ZN5torch8autograd13make_variableEN2at6TensorEbb in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) NOTE: a missing vtable usually means the first non-inline virtual member function has no definition. "ZTVNSt7cxx1115basic_stringbufIcSt11char_traitsIcESaIcEEE", referenced from: ZNSt7cxx1115basic_stringbufIcSt11char_traitsIcESaIcEED1Ev in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c106detail12_str_wrapperIJPKcRKiEE4callB5cxx11ERKS3S5 in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c1015fromIntArrayRefENS_8ArrayRefIxEE in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c106Device8validateEv.isra.0 in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c106detail12_str_wrapperIJPKcRKNSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEEES3_EE4callERKS3_SBSE in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c1013QualifiedNameC1ERKNSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEEE in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) NOTE: a missing vtable usually means the first non-inline virtual member function has no definition. "ZTVNSt7cxx1119basic_ostringstreamIcSt11char_traitsIcESaIcEEE", referenced from: ZN3c106detail12_str_wrapperIJPKcRKiEE4callB5cxx11ERKS3S5 in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) __ZN3c1015fromIntArrayRefENS_8ArrayRefIxEE in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c106Device8validateEv.isra.0 in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c106detail12_str_wrapperIJPKcRKNSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEEES3_EE4callERKS3_SBSE in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c1013QualifiedNameC1ERKNSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEEE in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) NOTE: a missing vtable usually means the first non-inline virtual member function has no definition. "ZTVSt15basic_streambufIcSt11char_traitsIcEE", referenced from: ZNSt7cxx1115basic_stringbufIcSt11char_traitsIcESaIcEED1Ev in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c106detail12_str_wrapperIJPKcRKiEE4callB5cxx11ERKS3S5 in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c1015fromIntArrayRefENS_8ArrayRefIxEE in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c106Device8validateEv.isra.0 in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c106detail12_str_wrapperIJPKcRKNSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEEES3_EE4callERKS3_SBSE in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c1013QualifiedNameC1ERKNSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEEE in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) NOTE: a missing vtable usually means the first non-inline virtual member function has no definition. "ZTVSt9basic_iosIcSt11char_traitsIcEE", referenced from: ZN3c106detail12_str_wrapperIJPKcRKiEE4callB5cxx11ERKS3S5 in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c1015fromIntArrayRefENS_8ArrayRefIxEE in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c106Device8validateEv.isra.0 in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c106detail12_str_wrapperIJPKcRKNSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEEES3_EE4callERKS3_SBSE in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c1013QualifiedNameC1ERKNSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEEE in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) NOTE: a missing vtable usually means the first non-inline virtual member function has no definition. "_aarch64_ldadd4_acq_rel", referenced from: ZNSt16_Sp_counted_baseILN9gnu_cxx12_Lock_policyE2EE24_M_release_last_use_coldEv in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZNSt16_Sp_counted_baseILN9gnu_cxx12_Lock_policyE2EE10_M_releaseEv in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZNSt23_Sp_counted_ptr_inplaceIN5torch3jit15CompilationUnitESaIvELN9gnu_cxx12_Lock_policyE2EE10_M_disposeEv in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c106ivalue6ObjectD1Ev in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c106ivalue6ObjectD0Ev in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZNSt16_Sp_counted_baseILN9gnu_cxx12_Lock_policyE2EE15_M_weak_releaseEv in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN5torch9serialize13OutputArchiveD1Ev in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ... "_aarch64_ldadd8_acq_rel", referenced from: ZN3c1013intrusive_ptrINS_10TensorImplENS_19UndefinedTensorImplEE7retain_Ev.isra.0 in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c106IValue7destroyEv in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c106ivalue6ObjectD1Ev in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c106ivalue6ObjectD0Ev in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c1013intrusive_ptrINS_15VariableVersion14VersionCounterENS_6detail34intrusive_target_default_null_typeIS2_EEE6reset_Ev in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN3c1013intrusive_ptrINS_10TensorImplENS_19UndefinedTensorImplEE6reset_Ev in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ZN5torch9serialize13OutputArchiveD1Ev in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ... "___emutls_get_address", referenced from: _get_and_reset_last_err in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) _at_save_multi in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) _at_tensor_of_data in libtorch_sys-d2e7f6b7852a90d0.rlib(torch_api.o) ld: symbol(s) not found for architecture arm64 collect2: error: ld returned 1 exit status

error: could not compile rust-bert due to previous error

Any idea why?

Thanks,

Jianshu

pejrich commented 1 year ago

I had a bunch of errors trying to install it from source, what seemed to work was the following:

$ brew install libtorch
# It gives some warning about using pytorch and not the deprecated libtorch
$ brew link libtorch
$ brew ls --verbose libtorch | grep dylib

That should give you something like this:

/opt/homebrew/Cellar/pytorch/1.13.1/lib/libtorch_python.dylib
/opt/homebrew/Cellar/pytorch/1.13.1/lib/libtorch.dylib
/opt/homebrew/Cellar/pytorch/1.13.1/lib/libtorch_global_deps.dylib
/opt/homebrew/Cellar/pytorch/1.13.1/lib/libtorch_cpu.dylib
/opt/homebrew/Cellar/pytorch/1.13.1/lib/libc10.dylib
/opt/homebrew/Cellar/pytorch/1.13.1/lib/libshm.dylib

You want this part: /opt/homebrew/Cellar/pytorch/1.13.1

$ export LIBTORCH=/opt/homebrew/Cellar/pytorch/1.13.1
$ export LD_LIBRARY_PATH=${LIBTORCH}/lib:$LD_LIBRARY_PATH

That worked for me after everything else I tried was failing with random errors. I don't think it's with the MPS enabled stuff to utilize the M1 GPU, because some translation I did that took ~5-6 seconds on a server running Cuda 11.7 on a Tesla T4, took ~52 seconds on my mac. This was the same amount of time that running the same model via Python was taking, so no performance gains, but I think it was a little faster than python on the T4, but not by a lot.

knpwrs commented 1 year ago

Building on what @pejrich, the following worked for me with no warnings, no need for manually copying the output of brew ls, and no need for brew link:

$ brew install pytorch jq
$ export LIBTORCH=$(brew --cellar pytorch)/$(brew info --json pytorch | jq -r '.[0].installed[0].version')
$ export LD_LIBRARY_PATH=${LIBTORCH}/lib:$LD_LIBRARY_PATH

Then you can run the examples, e.g.:

cargo run --example sentence_embeddings
patientplatypus6 commented 1 year ago

@knpwrs @pejrich

I've installed and linked pytorch and libtorch - neither manages to make this work. I don't have any overwrites, so it should be that from all of this I just added more symlinks. I also installed via anaconda, but installing via homebrew overwrote that the first time when I was following the advice in another thread.

Doesn't work for me. I still have the "cc linking" error although I ran the three previous lines.

I still have the "cc" error

Screenshot 2023-03-15 at 9 11 03 PM

Here is my installation

(base) peterweyand@Peters-MacBook-Pro hello % pip3 show torch Name: torch Version: 2.0.0 Summary: Tensors and Dynamic neural networks in Python with strong GPU acceleration Home-page: https://pytorch.org/ Author: PyTorch Team Author-email: packages@pytorch.org License: BSD-3 Location: /Users/peterweyand/miniconda3/lib/python3.10/site-packages Requires: filelock, jinja2, networkx, sympy, typing-extensions Required-by: torchvision

I ran the exports by using export and also added them to my bash profile. Neither way worked.

I was working on a minor implementation on a project I was working on, and just to double check that this doesn't work I ran it with the example (cargo run as you said).

It doesn't work.

here's the terminal output

(base) peterweyand@Peters-MacBook-Pro Code % git clone https://github.com/guillaume-be/rust-bert.git
Cloning into 'rust-bert'...
remote: Enumerating objects: 9821, done.
remote: Counting objects: 100% (9821/9821), done.
remote: Compressing objects: 100% (2264/2264), done.
remote: Total 9821 (delta 7622), reused 9660 (delta 7505), pack-reused 0
Receiving objects: 100% (9821/9821), 3.47 MiB | 6.54 MiB/s, done.
Resolving deltas: 100% (7622/7622), done.
(base) peterweyand@Peters-MacBook-Pro Code % ls           
Graphite    mozjs       project1    rustprojects
code_tenderloin ocamlprojects   rust-bert   servo
(base) peterweyand@Peters-MacBook-Pro Code % cd rust-bert 
(base) peterweyand@Peters-MacBook-Pro rust-bert % ls
CHANGELOG.md        benches         src
CONTRIBUTING.md     clippy.toml     tests
Cargo.toml      examples        utils
LICENSE         requirements.txt
README.md       rustfmt.toml
(base) peterweyand@Peters-MacBook-Pro rust-bert % brew install pytorch jq
==> Downloading https://formulae.brew.sh/api/formula.jws.json
######################################################################## 100.0%
==> Downloading https://formulae.brew.sh/api/cask.jws.json
######################################################################## 100.0%
Warning: pytorch 1.13.1 is already installed and up-to-date.
To reinstall 1.13.1, run:
  brew reinstall pytorch
Warning: jq 1.6 is already installed and up-to-date.
To reinstall 1.6, run:
  brew reinstall jq
(base) peterweyand@Peters-MacBook-Pro rust-bert % export LIBTORCH=$(brew --cellar pytorch)/$(brew info --json pytorch | jq -r '.[0].installed[0].version')
(base) peterweyand@Peters-MacBook-Pro rust-bert % export LD_LIBRARY_PATH=${LIBTORCH}/lib:$LD_LIBRARY_PATH
(base) peterweyand@Peters-MacBook-Pro rust-bert % sudo cargo run --example sentence_embeddings
   Compiling libc v0.2.140
   Compiling cfg-if v1.0.0
   Compiling autocfg v1.1.0
   Compiling proc-macro2 v1.0.52
   Compiling pkg-config v0.3.26
   Compiling unicode-ident v1.0.8
   Compiling quote v1.0.26
   Compiling syn v1.0.109
   Compiling version_check v0.9.4
   Compiling typenum v1.16.0
   Compiling memchr v2.5.0
   Compiling generic-array v0.14.6
   Compiling itoa v1.0.6
   Compiling serde_derive v1.0.156
   Compiling subtle v2.4.1
   Compiling log v0.4.17
   Compiling pin-project-lite v0.2.9
   Compiling once_cell v1.17.1
   Compiling serde v1.0.156
   Compiling bitflags v1.3.2
   Compiling bytes v1.4.0
   Compiling jobserver v0.1.26
   Compiling socket2 v0.4.9
   Compiling getrandom v0.2.8
   Compiling cc v1.0.79
   Compiling num_cpus v1.15.0
   Compiling rand_core v0.6.4
   Compiling cpufeatures v0.2.5
   Compiling lazy_static v1.4.0
   Compiling core-foundation-sys v0.8.3
   Compiling futures-core v0.3.27
   Compiling tokio v1.26.0
   Compiling indexmap v1.9.2
   Compiling num-traits v0.2.15
   Compiling block-buffer v0.10.4
   Compiling crypto-common v0.1.6
   Compiling io-lifetimes v1.0.6
   Compiling digest v0.10.6
   Compiling zstd-safe v5.0.2+zstd.1.5.2
   Compiling crossbeam-utils v0.8.15
   Compiling crc32fast v1.3.2
   Compiling zstd-sys v2.0.7+zstd.1.5.4
   Compiling libz-sys v1.1.8
   Compiling bzip2-sys v0.1.11+1.0.8
   Compiling curl-sys v0.4.60+curl-7.88.1
   Compiling mio v0.8.6
   Compiling memoffset v0.8.0
   Compiling slab v0.4.8
   Compiling ryu v1.0.13
   Compiling rustix v0.36.9
   Compiling base64ct v1.6.0
   Compiling futures-task v0.3.27
   Compiling adler v1.0.2
   Compiling hashbrown v0.12.3
   Compiling password-hash v0.4.2
   Compiling miniz_oxide v0.6.2
   Compiling sha2 v0.10.6
   Compiling hmac v0.12.1
   Compiling cipher v0.3.0
   Compiling errno v0.2.8
   Compiling tracing-core v0.1.30
   Compiling crossbeam-epoch v0.9.14
   Compiling futures-util v0.3.27
   Compiling opaque-debug v0.3.0
   Compiling tinyvec_macros v0.1.1
   Compiling time-core v0.1.0
   Compiling fnv v1.0.7
   Compiling time v0.3.20
   Compiling tracing v0.1.37
   Compiling http v0.2.9
   Compiling tinyvec v1.6.0
   Compiling aes v0.7.5
   Compiling pbkdf2 v0.11.0
   Compiling tokio-macros v1.8.2
   Compiling flate2 v1.0.25
   Compiling core-foundation v0.9.3
   Compiling security-framework-sys v2.8.0
   Compiling sha1 v0.10.5
   Compiling curl v0.4.44
   Compiling byteorder v1.4.3
   Compiling futures-sink v0.3.27
   Compiling native-tls v0.2.11
   Compiling anyhow v1.0.69
   Compiling fastrand v1.9.0
   Compiling scopeguard v1.1.0
   Compiling futures-channel v0.3.27
   Compiling constant_time_eq v0.1.5
   Compiling pin-utils v0.1.0
   Compiling serde_json v1.0.94
   Compiling futures-io v0.3.27
   Compiling httparse v1.8.0
   Compiling tempfile v3.4.0
   Compiling security-framework v2.8.2
   Compiling unicode-normalization v0.1.22
   Compiling aho-corasick v0.7.20
   Compiling either v1.8.1
   Compiling rayon-core v1.11.0
   Compiling thiserror v1.0.39
   Compiling regex-syntax v0.6.28
   Compiling percent-encoding v2.2.0
   Compiling try-lock v0.2.4
   Compiling want v0.3.0
   Compiling form_urlencoded v1.1.0
   Compiling crossbeam-deque v0.8.3
   Compiling http-body v0.4.5
   Compiling thiserror-impl v1.0.39
   Compiling crossbeam-channel v0.5.7
   Compiling ahash v0.8.3
   Compiling tokio-util v0.7.7
   Compiling regex v1.7.1
   Compiling num-integer v0.1.45
   Compiling h2 v0.3.16
   Compiling ppv-lite86 v0.2.17
   Compiling httpdate v1.0.2
   Compiling half v1.8.2
   Compiling unicode-bidi v0.3.11
   Compiling tower-service v0.3.2
   Compiling idna v0.3.0
   Compiling rand_chacha v0.3.1
   Compiling tokio-native-tls v0.3.1
   Compiling itertools v0.10.5
   Compiling rawpointer v0.2.1
   Compiling protobuf v2.28.0
   Compiling matrixmultiply v0.3.2
   Compiling hyper v0.14.25
   Compiling serde_urlencoded v0.7.1
   Compiling rayon v1.7.0
   Compiling url v2.3.1
   Compiling rand v0.8.5
   Compiling num-complex v0.4.3
   Compiling console v0.15.5
   Compiling filetime v0.2.20
   Compiling xattr v0.2.3
   Compiling csv-core v0.1.10
   Compiling encoding_rs v0.8.32
   Compiling os_str_bytes v6.4.1
   Compiling base64 v0.21.0
   Compiling plotters-backend v0.3.4
   Compiling smallvec v1.10.0
   Compiling ipnet v2.7.1
   Compiling rust_tokenizers v8.0.0
   Compiling mime v0.3.16
   Compiling number_prefix v0.4.0
   Compiling ciborium-io v0.2.0
   Compiling hyper-tls v0.5.0
   Compiling ciborium-ll v0.2.0
   Compiling indicatif v0.16.2
   Compiling plotters-svg v0.3.3
   Compiling unicode-normalization-alignments v0.1.12
   Compiling reqwest v0.11.14
   Compiling clap_lex v0.2.4
   Compiling csv v1.2.1
   Compiling tar v0.4.38
   Compiling ndarray v0.15.6
   Compiling hashbrown v0.13.2
   Compiling dirs-sys v0.3.7
   Compiling fs2 v0.4.3
   Compiling cast v0.3.0
   Compiling same-file v1.0.6
   Compiling textwrap v0.16.0
   Compiling glob v0.3.1
   Compiling walkdir v2.3.2
   Compiling criterion-plot v0.5.0
   Compiling dirs v4.0.0
   Compiling clap v3.2.23
   Compiling plotters v0.3.4
   Compiling ciborium v0.2.0
   Compiling tinytemplate v1.2.1
   Compiling ordered-float v3.4.0
   Compiling uuid v1.3.0
   Compiling atty v0.2.14
   Compiling oorandom v11.1.3
   Compiling anes v0.1.6
   Compiling half v2.2.1
   Compiling bzip2 v0.4.4
   Compiling criterion v0.4.0
   Compiling zstd v0.11.2+zstd.1.5.2
   Compiling zip v0.6.4
   Compiling cached-path v0.6.1
   Compiling torch-sys v0.10.0
   Compiling tch v0.10.1
   Compiling rust-bert v0.20.1-alpha (/Users/peterweyand/Code/rust-bert)
error: linking with `cc` failed: exit status: 1

I opened a stackoverflow issue here https://stackoverflow.com/questions/75752140/installation-of-transformer-library-not-working-in-apple-m1. And I've asked here https://discord.com/channels/273534239310479360/818964227783262209 and here https://discord.com/channels/442252698964721669/448238009733742612.

If someone can fix this please @ me as I'd like to know. I'd be excited to be able to use this library.

patientplatypus6 commented 1 year ago

I've tried the last three versions of pytorch (1.13.0, 1.13.1, and 2.0.0) using pip3 install torch===1.13.0 with the same errors.

So it doesn't look like it's a versioning issue.

pejrich commented 1 year ago

@patientplatypus6 I'm not sure what to suggest there. I avoid Anaconda more than I avoid the plague, because it seems to destroy my system the two times I tried installing something with it. It doesn't seem to mix well with anything non-anaconda.

patientplatypus6 commented 1 year ago

@pejrich

Yeah - I wrote a comment here (https://github.com/pytorch/pytorch/issues/96959) - I've deleted my Anaconda directory and reinstalled all of the homebrew, rustup, and python. This still doesn't work.

Also - after deleting and re-installing homebrew this no should be -

peterweyand@Peters-MacBook-Pro rust-bert % brew ls --verbose pytorch | grep dylib
/opt/homebrew/Cellar/pytorch/1.13.1/lib/libtorch_python.dylib
/opt/homebrew/Cellar/pytorch/1.13.1/lib/libtorch.dylib
/opt/homebrew/Cellar/pytorch/1.13.1/lib/libtorch_global_deps.dylib
/opt/homebrew/Cellar/pytorch/1.13.1/lib/libtorch_cpu.dylib
/opt/homebrew/Cellar/pytorch/1.13.1/lib/libc10.dylib
/opt/homebrew/Cellar/pytorch/1.13.1/lib/libshm.dylib

Can someone just link the macos arm-64 versions of these files - libtorch_cpu.dylib, libtorch.dylib, libc10.dylib? This shouldn't be this complicated. Clearly the proposed solutions don't work. I won't believe that it works on your computer unless you provide video or show your entire environment. There's something else that's going on in the environment other than what is being shown.

Flocksserver commented 1 year ago

@patientplatypus6 making the libtorch libraries available system-wide as mentioned is also possible, but I would recommend the following::

fn add_libs(location: impl AsRef, names: Vec<impl AsRef>, all_static_link: bool) { println!("cargo:rustc-link-search={}",location.as_ref()); names.iter().for_each(|name|{ println!( "cargo:rustc-link-lib={}{}", if all_static_link { "static=" } else { "" }, name.as_ref() ) }) }

fn main() { let target = env::var("TARGET").unwrap();

match target.as_str() {
    "aarch64-apple-darwin" => add_libs(
        "./lib",
        vec!["torch_cpu", "torch", "c10", "torch_global_deps", "torch_cpu"],
        false
    ),
    _ => {}
}

println!("cargo:rerun-if-changed=src");

}



- `cargo build` should work now.
- Attention: Running your program will not work. Copy the dylib files next to your compiled program.
- `cargo build` should work now.
patientplatypus6 commented 1 year ago

It's working for me now!

The installation error changed - and sent me to another repo - user antimora posted the following code to make this work. For anyone who has had the same amount of trouble that I have had.

First pip3 install pytorch

Then save the following script as runscript.py run as global using python3 runscript.py:

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

"""
This is a helper script to fix burn-tch build issues on Mac M1/M2 machines.

It's a temporary workaround for https://github.com/burn-rs/burn/issues/180 
till tch-rs starts using Torch 2.0 libraries.

This script installs torch via pip3 and creates environment variables in 
.cargo/config.toml for tch-rs to link cc libs properly.

"""

import os
import pathlib

def torch_path():
    import torch
    return pathlib.Path(torch.__file__).parent

def update_toml_config():
    import tomli
    import tomli_w

    cargo_cfg_dir = pathlib.Path(__file__).parent.parent.joinpath(
        ".cargo").resolve()
    cargo_cfg_dir.exists()
    if not cargo_cfg_dir.exists():
        os.makedirs(cargo_cfg_dir)

    toml_file_path = cargo_cfg_dir.joinpath("config.toml")

    # Create toml file if does not exists
    with open(toml_file_path, 'a') as f:
        pass

    with open(toml_file_path, 'rb') as f:
        config = tomli.load(f)

        config["env"] = config.get("env", dict())

        config["env"]["LIBTORCH"] = dict(
            value="{}".format(torch_path()),
            force=True,
        )

        config["env"]["DYLD_LIBRARY_PATH"] = dict(
            value="{}/lib".format(torch_path()),
            force=True,
        )

    with open(toml_file_path, 'wb') as f:
        tomli_w.dump(config, f)

def main():
    print("Installing/Upgrading torch via pip install ...")
    os.system("pip3 install -U torch")
    os.system("pip3 install -U tomli")
    os.system("pip3 install -U tomli-w")

    print("Updating config.toml with torch library paths ... ")
    update_toml_config()

if __name__ == '__main__':
    main()
guillaume-be commented 1 year ago

I'm glad you found a couple of solutions to make it work. If you can cross-validate that a solution works consistently, it'd be great if you could write a small section for the readme for installation tips for M1/M2 devices

patientplatypus6 commented 1 year ago

@guillaume-be

The current installation of tch-rs on Apple Silicon returns the following error -

   Compiling torch-sys v0.11.0 (/Users/user/Projects/tch-rs/torch-sys)
error: failed to run custom build command for `torch-sys v0.11.0 (/Users/user/Projects/tch-rs/torch-sys)`

Caused by:
  process didn't exit successfully: `/Users/user/Projects/tch-rs/target/debug/build/torch-sys-04e74d17bc8358a0/build-script-build` (exit status: 101)
  --- stdout
  cargo:rerun-if-env-changed=TORCH_CUDA_VERSION
  cargo:rerun-if-env-changed=LIBTORCH

  --- stderr
  thread 'main' panicked at 'Pre-built version of libtorch for apple silicon are not available.
                              You can install torch manually following the indications from https://github.com/LaurentMazare/tch-rs/issues/629
                              pip3 install torch==2.0.0

                              Then update the following environment variables:
                              export LIBTORCH=$(python3 -c 'import torch; from pathlib import Path; print(Path(torch.__file__).parent)')
                              export DYLD_LIBRARY_PATH=${LIBTORCH}/lib
                              ', torch-sys/build.rs:123:29
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[tch-rs]$ uname -a
Darwin MacBook-Pro.local 22.3.0 Darwin Kernel Version 22.3.0: 
Mon Jan 30 20:38:37 PST 2023; root:xnu-8792.81.3~2/RELEASE_ARM64_T6000 arm64
[tch-rs]$ 

which references this github issue https://github.com/LaurentMazare/tch-rs/issues/629. This is the link to the script to install that needs to be run (credit antimora) - https://github.com/burn-rs/burn/blob/main/scripts/fix-tch-build-arm64.py. After pip3 install pytorch and running the above script attempt a reinstall of the rust-bert library.

Thanks for the help.

michael-long88 commented 10 months ago

Has anyone found a reliable way to get this to work? I'm trying to use rust-bert in a project, but I can't get it to build. I've tried

I'm able to successfully clone this repo and run cargo run --example sentence_embeddings without any issue, so I'm not sure where the disconnect is.

AlexMikhalev commented 4 months ago

It's remarkably non-trivial to get rust-bert working on m3 with Sonoma 14.5, my successful path:

curl -L -O https://github.com/conda-forge/miniforge/releases/download/4.12.0-2/Miniforge3-MacOSX-arm64.sh 
conda create -n axlearn python=3.9 
conda activate axlearn
conda install numpy
pip3 install torch==2.3.0
export LIBTORCH_USE_PYTORCH=1
export LIBTORCH=$(python3 -c 'import torch; from pathlib import Path; print(Path(torch.__file__).parent)')
export DYLD_LIBRARY_PATH=${LIBTORCH}/lib
cargo run --example sentence_embeddings
hkfi commented 4 months ago

Facing the same issue as @michael-long88. Created another issue.

hkfi commented 4 months ago

Figured out the issue for me in this comment. @michael-long88