gematik / ref-eRp-FD-Server

ARCHIVED - This project acts as reference implementation of main aspects of an e-prescription server designed by gematik.
Other
44 stars 3 forks source link

Issue with building with openssl #1

Closed banne01 closed 4 years ago

banne01 commented 4 years ago
error[E0425]: cannot find value EVP_PKEY_HKDF in crate ffi --> /home/fortanix-guest/.cargo/git/checkouts/rust-openssl-b91f1b0e26c396e7/d4ea5b6/openssl/src/hkdf.rs:24:22 24 ffi::EVP_PKEY_HKDF, ^^^^^^^^^^^^^ help: a constant with a similar name exists: EVP_PKEY_DH

::: /home/fortanix-guest/.cargo/git/checkouts/rust-openssl-b91f1b0e26c396e7/d4ea5b6/openssl-sys/src/evp.rs:12:1 | 12 | pub const EVP_PKEY_DH: c_int = NID_dhKeyAgreement; | -------------------------------------------------- similarly named constant EVP_PKEY_DH defined here

error[E0425]: cannot find function, tuple struct or tuple variant EVP_PKEY_CTX_set_hkdf_md in crate ffi --> /home/fortanix-guest/.cargo/git/checkouts/rust-openssl-b91f1b0e26c396e7/d4ea5b6/openssl/src/hkdf.rs:30:22 30 cvt(ffi::EVP_PKEY_CTX_set_hkdf_md(ret.0, hash.as_ptr()))?; ^^^^^^^^^^^^^^^^^^^^^^^^ help: a function with a similar name exists: EVP_PKEY_CTX_set_rsa_mgf1_md

::: /home/fortanix-guest/.cargo/git/checkouts/rust-openssl-b91f1b0e26c396e7/d4ea5b6/openssl-sys/src/rsa.rs:41:1 | 41 | pub unsafe fn EVP_PKEY_CTX_set_rsa_mgf1_md(ctx: mut EVP_PKEY_CTX, md: mut EVP_MD) -> c_int { | -------------------------------------------------------------------------------------------- similarly named function EVP_PKEY_CTX_set_rsa_mgf1_md defined here

error[E0425]: cannot find function, tuple struct or tuple variant EVP_PKEY_CTX_hkdf_mode in crate ffi --> /home/fortanix-guest/.cargo/git/checkouts/rust-openssl-b91f1b0e26c396e7/d4ea5b6/openssl/src/hkdf.rs:38:22 38 cvt(ffi::EVP_PKEY_CTX_hkdf_mode( ^^^^^^^^^^^^^^^^^^^^^^ help: a function with a similar name exists: EVP_PKEY_CTX_free

::: /home/fortanix-guest/.cargo/git/checkouts/rust-openssl-b91f1b0e26c396e7/d4ea5b6/openssl-sys/src/evp.rs:433:5 | 433 | pub fn EVP_PKEY_CTX_free(ctx: *mut EVP_PKEY_CTX); | ------------------------------------------------- similarly named function EVP_PKEY_CTX_free defined here

error[E0425]: cannot find value EVP_PKEY_HKDEF_MODE_EXTRACT_AND_EXPAND in crate ffi --> /home/fortanix-guest/.cargo/git/checkouts/rust-openssl-b91f1b0e26c396e7/d4ea5b6/openssl/src/hkdf.rs:41:52 | 41 | Mode::ExtractAndExpand => ffi::EVP_PKEY_HKDEF_MODE_EXTRACT_AND_EXPAND, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in ffi

error[E0425]: cannot find value EVP_PKEY_HKDEF_MODE_EXTRACT_ONLY in crate ffi --> /home/fortanix-guest/.cargo/git/checkouts/rust-openssl-b91f1b0e26c396e7/d4ea5b6/openssl/src/hkdf.rs:42:47 | 42 | Mode::ExtractOnly => ffi::EVP_PKEY_HKDEF_MODE_EXTRACT_ONLY, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in ffi

error[E0425]: cannot find value EVP_PKEY_HKDEF_MODE_EXPAND_ONLY in crate ffi --> /home/fortanix-guest/.cargo/git/checkouts/rust-openssl-b91f1b0e26c396e7/d4ea5b6/openssl/src/hkdf.rs:43:46 | 43 | Mode::ExpandOnly => ffi::EVP_PKEY_HKDEF_MODE_EXPAND_ONLY, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in ffi

error[E0425]: cannot find function, tuple struct or tuple variant EVP_PKEY_CTX_set1_hkdf_key in crate ffi --> /home/fortanix-guest/.cargo/git/checkouts/rust-openssl-b91f1b0e26c396e7/d4ea5b6/openssl/src/hkdf.rs:53:22 | 53 | cvt(ffi::EVP_PKEY_CTX_set1_hkdf_key( | ^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in ffi

error[E0425]: cannot find function, tuple struct or tuple variant EVP_PKEY_CTX_set1_hkdf_salt in crate ffi --> /home/fortanix-guest/.cargo/git/checkouts/rust-openssl-b91f1b0e26c396e7/d4ea5b6/openssl/src/hkdf.rs:70:22 | 70 | cvt(ffi::EVP_PKEY_CTX_set1_hkdf_salt(self.0, ptr, len as c_int))?; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in ffi

error[E0425]: cannot find function, tuple struct or tuple variant EVP_PKEY_CTX_add1_hkdf_info in crate ffi --> /home/fortanix-guest/.cargo/git/checkouts/rust-openssl-b91f1b0e26c396e7/d4ea5b6/openssl/src/hkdf.rs:83:22 | 83 | cvt(ffi::EVP_PKEY_CTX_add1_hkdf_info(self.0, ptr, len as c_int))?; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in ffi

Compiling brotli2 v0.3.2 error: aborting due to 9 previous errors

For more information about this error, try rustc --explain E0425. error: could not compile openssl

To learn more, run the command again with --verbose. warning: build failed, waiting for other jobs to finish... error: build failed

banne01 commented 4 years ago

Any pointers on how to build fix the errors with cargo build here ?

outbreaker commented 4 years ago

Hello, i build success inside a clean docker container with following steps:

> docker run -it debian bash

> apt-get update

> apt-get -y install git curl build-essential libssl-dev pkg-config

> curl https://sh.rustup.rs -sSf | sh

> export PATH=$HOME/.cargo/bin:$PATH

> git clone https://github.com/gematik/ref-eRp-FD-Server.git

> cd ref-eRp-FD-Server/

> cargo build

I think you error is the not installed openssl development "libssl-dev".

banne01 commented 4 years ago

Thank you. I was able to build inside docker environment. How do I generate this "--token ./path/to/acces_token_pub.pem"

banne01 commented 4 years ago

One observation, you seem to have libssl-dev version dependency (requires > 1.1.1-1ubuntu2.1~18.0) It does not work on Ubuntu 16.04 as you can't upgrade and default version is (1.0.2g-1ubuntu4.17)

Gematik-Entwicklung commented 4 years ago

Hello @banne01,

as you already mentioned, you need at least libssl v1.1.1 and the corresponding development package libssl-dev.

Just for completeness if someone has the same problem:

On linux you can install the depdendencies using the following command (please make sure your linux distribution supports the package):

apt-get install libssl1.1 libssl-dev

On windows you can download the OpenSSL binaries from this website. Additionally you need to specify the following environment variables:

OPENSSL_DIR = <path-to-openssl>
OPENSSL_LIB_DIR = <path-to-openssl>/lib
OPENSSL_INCLUDE_DIR = <path-to-openssl>/include
banne01 commented 4 years ago

Thank you.