Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to run custom build command for openssl-sys v0.9.24 #51

Closed
carlomilanesi opened this issue Jan 20, 2018 · 11 comments
Closed

Failed to run custom build command for openssl-sys v0.9.24 #51

carlomilanesi opened this issue Jan 20, 2018 · 11 comments

Comments

@carlomilanesi
Copy link

The command cargo install cargo-web,
after a minute and half of compiling, printed:

error: failed to run custom build command for `openssl-sys v0.9.24`
process didn't exit successfully: `/tmp/cargo-install.aKdf8gWcEAu5/release/build/openssl-sys-5ee2bfe045b42a7a/build-script-build` (exit code: 101)
--- stdout
cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_LIB_DIR
cargo:rerun-if-env-changed=OPENSSL_LIB_DIR
cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_INCLUDE_DIR
cargo:rerun-if-env-changed=OPENSSL_INCLUDE_DIR
cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_DIR
cargo:rerun-if-env-changed=OPENSSL_DIR
run pkg_config fail: "`\"pkg-config\" \"--libs\" \"--cflags\" \"openssl\"` did not exit successfully: exit code: 1\n--- stderr\nPackage openssl was not found in the pkg-config search path.\nPerhaps you should add the directory containing `openssl.pc\'\nto the PKG_CONFIG_PATH environment variable\nNo package \'openssl\' found\n"

--- stderr
thread 'main' panicked at '

Could not find directory of OpenSSL installation, and this `-sys` crate cannot
proceed without this knowledge. If OpenSSL is installed and this crate had
trouble finding it,  you can set the `OPENSSL_DIR` environment variable for the
compilation process.

If you're in a situation where you think the directory *should* be found
automatically, please open a bug at https://github.com/sfackler/rust-openssl
and include information about your system as well as this message.

    $HOST = x86_64-unknown-linux-gnu
    $TARGET = x86_64-unknown-linux-gnu
    openssl-sys = 0.9.24

The command which openssl prints /usr/bin/openssl, and so I tried also the command OPENSSL_DIR=/usr/bin cargo install cargo-web, getting the following output:

error: failed to run custom build command for `openssl-sys v0.9.24`
process didn't exit successfully: `/tmp/cargo-install.FbQ5fWKqfqMJ/release/build/openssl-sys-5ee2bfe045b42a7a/build-script-build` (exit code: 101)
--- stdout
cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_LIB_DIR
cargo:rerun-if-env-changed=OPENSSL_LIB_DIR
cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_INCLUDE_DIR
cargo:rerun-if-env-changed=OPENSSL_INCLUDE_DIR
cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_DIR
cargo:rerun-if-env-changed=OPENSSL_DIR

--- stderr
thread 'main' panicked at 'OpenSSL library directory does not exist: /usr/bin/lib ...
@koute
Copy link
Owner

koute commented Jan 20, 2018

What you're most likely missing here is a -dev package for OpenSSL. For example, on Ubuntu you need to install the libssl-dev package.

@carlomilanesi
Copy link
Author

Solved with command apt install libssl-dev (with Linux Mint). I presume it should be added to docs.

@koute
Copy link
Owner

koute commented Jan 20, 2018

Yep. Done!

@koute koute closed this as completed Jan 20, 2018
@Pauan
Copy link
Contributor

Pauan commented Jan 21, 2018

Just in case anybody else stumbles upon this, on NixOS you need to do something a bit special:

nix-shell -p openssl pkgconfig

Then inside of the nix-shell you run cargo install cargo-web


Also, you need to install the NixOS emscripten package and then use --use-system-emscripten with cargo web, because the emscripten that comes with cargo web doesn't work.

I also recommend using the Mozilla Rust Overlay with NixOS, to get the most up-to-date version of Rust.

And when installing Rust, you need to specify which targets to build, like this:

{
  environment = {
    systemPackages = with pkgs; [
      pkgconfig # needed by cargo-web
      openssl # needed by cargo-web
      emscripten # needed by cargo-web

      (latest.rustChannels.nightly.rust.override {
        targets = [
          "asmjs-unknown-emscripten"
          "wasm32-unknown-emscripten"
          "wasm32-unknown-unknown"
        ];
      })
    ];
  };
}

If cargo-web had a wiki I could add this information into it, since NixOS is one of the few OSes that has trouble installing Rust (because rustup doesn't work on NixOS).

@koute
Copy link
Owner

koute commented Jan 21, 2018

@Pauan Could you elaborate how exactly cargo-web's Emscripten doesn't work on NixOS?

@Pauan
Copy link
Contributor

Pauan commented Jan 21, 2018

@koute I get this error when running cargo web without --use-system-emscripten:

= note: INFO:root:generating system asset: is_vanilla.txt... (this will be cached in "/home/pauan/.emscripten_cache/is_vanilla.txt" for subsequent builds)
        INFO:root: - ok
        CRITICAL:root:Could not verify LLVM version: [Errno 2] No such file or directory
        CRITICAL:root:fastcomp in use, but LLVM has not been built with the JavaScript backend as a target, llc reports:
        ===========================================================================
        (no targets could be identified: [Errno 2] No such file or directory)
        ===========================================================================
        CRITICAL:root:you can fall back to the older (pre-fastcomp) compiler core, although that is not recommended, see http://kripken.github.io/emscripten-site/docs/building_from_source/LLVM-Backend.html
        INFO:root:(Emscripten: Running sanity checks)
        CRITICAL:root:failing sanity checks due to previous fastcomp failure

I assume it's because it can't find llvm or something like that (even though it should be installed).

NixOS doesn't store packages at "normal" places, so even if a package is installed most programs outside of NixOS won't be able to find it.

@P-E-Meunier
Copy link

Actually, even with --use-system-emscripten, it prints tons of warnings of the following form:

          WARNING:root:object /run/user/1000/emscripten_temp_tJhyot_archive_contents/compiler_builtins-ca7e003bb58db39b.compiler_builtins8-dd33bba1f26e727ae1ab943a5b90d488.rs.rcgu.bc.z is not valid, cannot link
          WARNING:root:object /run/user/1000/emscripten_temp_tJhyot_archive_contents/compiler_builtins-ca7e003bb58db39b.compiler_builtins9-dd33bba1f26e727ae1ab943a5b90d488.rs.rcgu.bc.z is not valid, cannot link

And then stops with

          error: unresolved symbol: pthread_self
          Aborting compilation due to previous errors | undefined

@haug1
Copy link

haug1 commented Nov 14, 2020

sudo apt install pkg-config libssl-dev on Ubuntu WSL solved it for me

@SethBodine
Copy link

sudo apt install pkg-config libssl-dev on Ubuntu WSL solved it for me

thanks! wrangler needs these two packages as well!

@ArchitBhonsle
Copy link

ArchitBhonsle commented Feb 20, 2021

I got this when I ran cargo install cargo-web

error: failed to run custom build command for `openssl-sys v0.9.45`

Caused by:
  process didn't exit successfully: `/tmp/cargo-installeZabaz/release/build/openssl-sys-a4c65b9911d7e31c/build-script-main` (exit code: 101)
  --- stdout
  cargo:rustc-cfg=const_fn
  CC_x86_64-unknown-linux-gnu = None
  CC_x86_64_unknown_linux_gnu = None
  HOST_CC = None
  CC = None
  CFLAGS_x86_64-unknown-linux-gnu = None
  CFLAGS_x86_64_unknown_linux_gnu = None
  HOST_CFLAGS = None
  CFLAGS = None
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("false")
  CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
  running "perl" "./Configure" "--prefix=/tmp/cargo-installeZabaz/release/build/openssl-sys-73e0764b2d4478e5/out/openssl-build/install" "no-dso" "no-shared" "no-ssl3" "no-unit-test" "no-comp" "no-zlib" "no-zlib-dynamic" "no-md2" "no-rc5" "no-weak-ssl-ciphers" "no-camellia" "no-idea" "no-seed" "linux-x86_64" "-O2" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64"

  --- stderr
  Can't locate FindBin.pm in @INC (you may need to install the FindBin module) (@INC contains: /usr/local/lib64/perl5/5.32 /usr/local/share/perl5/5.32 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5) at ./Configure line 15.
  BEGIN failed--compilation aborted at ./Configure line 15.
  thread 'main' panicked at '


  Error configuring OpenSSL build:
      Command: "perl" "./Configure" "--prefix=/tmp/cargo-installeZabaz/release/build/openssl-sys-73e0764b2d4478e5/out/openssl-build/install" "no-dso" "no-shared" "no-ssl3" "no-unit-test" "no-comp" "no-zlib" "no-zlib-dynamic" "no-md2" "no-rc5" "no-weak-ssl-ciphers" "no-camellia" "no-idea" "no-seed" "linux-x86_64" "-O2" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64"
      Exit status: exit code: 2


      ', /home/puipuituipui/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-src-111.14.0+1.1.1j/src/lib.rs:415:13
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: failed to compile `cargo-web v0.6.26`, intermediate artifacts can be found at `/tmp/cargo-installeZabaz`

Caused by:
  build failed

On Fedora here. I have installed both pkg-config and openssl-devel .

FIXED: If you're on Fedora install perl-core. It has FindBin which caused the build to fail in my case. There probably is a more efficient way to do this but I'm a noob.

@topazus
Copy link

topazus commented May 18, 2021

FIXED: If you're on Fedora install perl-core. It has FindBin which caused the build to fail in my case. There probably is a more efficient way to do this but I'm a noob.

Thanks, after installing perl-core in fedora, it is fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants