Closed Connoropolous closed 3 years ago
I've overcome this for now by:
installing libsodium natively manually myself by following these instructions: https://libsodium.gitbook.io/doc/installation#compilation-on-unix-like-systems
Then, if I run a cargo ...
command with a rust_sodium-sys
dependency, I add the env variables:
RUST_SODIUM_LIB_DIR=~/Downloads/libsodium-1.0.17 RUST_SODIUM_SHARED=1
Not sure what's wrong with the native installation process
Actually, this is now my working solution...
add this to my .profile bash profile
export RUST_SODIUM_USE_PKG_CONFIG=1
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
export PKG_CONFIG_PATH
and don't use these: RUST_SODIUM_LIB_DIR=~/Downloads/libsodium-1.0.17 RUST_SODIUM_SHARED=1
a similar issue was solved by zcash thus: https://github.com/zcash/zcash/pull/4157
I tried a couple of things via zcash solution, but didn't get anything to go as yet.
@Connoropolous 's workaround is going for me too though 👍
Hey, I think this may be relevant:
https://github.com/sodiumoxide/sodiumoxide/issues/341#issuecomment-514217654
The associated PR changes:
let mut configure_cmd = Command::new("./configure");
to:
let mut configure_cmd = Command::new(fs::canonicalize(source_dir.join("configure")).unwrap());
Which I think is the same issue here with path portability.
Ok changing this line https://github.com/maidsafe/rust_sodium/blob/master/rust_sodium-sys/build.rs#L375 from:
let mut configure_cmd = Command::new("./configure");
to (or the something more idiomatically Rust--I'm green):
let mut configure_cmd = Command::new(fs::canonicalize(Path::new(&source_dir).join("configure")).unwrap());
Should fix it.
I don't have permissions to create a branch/PR here, but here is a patch to the current master
branch:
diff --git a/rust_sodium-sys/build.rs b/rust_sodium-sys/build.rs
index 1b69aa79..17fff9fe 100644
--- a/rust_sodium-sys/build.rs
+++ b/rust_sodium-sys/build.rs
@@ -372,7 +372,7 @@ fn get_libsodium() {
// Run `./configure`
let prefix_arg = format!("--prefix={}", install_dir);
- let mut configure_cmd = Command::new("./configure");
+ let mut configure_cmd = Command::new(fs::canonicalize(Path::new(&source_dir).join("configure")).unwrap());
if !compiler.is_empty() {
configure_cmd.env("CC", &compiler);
}
The rust_sodium crate is no longer maintained by MaidSafe, you should check whether it is actively maintained on Subspace as per the readme, or switch to a modern alternative.
error: failed to run custom build command for
rust_sodium-sys v0.10.4
Caused by: process didn't exit successfully:
/Users/xxx/code/holochain/sim2h/target/debug/build/rust_sodium-sys-2e21ff8278bca277/build-script-build
(exit code: 101) --- stdout cargo:rerun-if-env-changed=RUST_SODIUM_LIB_DIR cargo:rerun-if-env-changed=RUST_SODIUM_USE_PKG_CONFIG cargo:rerun-if-env-changed=RUST_SODIUM_SHARED OPT_LEVEL = Some("0") TARGET = Some("x86_64-apple-darwin") HOST = Some("x86_64-apple-darwin") CC_x86_64-apple-darwin = None CC_x86_64_apple_darwin = None HOST_CC = None CC = Some("clang") CFLAGS_x86_64-apple-darwin = None CFLAGS_x86_64_apple_darwin = None HOST_CFLAGS = None CFLAGS = None CRATE_CC_NO_DEFAULTS = None DEBUG = Some("true") cargo:rerun-if-env-changed=RUST_SODIUM_DISABLE_PIE--- stderr thread 'main' panicked at 'Failed to run './configure': No such file or directory (os error 2) ', /Users/xxx/code/holochain/rust/.cargo/registry/src/github.com-1ecc6299db9ec823/rust_sodium-sys-0.10.4/build.rs:393:13 stack backtrace: 0: backtrace::backtrace::libunwind::trace at /Users/vsts/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.29/src/backtrace/libunwind.rs:88 1: backtrace::backtrace::trace_unsynchronized at /Users/vsts/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.29/src/backtrace/mod.rs:66 2: std::sys_common::backtrace::_print at src/libstd/sys_common/backtrace.rs:47 3: std::sys_common::backtrace::print at src/libstd/sys_common/backtrace.rs:36 4: std::panicking::default_hook::{{closure}} at src/libstd/panicking.rs:200 5: std::panicking::default_hook at src/libstd/panicking.rs:214 6: std::panicking::rust_panic_with_hook at src/libstd/panicking.rs:477 7: std::panicking::continue_panic_fmt at src/libstd/panicking.rs:384 8: std::panicking::begin_panic_fmt at src/libstd/panicking.rs:339 9: build_script_build::get_libsodium::{{closure}} at ./build.rs:393 10: core::result::Result<T,E>::unwrap_or_else at /rustc/69656fa4cbafc378fd63f9186d93b0df3cdd9320/src/libcore/result.rs:818 11: build_script_build::get_libsodium at ./build.rs:386 12: build_script_build::main at ./build.rs:80 13: std::rt::lang_start::{{closure}} at /rustc/69656fa4cbafc378fd63f9186d93b0df3cdd9320/src/libstd/rt.rs:64 14: std::rt::lang_start_internal::{{closure}} at src/libstd/rt.rs:49 15: std::panicking::try::do_call at src/libstd/panicking.rs:296 16: __rust_maybe_catch_panic at src/libpanic_unwind/lib.rs:82 17: std::panicking::try at src/libstd/panicking.rs:275 18: std::panic::catch_unwind at src/libstd/panic.rs:394 19: std::rt::lang_start_internal at src/libstd/rt.rs:48 20: std::rt::lang_start at /rustc/69656fa4cbafc378fd63f9186d93b0df3cdd9320/src/libstd/rt.rs:64
warning: build failed, waiting for other jobs to finish... error: build failed