Failing to build sodiumoxide from source on Windows 8.1 x64

I downloaded the pre-compiled library, extracted its contents, and added C:\libs\libsodium-win64\lib to my Path system variable, which is the directory containing the file libsodium.a

PS D:\dev\maidsafe\sodiumoxide> cargo build
   Compiling pkg-config v0.3.5
   Compiling libc v0.1.10
   Compiling rustc-serialize v0.3.16
   Compiling libsodium-sys v0.0.8 (file:///D:/dev/maidsafe/sodiumoxide/libsodium-sys)
Build failed, waiting for other jobs to finish...
failed to run custom build command for `libsodium-sys v0.0.8 (file:///D:/dev/maidsafe/sodiumoxide/libsodium-sys)`
Process didn't exit successfully: `D:\dev\maidsafe\sodiumoxide\target\debug\build\libsodium-sys-ab6f591903ba079c\build-script-build` (exit code: 101)
--- stderr
thread '<main>' panicked at 'called `Result::unwrap()` on an `Err` value: "failed to run `\"pkg-config\" \"--libs\" \"--cflags\" \"libsodium\"`: The system cannot find the file specified. (os error 2)
"', ../src/libcore\

@Ross or @Fraser, Ben mentioned you are better placed to help me out. Thanks.

1 Like

You may have the wrong version (32 bit?) I am not sure too much on windows though, if you look at the appveyor script and copy the steps there you will be doing what we do and our CI scripts do as well.


Thanks David, that helped.

Apparently adding the location of libsodium.a to the Path does not actually work. However, adding SODIUM_LIB_DIR as a new environment variable with the location of libsodium.a as its value did the trick. Everything compiled after that, but the tests failed. The solution was moving libsodium-win64\bin\libsodium-13.dll to C:\Windows\System32 and all tests passed after that.


This topic was automatically closed after 60 minutes. New replies are no longer allowed.