tch-rs
tch-rs copied to clipboard
Doesn't build on Apple Silicon Macbook
The new M1 Mac's (soon to be all of them) have aarch64 rather than X64 and libtorch is an X64 build under Rosetta 2. This means that it's impossible to link tch with libtorch on this architecture :-
error: linking with cc
failed: exit code: 1
|
= note: "cc" "-arch" "arm64" "-L" "/Users/andrew/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/narrative_classifier.15ldlvw3apdozeag.rcgu.o" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/narrative_classifier.19h2avv3g2rhd8ti.rcgu.o" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/narrative_classifier.19k1jx3fru64ijw.rcgu.o" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/narrative_classifier.1drvgqderknvinw.rcgu.o" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/narrative_classifier.1i8nis694q60f24z.rcgu.o" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/narrative_classifier.1mc8upajqa89ioiy.rcgu.o" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/narrative_classifier.1og2kkfufh9h9llu.rcgu.o" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/narrative_classifier.1p12xb8dd5z0j2oa.rcgu.o" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/narrative_classifier.1pj1c0klt22lo9eb.rcgu.o" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/narrative_classifier.1yhxufjpoe6v7fy2.rcgu.o" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/narrative_classifier.2748x699eb70qaub.rcgu.o" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/narrative_classifier.29lcy82s6g0z7iaj.rcgu.o" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/narrative_classifier.29m8kryg2qd2rmg2.rcgu.o" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/narrative_classifier.2f988bwxfpist170.rcgu.o" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/narrative_classifier.2oxmp72ki5h5bgom.rcgu.o" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/narrative_classifier.2vi9u5dukbl2uikd.rcgu.o" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/narrative_classifier.2wyusal9ofuiba04.rcgu.o" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/narrative_classifier.3385vjp8b4qrvsel.rcgu.o" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/narrative_classifier.341hltlph9ekebsv.rcgu.o" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/narrative_classifier.38vuktn611oyjily.rcgu.o" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/narrative_classifier.3ijtt36ou0xfx2q.rcgu.o" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/narrative_classifier.3k9qu0jiv1tguaoo.rcgu.o" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/narrative_classifier.3kol898l2xc7r2fk.rcgu.o" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/narrative_classifier.3mwyqdu6b4b56evi.rcgu.o" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/narrative_classifier.3xodh5jgs1shsurn.rcgu.o" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/narrative_classifier.3ztkdehoqv5gwbvg.rcgu.o" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/narrative_classifier.4879d25nas295rwc.rcgu.o" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/narrative_classifier.4agna4wk1t7i24c0.rcgu.o" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/narrative_classifier.4ganrnseteo6um71.rcgu.o" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/narrative_classifier.4gs1duw6s4knjya3.rcgu.o" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/narrative_classifier.4h99wc936opjzbr4.rcgu.o" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/narrative_classifier.4mr4zqasfbbiqt95.rcgu.o" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/narrative_classifier.4odoazhzgp7jdfxj.rcgu.o" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/narrative_classifier.4pjbom7fy2c3x6k3.rcgu.o" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/narrative_classifier.4q75hu8bdv6maa09.rcgu.o" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/narrative_classifier.4rkxklzlpjccm2rp.rcgu.o" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/narrative_classifier.4t73n5mf8dh1e8v.rcgu.o" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/narrative_classifier.4u3ykpbbnmskcdeo.rcgu.o" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/narrative_classifier.4x7ycr1vw6a17erk.rcgu.o" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/narrative_classifier.4xr6i5aecpyyyz2l.rcgu.o" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/narrative_classifier.5eujk3ii2qx3naew.rcgu.o" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/narrative_classifier.5ezkswgf5ujjvart.rcgu.o" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/narrative_classifier.bqrrpmqse4jjosf.rcgu.o" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/narrative_classifier.iamjjyae3ahp5a1.rcgu.o" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/narrative_classifier.k85jn9gxqjkul62.rcgu.o" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/narrative_classifier.ndflkalgmis3gfx.rcgu.o" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/narrative_classifier.phwdoxrqnic8noa.rcgu.o" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/narrative_classifier.qv44wvrs0ouwk8n.rcgu.o" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/narrative_classifier.sfwv3547m4tyqoa.rcgu.o" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/narrative_classifier.tumzygq7j6woxar.rcgu.o" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/narrative_classifier.ucs77qj3p5djkf1.rcgu.o" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/narrative_classifier.w02wi7sbm4ebo2u.rcgu.o" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/narrative_classifier.yeopzie9w2k5x98.rcgu.o" "-o" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/narrative_classifier" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/narrative_classifier.2jlex06tk876gyub.rcgu.o" "-Wl,-dead_strip" "-nodefaultlibs" "-L" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps" "-L" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/build/bzip2-sys-da104762e0916b6d/out/lib" "-L" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/build/torch-sys-60923cbf24534296/out/libtorch/libtorch/lib" "-L" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/build/torch-sys-60923cbf24534296/out" "-L" "/Users/andrew/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/librust_bert-22b5d871339b3af2.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libuuid-59dbe3e868a23e7a.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libcached_path-a669e071cdeb8ada.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libindicatif-1eb99454eca6b66a.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libconsole-69bf9721c340317b.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libterminal_size-c85d832c80ded689.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libunicode_width-7552a7347a12ef71.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libnumber_prefix-4b8da504c5b04c93.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libtar-67768068e97046a1.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libxattr-a14e39c10a2acc0d.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libfiletime-9189dcb11ef4aef3.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libsha2-10faa6d397cd50a6.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libopaque_debug-c9886c8a42d67feb.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libdigest-9b0c84ffaf335058.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libblock_buffer-88681a4bfb306604.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libgeneric_array-f3db85fc3ca98ae3.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libtypenum-d9021e3095ef20df.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libreqwest-cf252d3f0f8f8a4e.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libhyper_tls-6f91120669ddd5f8.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libipnet-1dd64096f9ad9e2b.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libtokio_native_tls-3b89642b23a8411c.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libserde_urlencoded-0eb1ea4b5052d917.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libmime-3208b3fe7b236677.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libencoding_rs-a423a5c326f4cd93.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libbase64-bc658a2968b862df.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libnative_tls-104265da39a49a00.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libsecurity_framework-e4472c713bc8bbce.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libbitflags-030f118ea26aedff.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libsecurity_framework_sys-f35a4ac0d9af2c8c.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libcore_foundation-b798140f37eff239.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libcore_foundation_sys-c76011a369868cd1.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libhyper-bf06f7dece7babd5.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libwant-0fdb0d120e00e2bd.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libtry_lock-cebe2710626a5a5f.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libsocket2-dcdf550458ae34b3.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libh2-f82066f5b5d4858d.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libindexmap-de0e9fe73c83f54c.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libtokio_util-c2ef2aa1d25f9a13.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libfutures_sink-b663b9a0f34dd3f0.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libhttparse-dd238fbfc3464d8c.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libtower_service-0bcc09f6f2f22ddf.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libfutures_channel-561aad3ef42c612e.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libpin_project-0c351c981600f056.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libtracing-8e9eedfcaffc51d5.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libtracing_core-a5586b1cf02fbea1.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libtokio-98aafedb3612e2f5.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libmio-4faa90949040754b.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libhttp_body-433cf431bdea4b47.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libfutures_util-3333d10e4623a121.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libfutures_io-562bd1db47ac4c81.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libslab-32852292e25369fe.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libpin_project_lite-51acda515f28381f.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libfutures_task-20a6995672651029.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libpin_utils-e8405942408c137b.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libfutures_core-7d11d6f68192380a.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/liburl-471a025d86db93ff.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libidna-8ed5c58755c97a68.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libunicode_bidi-1df927e8c7b47415.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libform_urlencoded-0427c9dae3f09e3e.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libpercent_encoding-d6d0e159d15dce06.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libmatches-35c5af35eea35aeb.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libhttp-553426dc06b9a18d.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libbytes-b77e6f1391cab4e4.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libfnv-f99eac24deb045f1.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/liblog-4b76127376bc5b1a.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libglob-6c8f7279ee00d982.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libfs2-691c358e52680afe.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libzip_extensions-3921b8ea20f9fd79.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libtempfile-4f86e5156c031477.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/librand-b2eda018ada2095a.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/librand_chacha-7f5f703ae490b9b8.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/librand_core-0a0b5f472ae7d3cb.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libgetrandom-284492ff4877b1f1.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libremove_dir_all-63851b140a9045a2.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/librust_tokenizers-b98c537487a8e07f.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libcsv-c07091acee32b5e2.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libcsv_core-9d5176115b5dc5c8.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libbstr-ac8770f63502da28.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libregex_automata-5291171fd6baa0eb.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libserde_json-25ae71fbc7a43861.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libryu-1949ebb3519781f9.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libitoa-caf97236d8888691.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libhashbrown-8b769448b8309382.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libahash-3a0653294e22af62.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libprotobuf-b8c24797dd2327fd.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libunicode_normalization_alignments-053ebe83ca18b7cc.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libsmallvec-9885992c67518033.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libunicode_normalization-fe8f39032a5c21ae.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libtinyvec-ecf8eb0eef2475af.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libtinyvec_macros-0172dbcfdf06e0ea.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libregex-216d3a71113d1bf2.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libregex_syntax-73dcf24cf9ac5df8.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libaho_corasick-ab2e649414d7d939.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libmemchr-545956354737ddc5.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/librayon-52f6bfcf8ae438b1.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/librayon_core-98b46b792c441fac.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libnum_cpus-bbb7934e3929db46.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libcrossbeam_deque-2ef262a584d0c06e.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libcrossbeam_epoch-055ecc85c181a03d.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libmemoffset-d9b5cb5ebd2d3c78.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libscopeguard-f25606b1925e796a.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libcrossbeam_channel-a934b7eeeb8d91cf.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libcrossbeam_utils-9d22a394ff209c4b.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libitertools-cfbd17c8e11620e5.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libeither-1dda02df6fcc2a1c.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libserde-95884dcf90521c85.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libordered_float-8c24136dcb701918.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libtch-f07f0412cf21f5a4.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libndarray-e9509ed28684ba60.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libmatrixmultiply-d42816c01cc503f4.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libnum_complex-69c9368b0cb9b262.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libnum_integer-dccdd1145051f437.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libnum_traits-252500b0c5d20cb1.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/librawpointer-61af2a797cefda08.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/librand-f982c39add7e3af3.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/librand_chacha-3df058882a83d743.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libppv_lite86-b5c231b3ae995b69.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/librand_core-8dd9c695d1d013b2.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libgetrandom-7ec072f85656f020.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libhalf-d81be47b888a5a5f.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libtorch_sys-73aea0ccfd975e23.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libzip-41260ffcbcd5f7cb.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libtime-dc217430295069a8.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libbzip2-0eba3cf253a17e65.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libbzip2_sys-242b4359734cc246.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libflate2-7d3e59e4ac63a930.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libminiz_oxide-4df2be6f2114562e.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libadler-5d80528d67dfb908.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libbyteorder-a2f923529288ff0c.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libcrc32fast-da49b74d46580a02.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libcfg_if-5d0655e343ff9cae.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libthiserror-86271e4e2281b277.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/liblazy_static-5f023eb1b908c20e.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libdirs-1e15038404d54f6d.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libdirs_sys-e3b1606003fcabb8.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/liblibc-84a68858766e2a51.rlib" "/Users/andrew/CLionProjects/narrative-classifier/target/debug/deps/libanyhow-0e186a4f01ae1c08.rlib" "/Users/andrew/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libstd-e40bd6a3af835df4.rlib" "/Users/andrew/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libpanic_unwind-68aa428439efc3d3.rlib" "/Users/andrew/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libobject-e8883902f5c364b6.rlib" "/Users/andrew/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libaddr2line-a950b2eed913eb15.rlib" "/Users/andrew/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libgimli-9ce7597f6151ffc2.rlib" "/Users/andrew/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/librustc_demangle-6a556d2584ddcc81.rlib" "/Users/andrew/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libhashbrown-e62ba676fce5c547.rlib" "/Users/andrew/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/librustc_std_workspace_alloc-509c1845891b6a82.rlib" "/Users/andrew/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libunwind-082f7f4ff792426f.rlib" "/Users/andrew/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libcfg_if-28ab4d9e8295eb15.rlib" "/Users/andrew/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/liblibc-e9e7769a4bdcb2d3.rlib" "/Users/andrew/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/liballoc-94664336047de1ce.rlib" "/Users/andrew/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/librustc_std_workspace_core-8df6af481e225202.rlib" "/Users/andrew/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libcore-214021ad04ab7aee.rlib" "/Users/andrew/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libcompiler_builtins-9eb7dc999785b765.rlib" "-framework" "Security" "-framework" "CoreFoundation" "-lc++" "-ltorch" "-ltorch_cpu" "-lc10" "-liconv" "-lSystem" "-lresolv" "-lc" "-lm"
= note: ld: warning: ignoring file /Users/andrew/CLionProjects/narrative-classifier/target/debug/build/torch-sys-60923cbf24534296/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/andrew/CLionProjects/narrative-classifier/target/debug/build/torch-sys-60923cbf24534296/out/libtorch/libtorch/lib/libc10.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /Users/andrew/CLionProjects/narrative-classifier/target/debug/build/torch-sys-60923cbf24534296/out/libtorch/libtorch/lib/libtorch_cpu.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
Undefined symbols for architecture arm64:
"typeinfo for c10::AutogradMetaInterface", referenced from:
typeinfo for torch::autograd::AutogradMeta in libtorch_sys-73aea0ccfd975e23.rlib(torch_api.o)
Did you figure this out?
Looking at the compilation failures above, it seems that the tch-rs code is compiled for arm64 but tries to link with x86 binaries for libtorch. The libtorch binaries are automatically downloaded from the pytorch website and afaik only x86 binaries are available there.
Not sure if it's possible to build pytorch for arm64, if that's the case you can try doing so and use the LIBTORCH environment variable to point tch-rs at it (details on the main readme).
Alternatively, maybe it's possible to compile tch-rs for x86 on your platform but I wouldn't know how to do this nor do I have access to an arm macos box.
Here is the precise procedure to follow:
- Clone version 1.8.1 of Pytorch
git clone --branch v1.8.1 --recurse-submodule https://github.com/pytorch/pytorch.git
- Create a new folder and build with cmake (to be installed via brew if not already done)
mkdir pytorch-build
cd pytorch-build
cmake -DBUILD_SHARED_LIBS:BOOL=ON -DCMAKE_BUILD_TYPE:STRING=Release -DPYTHON_EXECUTABLE:PATH=`which python3` -DCMAKE_INSTALL_PREFIX:PATH=../pytorch-install ../pytorch
cmake --build . --target install
- Define the following variables before launching your cargo build.
export LIBTORCH=/path/to/pytorch-install
export LD_LIBRARY_PATH=${LIBTORCH}/lib:$LD_LIBRARY_PATH
If I'm not too clear on the procedures, don't hesitate to come back to me :)
Thanks for the detailed instructions, unfortunately I got a segfault in clang when compiling :-
[ 67%] Building C object sleef/src/libm/CMakeFiles/sleefsve.dir/sleefsimdsp.c.o clang: warning: argument unused during compilation: '-mfpu=neon' [-Wunused-command-line-argument] clang: error: unable to execute command: Segmentation fault: 11 clang: error: clang frontend command failed due to signal (use -v to see invocation) Apple clang version 12.0.5 (clang-1205.0.22.9) Target: aarch64-apple-darwin20.4.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin
I did a bit of searching but nothing looked useful.
@azw413 I just had this same problem while attempting to build sleef on an M1 Mac mini. Let me know if you figure this out - I haven't yet.
I have it working on my M1 mac, I used pip3 install torch
and copied the libraries from it. There are precompiled aarch64 macos dylibs in the wheels distributed with the torch
package. The precompiled aarch64 macos dylibs don't seem to be available anywhere else as far as I can tell.
While I'm here, I'd like to share the solution to a problem I was having on my M1 mac with this because it took me so long to solve:
I'm using a custom install of libtorch (from pip) at a custom path and kept getting rpath errors from dyld about how the library could not be found.
dyld: Library not loaded: @rpath/libtorch.dylib
Referenced from: /Users/mark/app/target/debug/app
Reason: image not found
sh: line 1: 34785 Abort trap: 6
Putting the dyld next to executable solved the problem but that's not a real solution. I kept trying to use DYLD_LIBRARY_PATH
, DYLD_FALLBACK_LIBRARY_PATH
, etc., I tried using println!("cargo:rustc-link-search=native=path")
in a build.rs, I tried a lot of things and nothing worked.
Eventually I checked env
and sure enough, DYLD_LIBRARY_PATH
was not there despite echo $DYLD_LIBRARY_PATH
showing a value... This is due to "System Integrity Protection": env vars starting with DYLD
are not passed to protected executables. The solution to this is to disable SIP or symlink your dylibs into /usr/local/lib
.
That was a massive headache to find out and I wasn't able to find any information about this until I started looking for why DYLD_LIBRARY_PATH
was not showing up in the output of env
. I hope sharing this information here is able to save someone that hassle.
For Xcode 13.1 users... I also had a problem with curl that is addressed here https://github.com/rust-lang/rust/issues/90342
An additional export is needed if you see ld: reference to symbol (which has not been assigned an address) __ZN4curl4init9INIT_CTOR17he9a2e3e218d0021fE in '__ZN4curl4init17he40dac590a19b3f7E'
Waz relationship between rust and python? Pytorch seems a python project, why could be resolve a issue about rust compile?
Here is the precise procedure to follow:
- Clone version 1.8.1 of Pytorch
git clone --branch v1.8.1 --recurse-submodule https://github.com/pytorch/pytorch.git
- Create a new folder and build with cmake (to be installed via brew if not already done)
mkdir pytorch-build cd pytorch-build cmake -DBUILD_SHARED_LIBS:BOOL=ON -DCMAKE_BUILD_TYPE:STRING=Release -DPYTHON_EXECUTABLE:PATH=`which python3` -DCMAKE_INSTALL_PREFIX:PATH=../pytorch-install ../pytorch cmake --build . --target install
- Define the following variables before launching your cargo build.
export LIBTORCH=/path/to/pytorch-install export LD_LIBRARY_PATH=${LIBTORCH}/lib:$LD_LIBRARY_PATH
If I'm not too clear on the procedures, don't hesitate to come back to me :)
I tried to use the command listed up there, but then I am hitting this error at the very end. Any clue how can I solve that?
[100%] Linking CXX shared library ../../lib/libcaffe2_detectron_ops.dylib
Undefined symbols for architecture arm64:
"___kmpc_for_static_fini", referenced from:
_.omp_outlined. in upsample_nearest_op.cc.o
"___kmpc_for_static_init_4", referenced from:
_.omp_outlined. in upsample_nearest_op.cc.o
"___kmpc_fork_call", referenced from:
caffe2::UpsampleNearestOp<float, caffe2::CPUContext>::RunOnDevice() in upsample_nearest_op.cc.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [lib/libcaffe2_detectron_ops.dylib] Error 1
make[1]: *** [modules/detectron/CMakeFiles/caffe2_detectron_ops.dir/all] Error 2
make: *** [all] Error 2
Thanks for the detailed instructions, unfortunately I got a segfault in clang when compiling :-
[ 67%] Building C object sleef/src/libm/CMakeFiles/sleefsve.dir/sleefsimdsp.c.o clang: warning: argument unused during compilation: '-mfpu=neon' [-Wunused-command-line-argument] clang: error: unable to execute command: Segmentation fault: 11 clang: error: clang frontend command failed due to signal (use -v to see invocation) Apple clang version 12.0.5 (clang-1205.0.22.9) Target: aarch64-apple-darwin20.4.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin
I did a bit of searching but nothing looked useful.
idk if this is related, since your error looks slightly different, but initially attempting to build libtorch i also got an error at around 67 %, which went away and i got a successful build after deleting the protobuf package (brew uninstall protobuf
)
also, for anyone who stumbles upon this thread later on, here's an official page by the pytorch team on how to build libtorch from source, it always got a successful build using that
also, there's now an arm version of libtorch on homebrew, so you can try brew install libtorch
before you build
also, if nothing above works for you, you can try to run brew install --build-from-source libtorch
to try to build it using homebrew
i've gotten successful builds of arm versions of libtorch with all three of the above variants
export LIBTORCH=/opt/homebrew/Cellar/libtorch/1.11.0_1
export LD_LIBRARY_PATH=${LIBTORCH}/lib:$LD_LIBRARY_PATH
from
brew ls --verbose libtorch | grep dylib
works great.
Do we know if the version of libtorch from brew on arm64 has support for the "MPS" Apple M1 GPU built in?
Hello all,
same question here, PyTorch does support but not sure for the lib torch.
Jianshu
export LIBTORCH=/opt/homebrew/Cellar/libtorch/1.11.0_1 export LD_LIBRARY_PATH=${LIBTORCH}/lib:$LD_LIBRARY_PATH
from
brew ls --verbose libtorch | grep dylib
works great.
Do we know if the version of libtorch from brew on arm64 has support for the "MPS" Apple M1 GPU built in?
Can you please show how to make it work on MacOS arm, I still have the same error after following your suggestions.
Thanks,
Jianshu
Closing in favor of #488