Rustup: Can't compile: Unable to detect OpenSSL version

Created on 28 Sep 2018  路  10Comments  路  Source: rust-lang/rustup

I'm getting this trying to compile 1.14.0:

error: failed to run custom build command for `openssl v0.9.24`
process didn't exit successfully: `/build/rustup/src/rustup.rs-1.14.0/target/release/build/openssl-4e050bcc8f5aae18/build-script-build` (exit code: 101)
--- stderr
thread 'main' panicked at 'Unable to detect OpenSSL version', /build/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-0.9.24/build.rs:16:14
note: Run with `RUST_BACKTRACE=1` for a backtrace.

warning: build failed, waiting for other jobs to finish...
error: build failed

My rust is 1.29.0 and my openssl is 1.1.1. This is on Arch Linux.

Most helpful comment

I don't think downgrading openssl is a good idea in general.

All 10 comments

Uh, I have the same error. Trying to install a crate called cargo-raze. I get the exact same error message.

Edit: Can anyone confirm that this is not a Arch Linux only compilation error? Maybe the PKGBUILD has some errors.

Got same issue on ArchLinux when installing cargo-clone:

$ cargo install cargo-clone
    Updating crates.io index
  Installing cargo-clone v0.1.2                                                                                                                                                                                    
   Compiling winapi-build v0.1.1                                                                                                                                                                                   
   Compiling cc v1.0.25                                                                                                                                                                                            
   Compiling pkg-config v0.3.14                                                                                                                                                                                    
   Compiling winapi v0.2.8                                                                                                                                                                                         
   Compiling version_check v0.1.5                                                                                                                                                                                  
   Compiling matches v0.1.8                                                                                                                                                                                        
   Compiling libc v0.2.43                                                                                                                                                                                          
   Compiling unicode-normalization v0.1.7                                                                                                                                                                          
   Compiling percent-encoding v1.0.1                                                                                                                                                                               
   Compiling regex-syntax v0.3.9                                                                                                                                                                                   
   Compiling cfg-if v0.1.5                                                                                                                                                                                         
   Compiling utf8-ranges v0.1.3                                                                                                                                                                                    
   Compiling openssl-probe v0.1.2                                                                                                                                                                                  
   Compiling bitflags v0.9.1                                                                                                                                                                                       
   Compiling regex v0.2.11                                                                                                                                                                                         
   Compiling lazy_static v0.2.11                                                                                                                                                                                   
   Compiling openssl v0.9.24                                                                                                                                                                                       
   Compiling foreign-types-shared v0.1.1                                                                                                                                                                           
   Compiling ucd-util v0.1.1                                                                                                                                                                                       
   Compiling rustc-serialize v0.3.24                                                                                                                                                                               
   Compiling remove_dir_all v0.5.1                                                                                                                                                                                 
   Compiling strsim v0.5.2                                                                                                                                                                                         
   Compiling utf8-ranges v1.0.1                                                                                                                                                                                    
   Compiling strsim v0.6.0                                                                                                                                                                                         
   Compiling same-file v0.1.3                                                                                                                                                                                      
   Compiling term v0.4.6                                                                                                                                                                                           
   Compiling crossbeam v0.2.12                                                                                                                                                                                     
   Compiling glob v0.2.11                                                                                                                                                                                          
   Compiling kernel32-sys v0.2.2                                                                                                                                                                                   
   Compiling ws2_32-sys v0.2.1                                                                                                                                                                                     
   Compiling advapi32-sys v0.2.0                                                                                                                                                                                   
   Compiling psapi-sys v0.1.1                                                                                                                                                                                      
   Compiling unicode-bidi v0.3.4                                                                                                                                                                                   
   Compiling memchr v0.1.11                                                                                                                                                                                        
   Compiling rand v0.4.3                                                                                                                                                                                           
   Compiling num_cpus v1.8.0                                                                                                                                                                                       
   Compiling fs2 v0.3.0                                                                                                                                                                                            
   Compiling lazy_static v1.1.0                                                                                                                                                                                    
   Compiling memchr v2.1.0                                                                                                                                                                                         
   Compiling socket2 v0.3.8                                                                                                                                                                                        
   Compiling log v0.4.5                                                                                                                                                                                            
   Compiling net2 v0.2.33                                                                                                                                                                                          
   Compiling filetime v0.2.1                                                                                                                                                                                       
   Compiling filetime v0.1.15                                                                                                                                                                                      
   Compiling libz-sys v1.0.23                                                                                                                                                                                      
   Compiling openssl-sys v0.9.36                                                                                                                                                                                   
   Compiling cmake v0.1.35                                                                                                                                                                                         
   Compiling libssh2-sys v0.2.11                                                                                                                                                                                   
   Compiling curl-sys v0.4.12                                                                                                                                                                                      
   Compiling miniz-sys v0.1.10                                                                                                                                                                                     
   Compiling foreign-types v0.3.2                                                                                                                                                                                  
   Compiling regex-syntax v0.5.6                                                                                                                                                                                   
   Compiling walkdir v1.0.7                                                                                                                                                                                        
   Compiling toml v0.2.1                                                                                                                                                                                           
   Compiling aho-corasick v0.5.3                                                                                                                                                                                   
   Compiling tempdir v0.3.7                                                                                                                                                                                        
   Compiling log v0.3.9                                                                                                                                                                                            
   Compiling tar v0.4.17                                                                                                                                                                                           
   Compiling idna v0.1.5                                                                                                                                                                                           
   Compiling libgit2-sys v0.6.19                                                                                                                                                                                   
    Building [==================================>                     ] 69/108: regex-syntax, idna                                                                                                                 

