Skip to content

Using static lib in iOS fails with Undefined symbols #674

Closed
@ospfranco

Description

@ospfranco

Problem:

Hi! I continue on my journey to try to use this crate on iOS/Android. I've managed to compile my crate as a staticlib that I want to use in iOS. This approach has worked for me in the past with other Rust crates.

My cargo.toml is defined as such:

[package]
name = "rn-aws-lc"
version = "0.0.0"
edition = "2021"


[lib]
crate-type = ["staticlib"]

[dependencies]
aws-lc-rs = { version = "1.12.2", features = ["fips", "bindgen"] }

[build-dependencies]
cbindgen = "0.28.0"

[profile.dev]
incremental=true

I then take the compiled .a binary and drop it in a xcframework which I then add to an iOS project. However, when I try to build an example app I get the following errors:


Showing Recent Errors Only
Ld /Users/osp/Library/Developer/Xcode/DerivedData/OpAwsLcExample-dprqrhlvbttihtanehmzqayabuhj/Build/Products/Debug-iphonesimulator/OpAwsLcExample.app/OpAwsLcExample.debug.dylib normal (in target 'OpAwsLcExample' from project 'OpAwsLcExample')

clang: error: linker command failed with exit code 1 (use -v to see invocation)

Undefined symbol: _aws_lc_fips_0_13_1_AES_cbc_encrypt

Undefined symbol: _aws_lc_fips_0_13_1_AES_cfb128_encrypt

Undefined symbol: _aws_lc_fips_0_13_1_AES_ctr128_encrypt

Undefined symbol: _aws_lc_fips_0_13_1_AES_ecb_encrypt

Undefined symbol: _aws_lc_fips_0_13_1_AES_set_decrypt_key

Undefined symbol: _aws_lc_fips_0_13_1_AES_set_encrypt_key

Undefined symbol: _aws_lc_fips_0_13_1_AES_unwrap_key

Undefined symbol: _aws_lc_fips_0_13_1_AES_unwrap_key_padded

Undefined symbol: _aws_lc_fips_0_13_1_AES_wrap_key

Undefined symbol: _aws_lc_fips_0_13_1_AES_wrap_key_padded

Undefined symbol: _aws_lc_fips_0_13_1_BN_bin2bn

Undefined symbol: _aws_lc_fips_0_13_1_BN_bn2bin

Undefined symbol: _aws_lc_fips_0_13_1_BN_bn2bin_padded

Undefined symbol: _aws_lc_fips_0_13_1_BN_free

Undefined symbol: _aws_lc_fips_0_13_1_BN_new

Undefined symbol: _aws_lc_fips_0_13_1_BN_num_bits

Undefined symbol: _aws_lc_fips_0_13_1_BN_num_bytes

Undefined symbol: _aws_lc_fips_0_13_1_BN_set_u64

Undefined symbol: _aws_lc_fips_0_13_1_CBB_cleanup

Undefined symbol: _aws_lc_fips_0_13_1_CBB_finish

Undefined symbol: _aws_lc_fips_0_13_1_CBB_init

Undefined symbol: _aws_lc_fips_0_13_1_CBB_init_fixed

Undefined symbol: _aws_lc_fips_0_13_1_CBS_init

Undefined symbol: _aws_lc_fips_0_13_1_CRYPTO_library_init

Undefined symbol: _aws_lc_fips_0_13_1_CRYPTO_memcmp

Undefined symbol: _aws_lc_fips_0_13_1_CRYPTO_tls1_prf

Undefined symbol: _aws_lc_fips_0_13_1_ECDSA_SIG_free

Undefined symbol: _aws_lc_fips_0_13_1_ECDSA_SIG_new

Undefined symbol: _aws_lc_fips_0_13_1_ECDSA_SIG_set0

Undefined symbol: _aws_lc_fips_0_13_1_ECDSA_SIG_to_bytes

Undefined symbol: _aws_lc_fips_0_13_1_EC_GROUP_free

Undefined symbol: _aws_lc_fips_0_13_1_EC_GROUP_get_curve_name

Undefined symbol: _aws_lc_fips_0_13_1_EC_GROUP_new_by_curve_name

Undefined symbol: _aws_lc_fips_0_13_1_EC_KEY_check_fips

Undefined symbol: _aws_lc_fips_0_13_1_EC_KEY_free

Undefined symbol: _aws_lc_fips_0_13_1_EC_KEY_get0_group

Undefined symbol: _aws_lc_fips_0_13_1_EC_KEY_get0_private_key

Undefined symbol: _aws_lc_fips_0_13_1_EC_KEY_get0_public_key

Undefined symbol: _aws_lc_fips_0_13_1_EC_KEY_new

Undefined symbol: _aws_lc_fips_0_13_1_EC_KEY_set_group

Undefined symbol: _aws_lc_fips_0_13_1_EC_KEY_set_private_key

Undefined symbol: _aws_lc_fips_0_13_1_EC_KEY_set_public_key

Undefined symbol: _aws_lc_fips_0_13_1_EC_POINT_free

Undefined symbol: _aws_lc_fips_0_13_1_EC_POINT_mul

Undefined symbol: _aws_lc_fips_0_13_1_EC_POINT_new

Undefined symbol: _aws_lc_fips_0_13_1_EC_POINT_oct2point

Undefined symbol: _aws_lc_fips_0_13_1_EC_POINT_point2oct

Undefined symbol: _aws_lc_fips_0_13_1_EVP_AEAD_CTX_free

Undefined symbol: _aws_lc_fips_0_13_1_EVP_AEAD_CTX_init

Undefined symbol: _aws_lc_fips_0_13_1_EVP_AEAD_CTX_init_with_direction

Undefined symbol: _aws_lc_fips_0_13_1_EVP_AEAD_CTX_zero

Undefined symbol: _aws_lc_fips_0_13_1_EVP_CIPHER_CTX_free

Undefined symbol: _aws_lc_fips_0_13_1_EVP_CIPHER_CTX_new

Undefined symbol: _aws_lc_fips_0_13_1_EVP_DecryptFinal_ex

Undefined symbol: _aws_lc_fips_0_13_1_EVP_DecryptInit_ex

Undefined symbol: _aws_lc_fips_0_13_1_EVP_DecryptUpdate

Undefined symbol: _aws_lc_fips_0_13_1_EVP_DigestFinal

Undefined symbol: _aws_lc_fips_0_13_1_EVP_DigestInit_ex

Undefined symbol: _aws_lc_fips_0_13_1_EVP_DigestSign

Undefined symbol: _aws_lc_fips_0_13_1_EVP_DigestSignInit

Undefined symbol: _aws_lc_fips_0_13_1_EVP_DigestUpdate

Undefined symbol: _aws_lc_fips_0_13_1_EVP_DigestVerify

Undefined symbol: _aws_lc_fips_0_13_1_EVP_DigestVerifyInit

Undefined symbol: _aws_lc_fips_0_13_1_EVP_EncryptFinal_ex

Undefined symbol: _aws_lc_fips_0_13_1_EVP_EncryptInit_ex

Undefined symbol: _aws_lc_fips_0_13_1_EVP_EncryptUpdate

Undefined symbol: _aws_lc_fips_0_13_1_EVP_MD_CTX_cleanup

Undefined symbol: _aws_lc_fips_0_13_1_EVP_MD_CTX_copy

Undefined symbol: _aws_lc_fips_0_13_1_EVP_MD_CTX_init

Undefined symbol: _aws_lc_fips_0_13_1_EVP_PKEY_CTX_free

Undefined symbol: _aws_lc_fips_0_13_1_EVP_PKEY_CTX_new

Undefined symbol: _aws_lc_fips_0_13_1_EVP_PKEY_CTX_new_id

Undefined symbol: _aws_lc_fips_0_13_1_EVP_PKEY_CTX_set0_rsa_oaep_label

Undefined symbol: _aws_lc_fips_0_13_1_EVP_PKEY_CTX_set_rsa_mgf1_md

Undefined symbol: _aws_lc_fips_0_13_1_EVP_PKEY_CTX_set_rsa_oaep_md

Undefined symbol: _aws_lc_fips_0_13_1_EVP_PKEY_CTX_set_rsa_padding

Undefined symbol: _aws_lc_fips_0_13_1_EVP_PKEY_CTX_set_rsa_pss_saltlen

Undefined symbol: _aws_lc_fips_0_13_1_EVP_PKEY_assign_EC_KEY

Undefined symbol: _aws_lc_fips_0_13_1_EVP_PKEY_assign_RSA

Undefined symbol: _aws_lc_fips_0_13_1_EVP_PKEY_bits

Undefined symbol: _aws_lc_fips_0_13_1_EVP_PKEY_decrypt

Undefined symbol: _aws_lc_fips_0_13_1_EVP_PKEY_decrypt_init

Undefined symbol: _aws_lc_fips_0_13_1_EVP_PKEY_encrypt

Undefined symbol: _aws_lc_fips_0_13_1_EVP_PKEY_encrypt_init

Undefined symbol: _aws_lc_fips_0_13_1_EVP_PKEY_free

Undefined symbol: _aws_lc_fips_0_13_1_EVP_PKEY_get0_EC_KEY

Undefined symbol: _aws_lc_fips_0_13_1_EVP_PKEY_get0_RSA

Undefined symbol: _aws_lc_fips_0_13_1_EVP_PKEY_get1_RSA

Undefined symbol: _aws_lc_fips_0_13_1_EVP_PKEY_get_raw_private_key

Undefined symbol: _aws_lc_fips_0_13_1_EVP_PKEY_get_raw_public_key

Undefined symbol: _aws_lc_fips_0_13_1_EVP_PKEY_id

Undefined symbol: _aws_lc_fips_0_13_1_EVP_PKEY_keygen

Undefined symbol: _aws_lc_fips_0_13_1_EVP_PKEY_keygen_init

Undefined symbol: _aws_lc_fips_0_13_1_EVP_PKEY_new

Undefined symbol: _aws_lc_fips_0_13_1_EVP_PKEY_new_raw_private_key

Undefined symbol: _aws_lc_fips_0_13_1_EVP_PKEY_new_raw_public_key

Undefined symbol: _aws_lc_fips_0_13_1_EVP_PKEY_size

Undefined symbol: _aws_lc_fips_0_13_1_EVP_PKEY_up_ref

Undefined symbol: _aws_lc_fips_0_13_1_EVP_aead_aes_128_gcm

Undefined symbol: _aws_lc_fips_0_13_1_EVP_aead_aes_128_gcm_randnonce

Linker command failed with exit code 1 (use -v to see invocation)

I remember briefly seeing that using the fips feature relies on some other aws-lc static library? Any advice is much appreciated!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions