Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cargo build fails for openssl-src #132

Open
imdmahajankanika opened this issue Feb 15, 2024 · 5 comments
Open

Cargo build fails for openssl-src #132

imdmahajankanika opened this issue Feb 15, 2024 · 5 comments

Comments

@imdmahajankanika
Copy link

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
Copy link
Owner

clux commented Feb 15, 2024

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

@imdmahajankanika
Copy link
Author

imdmahajankanika commented Feb 15, 2024

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

@clux
Copy link
Owner

clux commented Feb 15, 2024

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

@imdmahajankanika
Copy link
Author

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
Copy link
Owner

clux commented Feb 24, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants