Help us understand the problem. What is going on with this article?

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

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が必要です。

その他の解決方法

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away