読者です 読者をやめる 読者になる 読者になる

万年素人からHackerへの道

万年素人がHackerになれるまで殴り書きするぜ。

Rustとnicklelでのエラー PostgresQLなど

AdventCalendar2015 - nickel Webフレームワークを使ってみる - Qiita これ見た。

そして、まずこのだるい赤いエラー。

failed to run custom build command for `openssl v0.7.5`
Process didn't exit successfully: `/Users/shinriyo/rust_apps/nickel-helloworld/target/debug/build/openssl-bf2ed9545558cfe0/build-script-build` (exit code: 101)
--- stdout
TARGET = Some("x86_64-apple-darwin")
OPT_LEVEL = Some("0")
PROFILE = Some("debug")
TARGET = Some("x86_64-apple-darwin")
debug=true opt-level=0
HOST = Some("x86_64-apple-darwin")
TARGET = Some("x86_64-apple-darwin")
TARGET = Some("x86_64-apple-darwin")
HOST = Some("x86_64-apple-darwin")
CC_x86_64-apple-darwin = None
CC_x86_64_apple_darwin = None
HOST_CC = None
CC = None
HOST = Some("x86_64-apple-darwin")
TARGET = Some("x86_64-apple-darwin")
HOST = Some("x86_64-apple-darwin")
CFLAGS_x86_64-apple-darwin = None
CFLAGS_x86_64_apple_darwin = None
HOST_CFLAGS = None
CFLAGS = None
running: "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-g" "-m64" "-fPIC" "-o" "/Users/shinriyo/rust_apps/nickel-helloworld/target/debug/build/openssl-bf2ed9545558cfe0/out/src/c_helpers.o" "-c" "src/c_helpers.c"
ExitStatus(ExitStatus(256))


command did not execute successfully, got: exit code: 1



--- stderr
src/c_helpers.c:1:10: fatal error: 'openssl/ssl.h' file not found
#include <openssl/ssl.h>
         ^
1 error generated.
thread '<main>' panicked at 'explicit panic', /Users/shinriyo/.multirust/toolchains/stable/cargo/registry/src/github.com-88ac128001ac3a9a/gcc-0.3.21/src/lib.rs:772

ググる

qiita.com がヒット。

以下を実行

export OPENSSL_INCLUDE_DIR=/usr/local/opt/openssl/include
export DEP_OPENSSL_INCLUDE=/usr/local/opt/openssl/include

その後に再度cargo buildする。

次は・・。

   Compiling nickel_postgres v0.0.0 (https://github.com/nickel-org/nickel-postgres.git#22295ece)
/Users/shinriyo/.multirust/toolchains/stable/cargo/git/checkouts/nickel-postgres-f47cd59392fbdedc/master/src/middleware.rs:21:72: 21:80 error: mismatched types:
 expected `r2d2_postgres::SslMode`,
    found `postgres::SslMode<'_>`
(expected enum `r2d2_postgres::SslMode`,
    found enum `postgres::SslMode`) [E0308]

このファイルを弄る? /Users/shinriyo/.multirust/toolchains/stable/cargo/git/checkouts/nickel-postgres-f47cd59392fbdedc/master/src/middleware.rs

r2d2_postgres::SslModeを想定してたのにpostgres::SslMode<'_>だ。

enumr2d2_postgres::SslModeを想定してたのにfound enum postgres::SslModeだ。

ってことか? ん?