Cannot build the sciter-rs example, -lsciter-osx-64 not found - macos

I downloaded the sciter SDK, extracted it, and added it to my PATH (PATH = $PATH:DOWNLOAD_PATH/bin.osx). I then tried to run the example:
$ cargo run --example minimal
Compiling sciter-rs v0.4.1 (file:///Users/username/rust/rust-sciter)
error: linking with `cc` failed: exit code: 1
|
= note: "cc" "-m64" "-L" "/usr/local/lib/rustlib/x86_64-apple-darwin/lib" "/Users/username/rust/rust-sciter/target/debug/deps/sciter.0.o" "-o" "/Users/username/rust/rust-sciter/target/debug/deps/libsciter.dylib" "/Users/username/rust/rust-sciter/target/debug/deps/sciter.metadata.o" "-Wl,-dead_strip" "-nodefaultlibs" "-L" "/Users/username/rust/rust-sciter/target/debug/deps" "-L" "/usr/local/lib/rustlib/x86_64-apple-darwin/lib" "-l" "sciter-osx-64" "-Wl,-force_load,/var/folders/sk/76ww7m4n1j5210m9vxc88hy40000gn/T/rustc.SOetAnbslBvu/liblazy_static-7f1b96a3a3eb529d.rlib" "-Wl,-force_load,/var/folders/sk/76ww7m4n1j5210m9vxc88hy40000gn/T/rustc.SOetAnbslBvu/libobjc_foundation-01845fbb083d910e.rlib" "-Wl,-force_load,/var/folders/sk/76ww7m4n1j5210m9vxc88hy40000gn/T/rustc.SOetAnbslBvu/libblock-498e22772f250b8c.rlib" "-Wl,-force_load,/var/folders/sk/76ww7m4n1j5210m9vxc88hy40000gn/T/rustc.SOetAnbslBvu/libobjc_id-1b90e6745bca1976.rlib" "-Wl,-force_load,/var/folders/sk/76ww7m4n1j5210m9vxc88hy40000gn/T/rustc.SOetAnbslBvu/libobjc-9578ff0dad145ffa.rlib" "-Wl,-force_load,/var/folders/sk/76ww7m4n1j5210m9vxc88hy40000gn/T/rustc.SOetAnbslBvu/libmalloc_buf-7aa64dffd2b03b4f.rlib" "-Wl,-force_load,/var/folders/sk/76ww7m4n1j5210m9vxc88hy40000gn/T/rustc.SOetAnbslBvu/liblibc-ad32fde1bd850538.rlib" "-Wl,-force_load,/var/folders/sk/76ww7m4n1j5210m9vxc88hy40000gn/T/rustc.SOetAnbslBvu/libstd-a4729905.rlib" "-Wl,-force_load,/var/folders/sk/76ww7m4n1j5210m9vxc88hy40000gn/T/rustc.SOetAnbslBvu/libpanic_unwind-a4729905.rlib" "-Wl,-force_load,/var/folders/sk/76ww7m4n1j5210m9vxc88hy40000gn/T/rustc.SOetAnbslBvu/libunwind-a4729905.rlib" "-Wl,-force_load,/var/folders/sk/76ww7m4n1j5210m9vxc88hy40000gn/T/rustc.SOetAnbslBvu/librand-a4729905.rlib" "-Wl,-force_load,/var/folders/sk/76ww7m4n1j5210m9vxc88hy40000gn/T/rustc.SOetAnbslBvu/libcollections-a4729905.rlib" "-Wl,-force_load,/var/folders/sk/76ww7m4n1j5210m9vxc88hy40000gn/T/rustc.SOetAnbslBvu/librustc_unicode-a4729905.rlib" "-Wl,-force_load,/var/folders/sk/76ww7m4n1j5210m9vxc88hy40000gn/T/rustc.SOetAnbslBvu/liballoc-a4729905.rlib" "-Wl,-force_load,/var/folders/sk/76ww7m4n1j5210m9vxc88hy40000gn/T/rustc.SOetAnbslBvu/liballoc_system-a4729905.rlib" "-Wl,-force_load,/var/folders/sk/76ww7m4n1j5210m9vxc88hy40000gn/T/rustc.SOetAnbslBvu/liblibc-a4729905.rlib" "-Wl,-force_load,/var/folders/sk/76ww7m4n1j5210m9vxc88hy40000gn/T/rustc.SOetAnbslBvu/libcore-a4729905.rlib" "/var/folders/sk/76ww7m4n1j5210m9vxc88hy40000gn/T/rustc.SOetAnbslBvu/libcompiler_builtins-a4729905.rlib" "-framework" "Foundation" "-l" "System" "-l" "objc" "-l" "objc" "-l" "objc" "-l" "System" "-l" "pthread" "-l" "c" "-l" "m" "-dynamiclib" "-Wl,-dylib"
= note: ld: library not found for -lsciter-osx-64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I don't understand why sciter-osx-64 library not found.

I assume you are referring to rust-sciter. The getting started instructions start with:
Download Sciter SDK and extract it somewhere.
Add target platform binaries to PATH (bin, bin.osx or bin.gtk) and install Sciter shared library to your LIBRARY_PATH.
Build library and run the minimal sciter sample: cargo run --example minimal.
It looks like you didn't install the Sciter shared library (sciter-osx-64.dylib) to your LIBRARY_PATH.

Related

Windows 10 error: linking with `x86_64-w64-mingw32-gcc` failed: exit code: 1

I am struggling to fix error: linking with 'x86_64-w64-mingw32-gcc; failed: exit code: 1, I have installed TDM-GCC-64 and Cygwin and added them to PATH as well as updating the c++ 2019 redistributable. I am attempting to use GLFW or an alternative but when ever I try I to run the rust projects that use GLFW or its alternatives I get this error note: C:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lgcc_eh is there something else i'm missing. Thanks
Full error below
error: linking with `x86_64-w64-mingw32-gcc` failed: exit code: 1
|
= note: "x86_64-w64-mingw32-gcc" "-fno-use-linker-plugin" "-Wl,--dynamicbase" "-Wl,--disable-auto-image-base" "-m64" "-Wl,--high-entropy-va" "C:\\Users\\peter\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\rsbegin.o" "C:\\Users\\peter\\Desktop\\Rust_Programming\\Code\\Opengl_Lessons\\learn-opengl-rs\\target\\debug\\build\\num-complex-1d9dcc0a2e0581fe\\build_script_build-1d9dcc0a2e0581fe.build_script_build.253ad390-cgu.0.rcgu.o" "C:\\Users\\peter\\Desktop\\Rust_Programming\\Code\\Opengl_Lessons\\learn-opengl-rs\\target\\debug\\build\\num-complex-1d9dcc0a2e0581fe\\build_script_build-1d9dcc0a2e0581fe.build_script_build.253ad390-cgu.1.rcgu.o" "C:\\Users\\peter\\Desktop\\Rust_Programming\\Code\\Opengl_Lessons\\learn-opengl-rs\\target\\debug\\build\\num-complex-1d9dcc0a2e0581fe\\build_script_build-1d9dcc0a2e0581fe.build_script_build.253ad390-cgu.10.rcgu.o" "C:\\Users\\peter\\Desktop\\Rust_Programming\\Code\\Opengl_Lessons\\learn-opengl-rs\\target\\debug\\build\\num-complex-1d9dcc0a2e0581fe\\build_script_build-1d9dcc0a2e0581fe.build_script_build.253ad390-cgu.11.rcgu.o" "C:\\Users\\peter\\Desktop\\Rust_Programming\\Code\\Opengl_Lessons\\learn-opengl-rs\\target\\debug\\build\\num-complex-1d9dcc0a2e0581fe\\build_script_build-1d9dcc0a2e0581fe.build_script_build.253ad390-cgu.12.rcgu.o" "C:\\Users\\peter\\Desktop\\Rust_Programming\\Code\\Opengl_Lessons\\learn-opengl-rs\\target\\debug\\build\\num-complex-1d9dcc0a2e0581fe\\build_script_build-1d9dcc0a2e0581fe.build_script_build.253ad390-cgu.13.rcgu.o" "C:\\Users\\peter\\Desktop\\Rust_Programming\\Code\\Opengl_Lessons\\learn-opengl-rs\\target\\debug\\build\\num-complex-1d9dcc0a2e0581fe\\build_script_build-1d9dcc0a2e0581fe.build_script_build.253ad390-cgu.14.rcgu.o" "C:\\Users\\peter\\Desktop\\Rust_Programming\\Code\\Opengl_Lessons\\learn-opengl-rs\\target\\debug\\build\\num-complex-1d9dcc0a2e0581fe\\build_script_build-1d9dcc0a2e0581fe.build_script_build.253ad390-cgu.15.rcgu.o" "C:\\Users\\peter\\Desktop\\Rust_Programming\\Code\\Opengl_Lessons\\learn-opengl-rs\\target\\debug\\build\\num-complex-1d9dcc0a2e0581fe\\build_script_build-1d9dcc0a2e0581fe.build_script_build.253ad390-cgu.2.rcgu.o" "C:\\Users\\peter\\Desktop\\Rust_Programming\\Code\\Opengl_Lessons\\learn-opengl-rs\\target\\debug\\build\\num-complex-1d9dcc0a2e0581fe\\build_script_build-1d9dcc0a2e0581fe.build_script_build.253ad390-cgu.3.rcgu.o" "C:\\Users\\peter\\Desktop\\Rust_Programming\\Code\\Opengl_Lessons\\learn-opengl-rs\\target\\debug\\build\\num-complex-1d9dcc0a2e0581fe\\build_script_build-1d9dcc0a2e0581fe.build_script_build.253ad390-cgu.4.rcgu.o" "C:\\Users\\peter\\Desktop\\Rust_Programming\\Code\\Opengl_Lessons\\learn-opengl-rs\\target\\debug\\build\\num-complex-1d9dcc0a2e0581fe\\build_script_build-1d9dcc0a2e0581fe.build_script_build.253ad390-cgu.5.rcgu.o" "C:\\Users\\peter\\Desktop\\Rust_Programming\\Code\\Opengl_Lessons\\learn-opengl-rs\\target\\debug\\build\\num-complex-1d9dcc0a2e0581fe\\build_script_build-1d9dcc0a2e0581fe.build_script_build.253ad390-cgu.6.rcgu.o" "C:\\Users\\peter\\Desktop\\Rust_Programming\\Code\\Opengl_Lessons\\learn-opengl-rs\\target\\debug\\build\\num-complex-1d9dcc0a2e0581fe\\build_script_build-1d9dcc0a2e0581fe.build_script_build.253ad390-cgu.7.rcgu.o" "C:\\Users\\peter\\Desktop\\Rust_Programming\\Code\\Opengl_Lessons\\learn-opengl-rs\\target\\debug\\build\\num-complex-1d9dcc0a2e0581fe\\build_script_build-1d9dcc0a2e0581fe.build_script_build.253ad390-cgu.8.rcgu.o" "C:\\Users\\peter\\Desktop\\Rust_Programming\\Code\\Opengl_Lessons\\learn-opengl-rs\\target\\debug\\build\\num-complex-1d9dcc0a2e0581fe\\build_script_build-1d9dcc0a2e0581fe.build_script_build.253ad390-cgu.9.rcgu.o" "C:\\Users\\peter\\Desktop\\Rust_Programming\\Code\\Opengl_Lessons\\learn-opengl-rs\\target\\debug\\build\\num-complex-1d9dcc0a2e0581fe\\build_script_build-1d9dcc0a2e0581fe.3xe3r320o5t2g1tt.rcgu.o" "-L" "C:\\Users\\peter\\Desktop\\Rust_Programming\\Code\\Opengl_Lessons\\learn-opengl-rs\\target\\debug\\deps" "-L" "C:\\Users\\peter\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib" "-Wl,--start-group" "-Wl,-Bstatic" "C:\\Users\\peter\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libstd-9075868f02c39105.rlib" "C:\\Users\\peter\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libpanic_unwind-9428c324e8b3666b.rlib" "C:\\Users\\peter\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libobject-4a98078f239020c3.rlib" "C:\\Users\\peter\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libmemchr-6757767b31fe77e1.rlib" "C:\\Users\\peter\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libaddr2line-c0d2da11c6d2d6c0.rlib" "C:\\Users\\peter\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libgimli-9e7d4e8bc407ad15.rlib" "C:\\Users\\peter\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\librustc_demangle-da42fc4024365a2c.rlib" "C:\\Users\\peter\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libstd_detect-89ac367f33223d21.rlib" "C:\\Users\\peter\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libhashbrown-d506a327105b7f9b.rlib" "C:\\Users\\peter\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\librustc_std_workspace_alloc-59684a51af165391.rlib" "C:\\Users\\peter\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libunwind-76b6cbab8df641fe.rlib" "C:\\Users\\peter\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libcfg_if-1f71fd1e2c1fff1d.rlib" "C:\\Users\\peter\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\liblibc-941c197b7acaf3f9.rlib" "C:\\Users\\peter\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\liballoc-ed65eeea771bb49a.rlib" "C:\\Users\\peter\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\librustc_std_workspace_core-206ecc270c58e4f3.rlib" "C:\\Users\\peter\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libcore-1063c1f162c501e3.rlib" "-Wl,--end-group" "C:\\Users\\peter\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libcompiler_builtins-3f91c8bbaf203c3c.rlib" "-Wl,-Bdynamic" "-lkernel32" "-lws2_32" "-lbcrypt" "-ladvapi32" "-luserenv" "-lkernel32" "-lgcc_eh" "-l:libpthread.a" "-lmsvcrt" "-lmingwex" "-lmingw32" "-lgcc" "-lmsvcrt" "-luser32" "-lkernel32" "-Wl,--nxcompat" "-L" "C:\\Users\\peter\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib" "-o" "C:\\Users\\peter\\Desktop\\Rust_Programming\\Code\\Opengl_Lessons\\learn-opengl-rs\\target\\debug\\build\\num-complex-1d9dcc0a2e0581fe\\build_script_build-1d9dcc0a2e0581fe.exe" "-Wl,--gc-sections" "-no-pie" "-nodefaultlibs" "C:\\Users\\peter\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\rsend.o"
= note: C:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lgcc_eh
collect2.exe: error: ld returned 1 exit status
First of all: TDM, Cygwin, and 2019-redestributable are three different tool-chains. Similar, but different, you should not mix them. You need to choose one environment, meaning MinGW of TDM flavor, Cygwin, or Visual Studio. And stick to them. It is sometimes possible to reuse some pieces of tool chains, but not easy and require good understanding of both tool-chains.
Second: read the error message "ld.exe: cannot find -lgcc_eh" - that means your linker cannot find a library gcc_eh. What is that library? Which project you are trying to compile?
Go to the projects documentation, find there installation instructions and do as written. This instruction will (most likely) have suggestion which tool-chain to use too.

How do I cross compile a Rust application from macOS x86 to macOS Silicon?

I want to cross compile a Rust program from my x86 Mac to a binary that can run on a Silicon Mac, and I can't figure out linking.
I have:
An x86 Mac running macOS 10.15.7 Catalina
A Rust project called riff
cargo 1.51.0 (43b129a20 2021-03-16) recently retrieved using rustup
Xcode version 12.4 (12D4e)
I want to compile this into a binary that can run on a Silicon (ARM) Mac. This could be one of:
A Silicon specific binary
A Universal binary that can run on either Silicon or x86
I have tried (through ./release.sh --dry):
rustup target add aarch64-apple-darwin
cargo build --release --target=aarch64-apple-darwin
The result was too long to paste in here, so this is an excerpt:
Compiling riff v0.1.0 (/Users/johan/src/riff)
error: linking with `cc` failed: exit code: 1
|
= note: "cc" "-arch arm64" "-L" "/Users/johan/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib" "/Users/johan/src/riff/target/aarch64-apple-darwin/release/deps/riff.1g47gi93dk96t2va.rcgu.o" ... "/Users/johan/src/riff/target/aarch64-apple-darwin/release/deps/riff.thread_local-9baf7723f72eef37.thread_local.7fl1y1d9-cgu.9.rcgu.o.rcgu.o" "/Users/johan/src/riff/target/aarch64-apple-darwin/release/deps/riff.unwind-082f7f4ff792426f.unwind.7rkx2ya0-cgu.0.rcgu.o.rcgu.o" "-o /Users/johan/src/riff/target/aarch64-apple-darwin/release/deps/riff" "-Wl,-dead_strip" "-nodefaultlibs" "-L" "/Users/johan/src/riff/target/aarch64-apple-darwin/release/deps" "-L" "/Users/johan/src/riff/target/release/deps" "-L" "/Users/johan/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib" "/Users/johan/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libcompiler_builtins-9eb7dc999785b765.rlib" "-lSystem" "-lresolv" "-lc" "-lm"
= note: ld: warning: ignoring file /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libresolv.tbd, missing required architecture arm64 in file /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libresolv.tbd
ld: warning: ignoring file /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libm.tbd, missing required architecture arm64 in file /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libm.tbd
ld: warning: ignoring file /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libc.tbd, missing required architecture arm64 in file /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libc.tbd
ld: warning: ignoring file /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libSystem.tbd, missing required architecture arm64 in file /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libSystem.tbd
Undefined symbols for architecture arm64:
"__tlv_atexit", referenced from:
std::sys::unix::thread_local_dtor::register_dtor::h4ece0fa32a190720 in riff.std-e40bd6a3af835df4.std.5bd9rdky-cgu.0.rcgu.o.rcgu.o
...
"_free", referenced from:
alloc::raw_vec::finish_grow::hd210c40bc8674cab (.llvm.18296587876935678160) in riff.addr2line-220464f1af330a49.addr2line.6xizm3st-cgu.1.rcgu.o.rcgu.o
addr2line::path_push::hf1048f2514c3ed28 in riff.addr2line-220464f1af330a49.addr2line.6xizm3st-cgu.5.rcgu.o.rcgu.o
alloc::raw_vec::finish_grow::ha5f485527a5c6598 in riff.addr2line-a950b2eed913eb15.addr2line.1hygsg7c-cgu.0.rcgu.o.rcgu.o
addr2line::path_push::h891160d400ff153e in riff.addr2line-a950b2eed913eb15.addr2line.1hygsg7c-cgu.0.rcgu.o.rcgu.o
core::ptr::drop_in_place$LT$aho_corasick..prefilter..Packed$GT$::h03bcd2abfab8068d in riff.aho_corasick-5d6c900557669556.aho_corasick.4z4l4vb2-cgu.0.rcgu.o.rcgu.o
core::ptr::drop_in_place$LT$aho_corasick..packed..pattern..Patterns$GT$::h0c7fda104debb352 in riff.aho_corasick-5d6c900557669556.aho_corasick.4z4l4vb2-cgu.0.rcgu.o.rcgu.o
core::ptr::drop_in_place$LT$alloc..vec..Vec$LT$alloc..vec..Vec$LT$u8$GT$$GT$$GT$::h75f2b558c0581f8d in riff.aho_corasick-5d6c900557669556.aho_corasick.4z4l4vb2-cgu.0.rcgu.o.rcgu.o
...
(maybe you meant: alloc::alloc::box_free::ha8718384ecb60252 (.llvm.10945926475227631812), alloc::alloc::box_free::h58e664059c03effd (.llvm.10945926475227631812) , alloc::alloc::box_free::h75cae1a8684a32ce (.llvm.8938487907768303252) , alloc::alloc::box_free::h0459f8e1bcc5ae0a (.llvm.8938487907768303252) , alloc::alloc::box_free::hc3b2f94f9be4da06 (.llvm.7882408235892284297) , alloc::alloc::box_free::h75cae1a8684a32ce (.llvm.7882408235892284297) , alloc::alloc::box_free::h0459f8e1bcc5ae0a (.llvm.11547294393004044273) , alloc::alloc::box_free::hcc8806ce168336a8 (.llvm.2537316772799228199) , alloc::alloc::box_free::h305ed20a6d3d49c7 (.llvm.11075277010792284734) , alloc::alloc::box_free::h384e6b725c5ad166 (.llvm.7882408235892284297) , alloc::alloc::box_free::h0459f8e1bcc5ae0a (.llvm.7882408235892284297) , alloc::alloc::box_free::hb8cf920d803cfa22 (.llvm.4992613404806278909) , alloc::alloc::box_free::h90dd1ed16b644fc1 (.llvm.9562203231941335137) , alloc::alloc::box_free::h9e3286b91a0737ba (.llvm.4992613404806278909) , alloc::alloc::box_free::h75cae1a8684a32ce (.llvm.11547294393004044273) )
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Add the appropriate target
rustup target add aarch64-apple-darwin
Compile your code using the macOS 11.x SDK 1:
SDKROOT=$(xcrun -sdk macosx11.1 --show-sdk-path) \
MACOSX_DEPLOYMENT_TARGET=$(xcrun -sdk macosx11.1 --show-sdk-platform-version) \
cargo build --target=aarch64-apple-darwin
This produces a single-architecture binary:
file target/aarch64-apple-darwin/debug/riff
target/aarch64-apple-darwin/debug/riff: Mach-O 64-bit executable arm64
1 — Find what the current available SDKs are via xcodebuild -showsdks.

Cross-compile for MIPS MT7688 OpenWRT on OSX (mipsel-unknown-linux-musl)

When I try to cross-compile a Cargo starter main.rs file for little-endian MIPS (MT7688 processor running OpenWRT) on OSX using rustc 1.32.0-nightly, I get the following error:
cargo build --target=mipsel-unknown-linux-musl
Compiling led v0.1.0 (/Users/petrus/Projects/led)
error: linking with `cc` failed: exit code: 1
|
= note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-Wl,--eh-frame-hdr" "-L" "/Users/petrus/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/mipsel-unknown-linux-musl/lib" "/Users/petrus/Projects/led/target/mipsel-unknown-linux-musl/debug/deps/led-fb2a88ec64854daf.2kthj4han7xcr84g.rcgu.o" "/Users/petrus/Projects/led/target/mipsel-unknown-linux-musl/debug/deps/led-fb2a88ec64854daf.440j3fk0cam0b0pu.rcgu.o" "/Users/petrus/Projects/led/target/mipsel-unknown-linux-musl/debug/deps/led-fb2a88ec64854daf.482rers61msj2848.rcgu.o" "/Users/petrus/Projects/led/target/mipsel-unknown-linux-musl/debug/deps/led-fb2a88ec64854daf.498udk2wtgjsw4ib.rcgu.o" "/Users/petrus/Projects/led/target/mipsel-unknown-linux-musl/debug/deps/led-fb2a88ec64854daf.4uh6jdaux45o6bh1.rcgu.o" "/Users/petrus/Projects/led/target/mipsel-unknown-linux-musl/debug/deps/led-fb2a88ec64854daf.5fq5qqfqkwjepod2.rcgu.o" "-o" "/Users/petrus/Projects/led/target/mipsel-unknown-linux-musl/debug/deps/led-fb2a88ec64854daf" "/Users/petrus/Projects/led/target/mipsel-unknown-linux-musl/debug/deps/led-fb2a88ec64854daf.49n6u1xnbbs66t12.rcgu.o" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro" "-Wl,-znow" "-nodefaultlibs" "-L" "/Users/petrus/Projects/led/target/mipsel-unknown-linux-musl/debug/deps" "-L" "/Users/petrus/Projects/led/target/debug/deps" "-L" "/Users/petrus/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/mipsel-unknown-linux-musl/lib" "-Wl,--start-group" "-Wl,-Bstatic" "/Users/petrus/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/mipsel-unknown-linux-musl/lib/libstd-27a0dffe96f2ad3e.rlib" "/Users/petrus/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/mipsel-unknown-linux-musl/lib/libpanic_unwind-fe8b80af161a561e.rlib" "/var/folders/rl/b7dvjss14wj6415t0v4f7z3m0000gn/T/rustcFd840X/libunwind-ecc019d8c6cb3f8a.rlib" "/var/folders/rl/b7dvjss14wj6415t0v4f7z3m0000gn/T/rustcFd840X/liblibc-5d68beb2e4661bda.rlib" "/Users/petrus/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/mipsel-unknown-linux-musl/lib/liballoc-de565f8c0b8e0971.rlib" "/Users/petrus/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/mipsel-unknown-linux-musl/lib/librustc_std_workspace_core-0a55bee6cc97e346.rlib" "/Users/petrus/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/mipsel-unknown-linux-musl/lib/libcore-4075eb2b0854a330.rlib" "-Wl,--end-group" "/Users/petrus/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/mipsel-unknown-linux-musl/lib/libcompiler_builtins-ecf284221505c8a3.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lc"
= note: clang: warning: argument unused during compilation: '-pie' [-Wunused-command-line-argument]
ld: unknown option: --as-needed
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Running with RUSTFLAGS="-C linker=lld" throws:
RUSTFLAGS="-C linker=lld" cargo build --target=mipsel-unknown-linux-musl
Compiling led v0.1.0 (/Users/petrus/Projects/led)
error: linker `lld` not found
|
= note: No such file or directory (os error 2)
error: aborting due to previous error
error: Could not compile `led`.
To learn more, run the command again with --verbose.
Also tried with RUSTFLAGS="-C linker=rust-lld", which throws:
rust-lld: error: unable to find library -lgcc_s
rust-lld: error: unable to find library -lc
As I understand, I need to specify a linker toolchain, which I don't know how to procure. I also tried compiling with xargo and cross and dockcross/linux-mipsel, with no luck.
I would build it on the device itself, but rustup won't install Rust on the MT7688. How do I get and specify the correct MIPS (little-endian) linker toolchain?
Update: I found a pre-compiled MIPS GCC for macOS, which throws `mipsel-elf/bin/ld: unrecognized option '-Wl,--as-needed' or "error adding symbols: Bad value" when I try to specify mipsel-elf-gcc it as the linker:
rustc --target=mipsel-unknown-linux-musl -C linker=/Users/petrus/Projects/wallfly/respeaker/bin/gcc-mips/bin/mipsel-elf-gcc ./src/main.rs
error: linking with `/Users/petrus/Projects/bin/gcc-mips/bin/mipsel-elf-gcc` failed: exit code: 1
|
= note: "/Users/petrus/Projects/bin/gcc-mips/bin/mipsel-elf-gcc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-Wl,--eh-frame-hdr" "-L" "/Users/petrus/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/mipsel-unknown-linux-musl/lib" "main.main.7rcbfp3g-cgu.0.rcgu.o" "main.main.7rcbfp3g-cgu.1.rcgu.o" "main.main.7rcbfp3g-cgu.2.rcgu.o" "main.main.7rcbfp3g-cgu.3.rcgu.o" "main.main.7rcbfp3g-cgu.4.rcgu.o" "main.main.7rcbfp3g-cgu.5.rcgu.o" "-o" "main" "main.4s37gsrti678ik8u.rcgu.o" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro" "-Wl,-znow" "-nodefaultlibs" "-L" "/Users/petrus/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/mipsel-unknown-linux-musl/lib" "-Wl,--start-group" "-Wl,-Bstatic" "/Users/petrus/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/mipsel-unknown-linux-musl/lib/libstd-27a0dffe96f2ad3e.rlib" "/Users/petrus/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/mipsel-unknown-linux-musl/lib/libpanic_unwind-fe8b80af161a561e.rlib" "/var/folders/rl/b7dvjss14wj6415t0v4f7z3m0000gn/T/rustcLDTUyV/libunwind-ecc019d8c6cb3f8a.rlib" "/var/folders/rl/b7dvjss14wj6415t0v4f7z3m0000gn/T/rustcLDTUyV/liblibc-5d68beb2e4661bda.rlib" "/Users/petrus/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/mipsel-unknown-linux-musl/lib/liballoc-de565f8c0b8e0971.rlib" "/Users/petrus/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/mipsel-unknown-linux-musl/lib/librustc_std_workspace_core-0a55bee6cc97e346.rlib" "/Users/petrus/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/mipsel-unknown-linux-musl/lib/libcore-4075eb2b0854a330.rlib" "-Wl,--end-group" "/Users/petrus/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/mipsel-unknown-linux-musl/lib/libcompiler_builtins-ecf284221505c8a3.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lc"
= note: /Users/petrus/Projects/bin/gcc-mips/bin/../lib/gcc/mipsel-elf/7.1.0/../../../../mipsel-elf/bin/ld: /Users/petrus/Projects/bin/gcc-mips/bin/../lib/gcc/mipsel-elf/7.1.0/crtbegin.o: relocation R_MIPS_HI16 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
/Users/petrus/Projects/bin/gcc-mips/bin/../lib/gcc/mipsel-elf/7.1.0/crtbegin.o: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
Maybe I'm specifying it wrong?
try
cargo install cross
and then
cross build --release --target mipsel-unknown-linux-musl

OSX Sierra Tensorflow build error: ld: file not found: #rpath/CUDA.framework/Versions/A/CUDA

I have followed the instruction in:
https://gist.github.com/notilas/a30e29ce514970e821a34153c1e78b3f
But cannot complete it.
OSX: Sierra
Tensorflow version 1.1.0 (Google says v1.2 does not support OSX CUDA)
CUDA Tool kit : 8.0
CUDNN : 6.0
Xcode : 7.2.1
Anaconda : 4.2 (Python version 3.5)
Error Log:
ERROR: /Users/so041e/ml/tensorflow/tensorflow/python/BUILD:2534:1:
Linking of rule '//tensorflow/python:_pywrap_tensorflow_internal.so'
failed: link_dynamic_library.sh failed: error executing command
external/bazel_tools/tools/cpp/link_dynamic_library.sh no ignored
ignored ignored
external/local_config_cuda/crosstool/clang/bin/crosstool_wrapper_driver_is_not_gcc
-shared -o ... (remaining 455 argument(s) skipped): com.google.devtools.build.lib.shell.BadExitStatusException: Process
exited with status 1.
clang: warning: argument unused during compilation: '-pthread'
ld: file not found: #rpath/CUDA.framework/Versions/A/CUDA for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Target //tensorflow/tools/pip_package:build_pip_package failed to build
Use --verbose_failures to see the command lines of failed build steps.
[.bash_profile]
export PATH="/Users/so041e/anaconda/bin:$PATH"
export CUDA_HOME=/usr/local/cuda
export HOME=/Users/so041e
export PATH="$CUDA_HOME/bin:$PATH"
export DYLD_LIBRARY_PATH="/usr/local/cuda/lib:/Developer/NVIDIA/CUDA8.0/lib":$DYLD_LIBRARY_PATH
export LD_LIBRARY_PATH=$DYLD_LIBRARY_PATH
export PATH=$DYLD_LIBRARY_PATH:$PATH
export PATH="//anaconda/bin:$PATH"
Moved CUDNN lib and include to /user/local/cuda
sudo mv -v cuda/lib/libcudnn* /usr/local/cuda/lib
sudo mv -v cuda/include/cudnn.h /usr/local/cuda/include
Didn't use "vent" Just used single python 3.5 at this moment.
Tried both, but no difference.
bazel build --config=cuda --config=opt --action_env PATH --action_env LD_LIBRARY_PATH --action_env DYLD_LIBRARY_PATH //tensorflow/tools/pip_package:build_pip_package
bazel build --config=cuda //tensorflow/tools/pip_package:build_pip_package
This might be a bit late, but I had this exact same problem and I managed to fix it.
First, #rpath/CUDA.framework/Versions/A/CUDA is a dynamic library install name for libcuda.dylib, which is found in /usr/local/cuda/lib. So do
otool -l /usr/local/cuda/lib/libcuda.dylib
Check where you see #rpath/CUDA.framework/Versions/A/CUDA; on my system it was in the command LC_REEXPORT_DYLIB. From here, it seems dyld doesn't resolve the #rpath for the LC_REEXPORT_DYLIB command, only LC_LOAD*_DYLIB commands. Meaning, it looks for the literal path "#rpath/CUDA.framework/Versions/A/CUDA". So you're going to have to change that by doing
sudo install_name_tool -change #rpath/CUDA.framework/Versions/A/CUDA \
/Library/Frameworks/CUDA.framework/Versions/A/CUDA \
/usr/local/cuda/lib/libcuda.dylib
This should resolve your problem.
Now why your system (and mine) has this install name for libcuda.dylib? I have absolutely no clue.

Error when compiling Glog

I got an issue when compiling glog by running 'make' after running './configure'
Then I got an error:
Undefined symbols for architecture x86_64:
"testing::internal::StrStreamToString(std::__1::basic_stringstream, std::__1::allocator >)", referenced from:
testing::internal::String testing::internal::StreamableToString(void const const&) in logging_unittest-logging_unittest.o
testing::internal::String testing::internal::StreamableToString(int const&) in logging_unittest-logging_unittest.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: * [logging_unittest] Error 1
I am using glog-0.3.3 on Mac OS X.
SO how can i turn of testing while compiling glog?
In another context, i installed glog and gflags by using Macport, then i run a small program. It will generate a error :
"ERROR: unknown command line flag 'logtostderr'"
I believe that's the problem with linking to gflags. So how can i fix it. Thanks
GLog needs GFlags compiled in the "google" namespace instead of the now default "gflags" namespace.
In order to set this namespace you must compile and install gflags from source and set the GFLAGS_NAMESPACE variable to "google".
Here are the steps I followed in Kubuntu 14.04 and should be similar to what you should do in Mac OSX. These will place the GFlags source in /usr/local/src and install the library in the /usr/local/lib&include directories. The last command (ldconfig) registers the library in the system.
cd /usr/local/src/
cp /path/to/downloaded/gflags-2.1.1.tar.gz .
sudo tar xzf gflags-2.1.1.tar.gz
cd /tmp
mkdir buildgflags
cd buildgflags
cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DBUILD_SHARED_LIBS=ON \
-DGFLAGS_NAMESPACE=google -G"Unix Makefiles" /usr/local/src/gflags-2.1.1/
make
sudo make install
sudo ldconfig
Alternatively you can apply the following patch in the GLog source (attached in the last reply):
https://code.google.com/p/google-glog/issues/detail?id=194
It basically uses the namespace of gflags after the includes on the GLogs unit test source files like so:
#ifdef HAVE_LIB_GFLAGS
#include <gflags/gflags.h>
using namespace gflags;
#endif

Resources