error: failed to run custom build command for `openssl v0.9.24`                                                                                                                                                    
process didn't exit successfully: `/tmp/cargo-installC5D1wj/release/build/openssl-7acc61d4ae5e3e15/build-script-build` (exit code: 101)
--- stderr
thread 'main' panicked at 'Unable to detect OpenSSL version', /home/maxpayne/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-0.9.24/build.rs:16:14
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::print
             at libstd/sys_common/backtrace.rs:71
             at libstd/sys_common/backtrace.rs:59
   2: std::panicking::default_hook::{{closure}}
             at libstd/panicking.rs:211
   3: std::panicking::default_hook
             at libstd/panicking.rs:227
   4: std::panicking::rust_panic_with_hook
             at libstd/panicking.rs:477
   5: std::panicking::begin_panic
   6: build_script_build::main
   7: std::rt::lang_start::{{closure}}
   8: std::panicking::try::do_call
             at libstd/rt.rs:59
             at libstd/panicking.rs:310
   9: __rust_maybe_catch_panic
             at libpanic_unwind/lib.rs:102
  10: std::rt::lang_start_internal
             at libstd/panicking.rs:289
             at libstd/panic.rs:392
             at libstd/rt.rs:58
  11: main
  12: __libc_start_main
  13: _start

warning: build failed, waiting for other jobs to finish...
error: failed to compile `cargo-clone v0.1.2`, intermediate artifacts can be found at `/tmp/cargo-installC5D1wj`                                                                                                   

Caused by:
  build failed

Yet, OpenSSL is installed:

$ pacman -Qs openssl
local/lib32-openssl 1:1.1.1-1
    The Open Source toolkit for Secure Sockets Layer and Transport Layer Security (32-bit)
local/openssl 1.1.1-1
    The Open Source toolkit for Secure Sockets Layer and Transport Layer Security
local/openssl-1.0 1.0.2.p-1
    The Open Source toolkit for Secure Sockets Layer and Transport Layer Security

make sure to downgrade your OpenSSL installation. I reverted to an old version from 2018/08/15 and it worked. Looks like the new OpenSSL 1.1.1 versions are incompatible with rust-openssl < 0.10.0 iirc.

I don't think downgrading openssl is a good idea in general.

It isn't, but as long as the crates don't upgrade their rust-openssl dependency (which is actually a breaking change iirc) there is not really another choice as far as I could tell.

Edit: I'm not an Arch Linux expert but it might be possible to have to separate OpenSSL versions installed without colliding them. So that tools use the new one but rust gets compiled with the old one. I've read somewhere that you can pass a OPENSSL_PATH env variable but I am not sure if that still works. Compiling and installing the older OpenSSL version to another directory and linking against that one should make it work on your machine. Not sure how to do it if it has to be on a production PC.

I think this is what the openssl "vendored" feature is for - see https://github.com/sfackler/rust-openssl/tree/master/openssl#vendored

I'm not sure how to enable it for this scenario though, possibly just --features=openssl/vendored

@joelgallant Ah nice catch! I will try to compile it with that option enabled. It shouldn't be much of a problem for development binaries/dependencies for local usage. Thanks for the hint!

This is should be fixed after upgrading the version of reqwest to 0.9 which bumps the openssl crate for openssl 1.1.1 support. See https://github.com/sfackler/rust-openssl/blob/master/CHANGELOG.md#v0104---2018-02-18

I am working on this currently.

I don't think downgrading openssl is a good idea in general.

but which version should be degraded to ?

@LeeMaster This has been resolved for over two years. What are you asking about?

Was this page helpful?
0 / 5 - 0 ratings