clux/muslrust

Cargo build fails for openssl-src

imdmahajankanika opened this issue · 6 comments

Hello,

While doing cargo build with clux/muslrust image, we are getting below error. Does anyone has any idea please?

 = note: /usr/bin/ld: /volume/target/x86_64-unknown-linux-musl/release/deps/libpq_sys-3311ced5b388d271.rlib(fe-secure-openssl.o): in function `initialize_SSL':
          fe-secure-openssl.c:(.text+0x14d8): undefined reference to `ENGINE_by_id'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x1581): undefined reference to `ENGINE_init'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x15f8): undefined reference to `ENGINE_free'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x164a): undefined reference to `ENGINE_load_private_key'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x16d8): undefined reference to `ENGINE_finish'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x16ee): undefined reference to `ENGINE_free'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x17bb): undefined reference to `ENGINE_finish'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x17d1): undefined reference to `ENGINE_free'
          /usr/bin/ld: /volume/target/x86_64-unknown-linux-musl/release/deps/libpq_sys-3311ced5b388d271.rlib(fe-secure-openssl.o): in function `open_client_SSL':
          fe-secure-openssl.c:(.text+0x1d34): undefined reference to `SSL_get_peer_certificate'
          /usr/bin/ld: /volume/target/x86_64-unknown-linux-musl/release/deps/libpq_sys-3311ced5b388d271.rlib(fe-secure-openssl.o): in function `pgtls_close':
          fe-secure-openssl.c:(.text+0x1ec1): undefined reference to `ENGINE_finish'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x1ed4): undefined reference to `ENGINE_free'
          /usr/bin/ld: /volume/target/x86_64-unknown-linux-musl/release/deps/libpq_sys-3311ced5b388d271.rlib(fe-secure-openssl.o): in function `my_SSL_set_fd':
          fe-secure-openssl.c:(.text+0x252b): undefined reference to `ERR_put_error'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x256b): undefined reference to `ERR_put_error'
          collect2: error: ld returned 1 exit status
          
  = note: some `extern` functions couldn't be found; some native libraries may need to be installed or have their path specified
  = note: use the `-l` flag to specify native libraries to link
  = note: use the `cargo:rustc-link-lib` directive to specify the native libraries to link with Cargo (see https://doc.rust-lang.org/cargo/reference/build-scripts.html#cargorustc-link-libkindname)
warning: `module-directory` (bin "module-directory") generated 33 warnings
error: could not compile `module-directory` (bin "module-directory") due to previous error; 33 warnings emitted
error: build error: building at STEP "RUN cargo build --release": while running runtime: exit status 101
error: the build eos/eos-module-directory-dev-bc-108 status is "Failed"

Thanks in advance!

clux commented

likely postgres interactions with openssl. there is a workaround in the readme and a similar issue if you search the repo.

likely postgres interactions with openssl. there is a workaround in the readme and a similar issue if you search the repo.

@clux Hello, you mean using below?

export SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt
export SSL_CERT_DIR=/etc/ssl/certs

I am getting above error while executing below command

RUN cargo build --release

And we already have extern crate openssl; added in main.rs

you have extern crate in the right order also? https://github.com/clux/muslrust/blob/main/test/pqcrate/src/main.rs#L1-L2

I have below

extern crate diesel;
extern crate openssl;
extern crate slug;
clux commented

That looks wrong, see the tests:

// The order of these extern crate lines matter for ssl!
extern crate openssl;
#[macro_use]
extern crate diesel;
// openssl must be included before diesel atm.

clux commented

closing. working in diesel tests.