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

Linker errors when building binaries (failed to set dynamic section sizes: bad value) #124

Closed
Ploppz opened this issue Sep 28, 2023 · 5 comments
Labels

Comments

@Ploppz
Copy link

Ploppz commented Sep 28, 2023

I cannot share the code unfortunately.
I tried cargo run --bins --release in my project. For 3 binary targets, it generated these errors (removed unnecessary note about the entire ld command):

  = note: /usr/bin/ld: /volume/target/x86_64-unknown-linux-musl/release/deps/libring-5ef523db0ddc8a2a.rlib(aes_nohw.o): relocation R_X86_64_32S against `.rodata.aes_nohw_rcon' can not be used when making a PIE object; recompile with -fPIE
          /usr/bin/ld: failed to set dynamic section sizes: bad value
          collect2: error: ld returned 1 exit status

  = note: /usr/bin/ld: /volume/target/x86_64-unknown-linux-musl/release/deps/libring-5ef523db0ddc8a2a.rlib(aes_nohw.o): relocation R_X86_64_32S against `.rodata.aes_nohw_rcon' can not be used when making a PIE object; recompile with -fPIE
          /usr/bin/ld: failed to set dynamic section sizes: bad value
          collect2: error: ld returned 1 exit status

  = note: /usr/bin/ld: /volume/target/x86_64-unknown-linux-musl/release/deps/libring-5ef523db0ddc8a2a.rlib(curve25519.o): relocation R_X86_64_32S against `.rodata.k25519Precomp' can not be used when making a PIE object; recompile with -fPIE
          /usr/bin/ld: failed to set dynamic section sizes: bad value
          collect2: error: ld returned 1 exit status

Edit: I also get this

  = note: /usr/bin/ld: /volume/target/x86_64-unknown-linux-musl/release/deps/libpq_sys-4f6d965905cb4b30.rlib(fe-secure-openssl.o): in function `sk_GENERAL_NAME_num':
          fe-secure-openssl.c:(.text+0x14): undefined reference to `OPENSSL_sk_num'
          /usr/bin/ld: /volume/target/x86_64-unknown-linux-musl/release/deps/libpq_sys-4f6d965905cb4b30.rlib(fe-secure-openssl.o): in function `sk_GENERAL_NAME_value':
          fe-secure-openssl.c:(.text+0x36): undefined reference to `OPENSSL_sk_value'
          /usr/bin/ld: /volume/target/x86_64-unknown-linux-musl/release/deps/libpq_sys-4f6d965905cb4b30.rlib(fe-secure-openssl.o): in function `sk_GENERAL_NAME_pop_free':
          fe-secure-openssl.c:(.text+0x5b): undefined reference to `OPENSSL_sk_pop_free'
          /usr/bin/ld: /volume/target/x86_64-unknown-linux-musl/release/deps/libpq_sys-4f6d965905cb4b30.rlib(fe-secure-openssl.o): in function `pgtls_read':
          fe-secure-openssl.c:(.text+0x133): undefined reference to `ERR_clear_error'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x15c): undefined reference to `SSL_read'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x186): undefined reference to `SSL_get_error'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x1a4): undefined reference to `ERR_get_error'
          /usr/bin/ld: /volume/target/x86_64-unknown-linux-musl/release/deps/libpq_sys-4f6d965905cb4b30.rlib(fe-secure-openssl.o): in function `pgtls_read_pending':
          fe-secure-openssl.c:(.text+0x44e): undefined reference to `SSL_pending'
          /usr/bin/ld: /volume/target/x86_64-unknown-linux-musl/release/deps/libpq_sys-4f6d965905cb4b30.rlib(fe-secure-openssl.o): in function `pgtls_write':
          fe-secure-openssl.c:(.text+0x4a2): undefined reference to `ERR_clear_error'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x4cb): undefined reference to `SSL_write'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x4f5): undefined reference to `SSL_get_error'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x513): undefined reference to `ERR_get_error'
          /usr/bin/ld: /volume/target/x86_64-unknown-linux-musl/release/deps/libpq_sys-4f6d965905cb4b30.rlib(fe-secure-openssl.o): in function `pgtls_get_peer_certificate_hash':
          fe-secure-openssl.c:(.text+0x80d): undefined reference to `X509_get_signature_nid'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x822): undefined reference to `OBJ_find_sigid_algs'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x863): undefined reference to `EVP_sha256'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x873): undefined reference to `OBJ_nid2sn'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x87b): undefined reference to `EVP_get_digestbyname'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x890): undefined reference to `OBJ_nid2sn'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x8d7): undefined reference to `X509_digest'
          /usr/bin/ld: /volume/target/x86_64-unknown-linux-musl/release/deps/libpq_sys-4f6d965905cb4b30.rlib(fe-secure-openssl.o): in function `openssl_verify_peer_name_matches_certificate_name':
          fe-secure-openssl.c:(.text+0x9e8): undefined reference to `ASN1_STRING_get0_data'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x9f8): undefined reference to `ASN1_STRING_length'
          /usr/bin/ld: /volume/target/x86_64-unknown-linux-musl/release/deps/libpq_sys-4f6d965905cb4b30.rlib(fe-secure-openssl.o): in function `pgtls_verify_peer_name_matches_certificate_guts':
          fe-secure-openssl.c:(.text+0xa67): undefined reference to `X509_get_ext_d2i'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0xb30): undefined reference to `GENERAL_NAME_free'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0xb58): undefined reference to `X509_get_subject_name'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0xb79): undefined reference to `X509_NAME_get_index_by_NID'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0xba2): undefined reference to `X509_NAME_get_entry'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0xbaa): undefined reference to `X509_NAME_ENTRY_get_data'
          /usr/bin/ld: /volume/target/x86_64-unknown-linux-musl/release/deps/libpq_sys-4f6d965905cb4b30.rlib(fe-secure-openssl.o): in function `pgtls_init':
          fe-secure-openssl.c:(.text+0xc2e): undefined reference to `OPENSSL_init_ssl'
          /usr/bin/ld: /volume/target/x86_64-unknown-linux-musl/release/deps/libpq_sys-4f6d965905cb4b30.rlib(fe-secure-openssl.o): in function `initialize_SSL':
          fe-secure-openssl.c:(.text+0xd52): undefined reference to `TLS_method'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0xd5a): undefined reference to `SSL_CTX_new'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0xd70): undefined reference to `ERR_get_error'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0xddb): undefined reference to `SSL_CTX_set_options'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0xdf9): undefined reference to `SSL_CTX_ctrl'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0xed9): undefined reference to `SSL_CTX_load_verify_locations'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0xee3): undefined reference to `ERR_get_error'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0xf46): undefined reference to `SSL_CTX_free'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0xf5f): undefined reference to `SSL_CTX_get_cert_store'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x102f): undefined reference to `X509_STORE_load_locations'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x1048): undefined reference to `X509_STORE_set_flags'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x104d): undefined reference to `ERR_clear_error'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x10dd): undefined reference to `SSL_CTX_free'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x122e): undefined reference to `SSL_CTX_free'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x125d): undefined reference to `SSL_CTX_use_certificate_chain_file'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x1267): undefined reference to `ERR_get_error'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x12ca): undefined reference to `SSL_CTX_free'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x12ea): undefined reference to `SSL_new'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x132d): undefined reference to `SSL_set_ex_data'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x1358): undefined reference to `ERR_get_error'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x13b4): undefined reference to `SSL_CTX_free'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x13db): undefined reference to `SSL_CTX_free'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x14d8): undefined reference to `ENGINE_by_id'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x14fe): undefined reference to `ERR_get_error'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x1581): undefined reference to `ENGINE_init'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x158e): undefined reference to `ERR_get_error'
          /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+0x1664): undefined reference to `ERR_get_error'
          /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+0x1739): undefined reference to `SSL_use_PrivateKey'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x1747): undefined reference to `ERR_get_error'
          /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: fe-secure-openssl.c:(.text+0x196d): undefined reference to `SSL_use_PrivateKey_file'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x1977): undefined reference to `ERR_get_error'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x19f4): undefined reference to `SSL_check_private_key'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x19fe): undefined reference to `ERR_get_error'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x1a87): undefined reference to `SSL_set_verify'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x1aca): undefined reference to `SSL_set_options'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x1ae7): undefined reference to `SSL_clear_options'
          /usr/bin/ld: /volume/target/x86_64-unknown-linux-musl/release/deps/libpq_sys-4f6d965905cb4b30.rlib(fe-secure-openssl.o): in function `open_client_SSL':
          fe-secure-openssl.c:(.text+0x1b2c): undefined reference to `ERR_clear_error'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x1b42): undefined reference to `SSL_connect'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x1b73): undefined reference to `SSL_get_error'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x1b7e): undefined reference to `ERR_get_error'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x1d34): undefined reference to `SSL_get_peer_certificate'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x1d5a): undefined reference to `ERR_get_error'
          /usr/bin/ld: /volume/target/x86_64-unknown-linux-musl/release/deps/libpq_sys-4f6d965905cb4b30.rlib(fe-secure-openssl.o): in function `pgtls_close':
          fe-secure-openssl.c:(.text+0x1e3f): undefined reference to `SSL_shutdown'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x1e52): undefined reference to `SSL_free'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x1e8f): undefined reference to `X509_free'
          /usr/bin/ld: 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-4f6d965905cb4b30.rlib(fe-secure-openssl.o): in function `SSLerrmessage':
          fe-secure-openssl.c:(.text+0x1f58): undefined reference to `ERR_reason_error_string'
          /usr/bin/ld: /volume/target/x86_64-unknown-linux-musl/release/deps/libpq_sys-4f6d965905cb4b30.rlib(fe-secure-openssl.o): in function `PQsslAttribute':
          fe-secure-openssl.c:(.text+0x2104): undefined reference to `SSL_get_current_cipher'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x2116): undefined reference to `SSL_CIPHER_get_bits'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x2177): undefined reference to `SSL_get_current_cipher'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x217f): undefined reference to `SSL_CIPHER_get_name'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x21ae): undefined reference to `SSL_get_current_compression'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x21f2): undefined reference to `SSL_get_version'
          /usr/bin/ld: /volume/target/x86_64-unknown-linux-musl/release/deps/libpq_sys-4f6d965905cb4b30.rlib(fe-secure-openssl.o): in function `my_sock_read':
          fe-secure-openssl.c:(.text+0x2239): undefined reference to `BIO_get_data'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x2262): undefined reference to `BIO_clear_flags'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x228a): undefined reference to `BIO_set_flags'
          /usr/bin/ld: /volume/target/x86_64-unknown-linux-musl/release/deps/libpq_sys-4f6d965905cb4b30.rlib(fe-secure-openssl.o): in function `my_sock_write':
          fe-secure-openssl.c:(.text+0x22c0): undefined reference to `BIO_get_data'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x22e9): undefined reference to `BIO_clear_flags'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x2311): undefined reference to `BIO_set_flags'
          /usr/bin/ld: /volume/target/x86_64-unknown-linux-musl/release/deps/libpq_sys-4f6d965905cb4b30.rlib(fe-secure-openssl.o): in function `my_BIO_s_socket':
          fe-secure-openssl.c:(.text+0x233e): undefined reference to `BIO_s_socket'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x2347): undefined reference to `BIO_get_new_index'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x236e): undefined reference to `BIO_meth_new'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x23a4): undefined reference to `BIO_meth_set_write'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x23c5): undefined reference to `BIO_meth_set_read'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x23d9): undefined reference to `BIO_meth_get_gets'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x23ee): undefined reference to `BIO_meth_set_gets'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x2402): undefined reference to `BIO_meth_get_puts'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x2417): undefined reference to `BIO_meth_set_puts'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x242b): undefined reference to `BIO_meth_get_ctrl'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x2440): undefined reference to `BIO_meth_set_ctrl'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x2450): undefined reference to `BIO_meth_get_create'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x2465): undefined reference to `BIO_meth_set_create'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x2475): undefined reference to `BIO_meth_get_destroy'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x248a): undefined reference to `BIO_meth_set_destroy'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x249a): undefined reference to `BIO_meth_get_callback_ctrl'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x24af): undefined reference to `BIO_meth_set_callback_ctrl'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x24c2): undefined reference to `BIO_meth_free'
          /usr/bin/ld: /volume/target/x86_64-unknown-linux-musl/release/deps/libpq_sys-4f6d965905cb4b30.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+0x253c): undefined reference to `BIO_new'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x256b): undefined reference to `ERR_put_error'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x2580): undefined reference to `BIO_set_data'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x259e): undefined reference to `SSL_set_bio'
          /usr/bin/ld: fe-secure-openssl.c:(.text+0x25b9): undefined reference to `BIO_int_ctrl'
          /usr/bin/ld: /volume/target/x86_64-unknown-linux-musl/release/deps/libpq_sys-4f6d965905cb4b30.rlib(pg_strong_random.o): in function `pg_strong_random':
          pg_strong_random.c:(.text+0x1e): undefined reference to `RAND_status'
          /usr/bin/ld: pg_strong_random.c:(.text+0x28): undefined reference to `RAND_poll'
          /usr/bin/ld: pg_strong_random.c:(.text+0x50): undefined reference to `RAND_bytes'
          /usr/bin/ld: /volume/target/x86_64-unknown-linux-musl/release/deps/libpq_sys-4f6d965905cb4b30.rlib(sha2_openssl.o): in function `pg_sha256_init':
          sha2_openssl.c:(.text+0x18): undefined reference to `SHA256_Init'
          /usr/bin/ld: /volume/target/x86_64-unknown-linux-musl/release/deps/libpq_sys-4f6d965905cb4b30.rlib(sha2_openssl.o): in function `pg_sha256_update':
          sha2_openssl.c:(.text+0x4a): undefined reference to `SHA256_Update'
          /usr/bin/ld: /volume/target/x86_64-unknown-linux-musl/release/deps/libpq_sys-4f6d965905cb4b30.rlib(sha2_openssl.o): in function `pg_sha256_final':
          sha2_openssl.c:(.text+0x74): undefined reference to `SHA256_Final'
          /usr/bin/ld: /volume/target/x86_64-unknown-linux-musl/release/deps/libpq_sys-4f6d965905cb4b30.rlib(sha2_openssl.o): in function `pg_sha512_init':
          sha2_openssl.c:(.text+0x93): undefined reference to `SHA512_Init'
          /usr/bin/ld: /volume/target/x86_64-unknown-linux-musl/release/deps/libpq_sys-4f6d965905cb4b30.rlib(sha2_openssl.o): in function `pg_sha512_update':
          sha2_openssl.c:(.text+0xc5): undefined reference to `SHA512_Update'
          /usr/bin/ld: /volume/target/x86_64-unknown-linux-musl/release/deps/libpq_sys-4f6d965905cb4b30.rlib(sha2_openssl.o): in function `pg_sha512_final':
          sha2_openssl.c:(.text+0xef): undefined reference to `SHA512_Final'
          /usr/bin/ld: /volume/target/x86_64-unknown-linux-musl/release/deps/libpq_sys-4f6d965905cb4b30.rlib(sha2_openssl.o): in function `pg_sha384_init':
          sha2_openssl.c:(.text+0x10e): undefined reference to `SHA384_Init'
          /usr/bin/ld: /volume/target/x86_64-unknown-linux-musl/release/deps/libpq_sys-4f6d965905cb4b30.rlib(sha2_openssl.o): in function `pg_sha384_update':
          sha2_openssl.c:(.text+0x140): undefined reference to `SHA384_Update'
          /usr/bin/ld: /volume/target/x86_64-unknown-linux-musl/release/deps/libpq_sys-4f6d965905cb4b30.rlib(sha2_openssl.o): in function `pg_sha384_final':
          sha2_openssl.c:(.text+0x16a): undefined reference to `SHA384_Final'
          /usr/bin/ld: /volume/target/x86_64-unknown-linux-musl/release/deps/libpq_sys-4f6d965905cb4b30.rlib(sha2_openssl.o): in function `pg_sha224_init':
          sha2_openssl.c:(.text+0x189): undefined reference to `SHA224_Init'
          /usr/bin/ld: /volume/target/x86_64-unknown-linux-musl/release/deps/libpq_sys-4f6d965905cb4b30.rlib(sha2_openssl.o): in function `pg_sha224_update':
          sha2_openssl.c:(.text+0x1bb): undefined reference to `SHA224_Update'
          /usr/bin/ld: /volume/target/x86_64-unknown-linux-musl/release/deps/libpq_sys-4f6d965905cb4b30.rlib(sha2_openssl.o): in function `pg_sha224_final':
          sha2_openssl.c:(.text+0x1e5): undefined reference to `SHA224_Final'
          collect2: error: ld returned 1 exit status

Do you have an idea what could be wrong from these errors? If you require more information, I will try to answer.

@Ploppz Ploppz changed the title Linker errors when building binaries Linker errors when building binaries (failed to set dynamic section sizes: bad value) Sep 28, 2023
@clux
Copy link
Owner

clux commented Sep 28, 2023

based on the symbols it looks like likely related to libpq
what does ldd mybinary output?

note that libpq is a bit problematic static linking wise anyway; see #81.

@Ploppz
Copy link
Author

Ploppz commented Sep 28, 2023

Do you mean mybinary as compiled with normal (not musl) compiler?

@Ploppz
Copy link
Author

Ploppz commented Sep 28, 2023

Here it is

	linux-vdso.so.1 (0x00007ffd4d560000)
	libssl.so.3 => /usr/lib/libssl.so.3 (0x00007f4a5bf60000)
	libcrypto.so.3 => /usr/lib/libcrypto.so.3 (0x00007f4a5ba00000)
	libpq.so.5 => /usr/lib/libpq.so.5 (0x00007f4a5bf0e000)
	libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x00007f4a5c405000)
	libm.so.6 => /usr/lib/libm.so.6 (0x00007f4a5b913000)
	libc.so.6 => /usr/lib/libc.so.6 (0x00007f4a5b731000)
	/lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x00007f4a5c45d000)
	libgssapi_krb5.so.2 => /usr/lib/libgssapi_krb5.so.2 (0x00007f4a5b6dd000)
	libldap.so.2 => /usr/lib/libldap.so.2 (0x00007f4a5b67d000)
	libkrb5.so.3 => /usr/lib/libkrb5.so.3 (0x00007f4a5b5a5000)
	libk5crypto.so.3 => /usr/lib/libk5crypto.so.3 (0x00007f4a5b577000)
	libcom_err.so.2 => /usr/lib/libcom_err.so.2 (0x00007f4a5c3fd000)
	libkrb5support.so.0 => /usr/lib/libkrb5support.so.0 (0x00007f4a5c3ef000)
	libkeyutils.so.1 => /usr/lib/libkeyutils.so.1 (0x00007f4a5c3e6000)
	libresolv.so.2 => /usr/lib/libresolv.so.2 (0x00007f4a5b566000)
	liblber.so.2 => /usr/lib/liblber.so.2 (0x00007f4a5b555000)
	libsasl2.so.3 => /usr/lib/libsasl2.so.3 (0x00007f4a5b536000)

@clux
Copy link
Owner

clux commented Sep 28, 2023

Do you mean mybinary as compiled with normal (not musl) compiler?

ah you are failing to link. sorry, i thought you got that error from the run stage of an executable compiled with musl.

then it's hard to know. i haven't actually updated the libpq stuff in a while. some things to verify:

  • do you have any modifications that you are using on top of the docker image that would mess with the compile configuration?
  • did you follow the libpq/diesel caveat thing? https://github.com/clux/muslrust#diesel-and-pq-builds if that is applicable
  • does the local libpq test just _t "pq" i believe (it's possible the test is out of date and it doesn't work now)

@Ploppz
Copy link
Author

Ploppz commented Sep 29, 2023

Thanks, your second point seems to have fixed it!
So I have to add openssl dependency to Cargo.toml even though it's not used directly in my crate, and I have to add

extern crate openssl;
extern crate diesel;

to every crate and every src/bin binary target.

@Ploppz Ploppz closed this as completed Sep 29, 2023
@clux clux added the question label Sep 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants