LoginSignup
60
17

More than 5 years have passed since last update.

rust で failed to run custom build command for `openssl-sys` が出るときにすること

Last updated at Posted at 2017-05-28

Rustでいろんな環境で開発を行う際に、hyper などでは opensslにを使っているので、このエラーがよく出ます。そんなときの対処方法です。

はじめに

https://github.com/sfackler/rust-openssl#manual-configuration
に書いている下記の方法を試します。

# On Ubuntu
sudo apt-get install libssl-dev

# On Arch Linux
sudo pacman -S openssl

# On Fedora
sudo dnf install openssl-devel

# On Amazon Linux
sudo yum install openssl-devel

Macの場合は

brew install openssl

これです。

それでもダメなら

Ubuntu

dpkg -L libssl-dev | grep lib
dpkg -L libssl-dev | grep include

で、それっぽいパスを探してきます。
そして下記の環境変数を bashrcや起動スクリプトなどにセットします。

export OPENSSL_LIB_DIR=/usr/lib/x86_64-linux-gnu/
export OPENSSL_INCLUDE_DIR=/usr/include/openssl/

更にそれでもダメなら

apt-get install pkg-config

Fedora系の場合はこちらが良さそうです。

pkg-configが必要です。

その他の解決方法

60
17
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
60
17