はじめに
RustのTwitterAPIライブラリである、tweetustがopenssl絡みで失敗して使えませんでした。
なお、自環境のMacでは問題ありません。Lambda関数を作っていたので、Amazon Linux
環境用にクロスコンパイルする時に発生しました。
出るエラー
error: failed to run custom build command for
openssl v0.9.24
(略)
Compiling markup5ever v0.10.1
Compiling phf v0.8.0
error: failed to run custom build command for `openssl v0.9.24`
Caused by:
process didn't exit successfully: `/private/var/folders/1p/wrb0_xs15rv8njhtmjzx0_jc0000gn/T/tmp0b7moljy/target/release/build/openssl-dc6c0959ef3c5900/build-script-build` (exit status: 101)
--- stderr
thread 'main' panicked at 'Unable to detect OpenSSL version', /Users/yukokanai/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-0.9.24/build.rs:16:14
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: build failed
原因
hyper-native-tls v0.2.4
の利用しているnative-tls v0.1.5
がopenssl 0.9.24
を利用している。
$ cargo tree
├── tweetust v0.10.0
│ ├── (略)
│ ├── hyper-native-tls v0.2.4
│ │ ├── antidote v1.0.0
│ │ ├── hyper v0.10.16 (*)
│ │ └── native-tls v0.1.5
最新のhyper-native-tls v0.3.0
では、native-tls v0.2.8
が使われており、openssl 0.10.29
になる。
対策ができないか確認してみるが
大変参考にさせていただきました。
hyper-native-tls
がオプションであれば、使わない選択ができるのでtomlを確認したところオプションでした。
自身のCargo.Tomlを変更してオプションを無効にしました。
# tweetust = { version = "0.10.0"}
tweetust = { version = "0.10.0", default-features = false }
再ビルド
(略)
error[E0412]: cannot find type `NativeTlsClient` in this scope
--> /Users/yukokanai/.cargo/registry/src/github.com-1ecc6299db9ec823/tweetust-0.10.0/src/conn/mod.rs:115:81
|
115 | pub type DefaultHttpsConnector = hyper::client::Pool<hyper::net::HttpsConnector<NativeTlsClient>>;
| - ^^^^^^^^^^^^^^^ not found in this scope
| |
| help: you might be missing a type parameter: `<NativeTlsClient>`
Compiling hyper v0.14.13
For more information about this error, try `rustc --explain E0412`.
The following warnings were emitted during compilation:
warning: Unsupported return type `Dictionary<Status>`: Statuses.LookupMap
error: could not compile `tweetust` due to previous error
warning: build failed, waiting for other jobs to finish...
error: build failed
ライブラリのコンパイルでエラーなんですけど・・・。
GitHub上のエラー箇所確認しましたが、どう見てもオプションにしたらダメです。
もうプルリクを出すしかないのでは
hyper-native-tls v0.3.0
にバージョンを上げ、オプションではない形にしていただくだけなら私にも可能ではと思いましたがすでにIssueが・・・。
わかる・・・。
ドンピシャの修正なのに反映されていません。
よくみたら、2019年です。(現在2021年)
プロジェクトは放棄されたと思います...
おわりに
TwitterAPIのライブラリ利用前に探したんです。
割とDL数も多かったのと記述量が少なくて済むこちらを選択しましたが、更新が2019年で止まっていることは見落としました。
数時間無駄にしました。
更新日時、openssl依存、これからは先に確認します。