1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

RustのTwitterAPIライブラリtweetustはopenssl絡みで失敗して使えませんでした

Last updated at Posted at 2021-09-30

はじめに

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.5openssl 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

スクリーンショット 2021-09-30 22.37.33.png

最新のhyper-native-tls v0.3.0では、native-tls v0.2.8が使われており、openssl 0.10.29になる。
スクリーンショット 2021-09-30 22.40.21.png

対策ができないか確認してみるが

大変参考にさせていただきました。

hyper-native-tlsがオプションであれば、使わない選択ができるのでtomlを確認したところオプションでした。

スクリーンショット 2021-09-30 22.43.45.png

自身のCargo.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が・・・。
スクリーンショット 2021-09-30 22.50.28.png
スクリーンショット 2021-09-30 22.51.15.png
わかる・・・。
スクリーンショット 2021-09-30 22.52.37.png
ドンピシャの修正なのに反映されていません。
よくみたら、2019年です。(現在2021年)
スクリーンショット 2021-09-30 22.53.54.png

プロジェクトは放棄されたと思います...

おわりに

TwitterAPIのライブラリ利用前に探したんです。
割とDL数も多かったのと記述量が少なくて済むこちらを選択しましたが、更新が2019年で止まっていることは見落としました。

数時間無駄にしました。
更新日時、openssl依存、これからは先に確認します。

1
0
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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?