1

I added openssl dependency to Cargo.toml.

[dependencies.openssl]
openssl = "0.2.12"

But when I try to build and execute, it cannot compile that crate due to:

type std::sync::mutex::StaticMutexGuard does not implement any method in scope named unwrap

Full output:

pablo@boreth:~/pruebas/rust/hello_world$ cargo run --verbose
       Fresh pkg-config v0.1.3
   Compiling openssl-sys v0.2.12
     Running `rustc /home/pablo/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-sys-0.2.12/src/lib.rs --crate-name openssl-sys --crate-type lib -g -C metadata=e45df04b75965aa1 -C extra-filename=-e45df04b75965aa1 --out-dir /home/pablo/pruebas/rust/hello_world/target/deps --emit=dep-info,link -L /home/pablo/pruebas/rust/hello_world/target/deps -L /home/pablo/pruebas/rust/hello_world/target/deps -Awarnings -L native=/usr/lib/x86_64-linux-gnu -l ssl -l crypto`
/home/pablo/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-sys-0.2.12/src/lib.rs:203:54: 203:62 error: type `std::sync::mutex::StaticMutexGuard` does not implement any method in scope named `unwrap`
/home/pablo/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-sys-0.2.12/src/lib.rs:203             (*GUARDS)[n as uint] = Some(mutex.lock().unwrap());
                                                                                                                                                   ^~~~~~~~
/home/pablo/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-sys-0.2.12/src/lib.rs:214:14: 226:11 error: type `std::sync::once::Once` does not implement any method in scope named `call_once`
/home/pablo/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-sys-0.2.12/src/lib.rs:214         INIT.call_once(|| {
/home/pablo/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-sys-0.2.12/src/lib.rs:215             SSL_library_init();
/home/pablo/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-sys-0.2.12/src/lib.rs:216             SSL_load_error_strings();
/home/pablo/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-sys-0.2.12/src/lib.rs:217
/home/pablo/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-sys-0.2.12/src/lib.rs:218             let num_locks = CRYPTO_num_locks();
/home/pablo/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-sys-0.2.12/src/lib.rs:219             let mutexes = box range(0, num_locks).map(|_| MUTEX_INIT).collect::<Vec<_>>();
                                                                                              ...
error: aborting due to 2 previous errors
Could not compile `openssl-sys`.

Caused by:
  Process didn't exit successfully: `rustc /home/pablo/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-sys-0.2.12/src/lib.rs --crate-name openssl-sys --crate-type lib -g -C metadata=e45df04b75965aa1 -C extra-filename=-e45df04b75965aa1 --out-dir /home/pablo/pruebas/rust/hello_world/target/deps --emit=dep-info,link -L /home/pablo/pruebas/rust/hello_world/target/deps -L /home/pablo/pruebas/rust/hello_world/target/deps -Awarnings -L native=/usr/lib/x86_64-linux-gnu -l ssl -l crypto` (status=101)

I'm using Ubuntu Ubuntu 14.04.1 LTS (Trusty Tahr), and I've installed libssl-dev.

pablo@boreth:~$ uname -a
Linux boreth 3.13.0-43-generic #72-Ubuntu SMP Mon Dec 8 19:35:06 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
pablo@boreth:~$ dpkg -l libssl-dev
Deseado=Desconocido/Instalar/Eliminar/Purgar/Retener
| Estado=No/Instalado/Config-files/Desempaquetado/Medio-conf/Medio-inst/espera-disparo/pendiente-disparo
|/ Err?=(ninguno)/Requiere-reinst (Estado,Err: mayúsc.=malo)
||/ Nombre                                     Versión                    Arquitectura               Descripción
+++-==========================================-==========================-==========================-=========================================================================================
ii  libssl-dev:amd64                           1.0.1f-1ubuntu2.7          amd64                      Secure Sockets Layer toolkit - development files

rustc and cargo versions:

$ rustc -V
rustc 0.13.0-nightly (636663172 2014-12-28 16:21:58 +0000)
$ cargo -V
cargo 0.0.1-pre-nightly (26ac282 2014-12-30 00:13:39 +0000)

Does anyone know a solution or I should wait for an update?

5
  • It's probably just fallout from the changes pre 1.0 alpha / beta / release. What version of Rust are you running? Ideally, you will be running the nightly, but this version also has lots of changes happening.
    – Shepmaster
    Jan 5, 2015 at 19:57
  • Sorry, I forgot to attach the Rust version, it is rustc 0.13.0-nightly (636663172 2014-12-28 16:21:58 +0000)
    – Pablo Bngs
    Jan 5, 2015 at 20:36
  • I have rustc 0.13.0-dev (5773bdeff 2015-01-04 21:36:41 +0000). I created a new Cargo project, added the same dependency and was able to build. I think you will just want to update. Wild changing times!
    – Shepmaster
    Jan 6, 2015 at 2:13
  • 1
    I updated Rust and those errors are gone. But I still can not build due to a new different error. I'll take it easy and keep reading the documentation. Thank you very much.
    – Pablo Bngs
    Jan 6, 2015 at 14:04
  • Just wait until Friday, 2015-01-09. Then things should settle a bit.
    – Shepmaster
    Jan 6, 2015 at 15:12

1 Answer 1

0

I had same issues: Just update rust and recompile project

rustup update

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.