Building safe_ffi error with libsodium on Debian

OS: Debian Jessie
Nightly Rust, updated system.
Pulling straight from the git repo for all safe code. Occurred while attempting to build safe_ffi.
Note: I also installed libsodium as per the directions on README.md for safe_ffi
Note 2: I tried building sodiumoxide separately and got the same error

Compiling libsodium-sys v0.0.8
Running /home/patrick/sodiumoxide/sodiumoxide/target/debug/build/libsodium-sys-1bd84c2c2959fcd6/build-script-build
Fresh pkg-config v0.3.5
Fresh rustc-serialize v0.3.16
Fresh byteorder v0.3.13
Fresh libc v0.1.10
Fresh cbor v0.3.16
failed to run custom build command for libsodium-sys v0.0.8
Process didn’t exit successfully: /home/patrick/sodiumoxide/sodiumoxide/target/debug/build/libsodium-sys-1bd84c2c2959fcd6/build-script-build (exit code: 101)
— stderr
thread ’

’ panicked at ‘called Result::unwrap() on an Err value: “failed to run “pkg-config” “–libs” “–cflags” “libsodium”: No such file or directory (os error 2)”’, …/src/libcore/result.rs:734

https://raw.githubusercontent.com/maidsafe/QA/master/Bash%20Scripts/Travis/install_libsodium.sh

They currently install it on a temp folder. It’s not the real installation.

export PKG_CONFIG_PATH=$HOME/libsodium-$LibSodiumVersion/lib/pkgconfig:$PKG_CONFIG_PATH

That’s the most important you have to configure to point to your libsodium library.

Thank you.
Strange, I ran the script, the git clone, configure, make and make install steps all completed successfully. But when I went to compile the safe_ffi again, same error.

You may want to look at this instead if you did not already.
https://travis-ci.org/maidsafe/safe_ffi/jobs/79627252

Or else I don’t know what to say.

Maybe you need to install the pkg-config package. There is the following chain of crate dependencies:
safe_ffi => sodiumoxyde => libsodium-sys => pkg-config

pkg-config crate depends on pkg-config package. Please, try installing it:

sudo apt-get install pkg-config

@tfa Yep, that was it. Thanks :smile:

Spoke too soon.

It now gets past libsodium compile, but fails out when compiling safe_ffi. Gotta be a problem on my end as no issues listed on maidsafe/safe_ffi

Compiling safe_ffi v0.0.1 (file:///home/patrick/safe/safe_ffi)
src/implementation.rs:48:29: 50:47 error: this function takes 1 parameter but 3 parameters were supplied [E0061]
src/implementation.rs:48 try!(dir_helper.get((&(dir_key_and_access.0).0, (dir_key_and_access.0).1),
src/implementation.rs:49 dir_key_and_access.1,
src/implementation.rs:50 &access_level))
:1:1: 6:48 note: in expansion of try!
src/implementation.rs:48:13: 50:48 note: expansion site
src/implementation.rs:48:29: 50:47 help: run rustc --explain E0061 to see a detailed explanation
src/implementation.rs:57:47: 59:102 error: this function takes 1 parameter but 3 parameters were supplied [E0061]
src/implementation.rs:57 current_dir_listing = try!(dir_helper.get(current_dir_info.get_key(),
src/implementation.rs:58 current_dir_info.get_metadata().is_versioned(),
src/implementation.rs:59 current_dir_info.get_metadata().get_access_level()));
:1:1: 6:48 note: in expansion of try!
src/implementation.rs:57:31: 59:103 note: expansion site
note: in expansion of for loop expansion
src/implementation.rs:55:5: 60:6 note: expansion site
src/implementation.rs:57:47: 59:102 help: run rustc --explain E0061 to see a detailed explanation
src/implementation.rs:58:68: 58:82 error: no method named get_metadata found for type safe_nfs::metadata::directory_metadata::DirectoryMetadata in the current scope
src/implementation.rs:58 current_dir_info.get_metadata().is_versioned(),
^~~~~~~~~~~~~~
:1:1: 6:48 note: in expansion of try!
src/implementation.rs:57:31: 59:103 note: expansion site
note: in expansion of for loop expansion
src/implementation.rs:55:5: 60:6 note: expansion site
src/implementation.rs:59:68: 59:82 error: no method named get_metadata found for type safe_nfs::metadata::directory_metadata::DirectoryMetadata in the current scope
src/implementation.rs:59 current_dir_info.get_metadata().get_access_level()));
^~~~~~~~~~~~~~
:1:1: 6:48 note: in expansion of try!
src/implementation.rs:57:31: 59:103 note: expansion site
note: in expansion of for loop expansion
src/implementation.rs:55:5: 60:6 note: expansion site
src/lib.rs:229:57: 229:67 error: no method named get_info found for type safe_nfs::directory_listing::DirectoryListing in the current scope
src/lib.rs:229 let service_home_dir_key = service_home_dir_listing.get_info().get_key();
^~~~~~~~~~
src/lib.rs:242:89: 242:111 error: the type of this value must be known in this context
src/lib.rs:242 &vec![(service_name, (service_home_dir_key.0.clone(), service_home_dir_key.1))],
^~~~~~~~~~~~~~~~~~~~~~
:1:1: 4:58 note: in expansion of vec!
src/lib.rs:242:68: 242:146 note: expansion site
src/macros.rs:37:1: 48:2 note: in expansion of ffi_try!
src/lib.rs:239:30: 245:73 note: expansion site
src/lib.rs:263:57: 263:67 error: no method named get_info found for type safe_nfs::directory_listing::DirectoryListing in the current scope
src/lib.rs:263 let service_home_dir_key = service_home_dir_listing.get_info().get_key();
^~~~~~~~~~
src/lib.rs:272:82: 272:104 error: the type of this value must be known in this context
src/lib.rs:272 (service_name, (service_home_dir_key.0.clone(), service_home_dir_key.1)),
^~~~~~~~~~~~~~~~~~~~~~
src/macros.rs:37:1: 48:2 note: in expansion of ffi_try!
src/lib.rs:271:30: 274:72 note: expansion site
error: aborting due to 8 previous errors
Could not compile safe_ffi.

It’s like it for me too. safe_ffi need to be updated to work with updated crate. At travis-ci the build still use the old crate version.

@Ghaunt
I understand now :smile:
safe_ffi was under active dev during the latest sprint, and they were working directly on the master branch. Viv has replied back, and said they will soon create a dedicated dev branch, so we always have a stable and build-able master branch.

1 Like