tuist: GRPC Dependency causes issues when added to a framework

Describe the bug When using the new dependency feature, when adding GRPC as a dependency to a framework target I get a missing symbols error. When changing the target to a static library the issue is not reproducible. This is not expected.

To Reproduce Steps to reproduce the behavior:

  1. Clone demo repo: https://github.com/samisuteria/TuistGRPC
  2. Change product: .staticLibrary, to product: .framework on line 6 of Project.swift
  3. Run tuist dependencies fetch
  4. Run tuist cache warm
  5. Get error in console: The 'xcodebuild' command exited with error code 65
  6. Run tuist generate --open and build DemoKit in Xcode
  7. Get error in Xcode:
Undefined symbols for architecture x86_64:
  "_CNIOBoringSSL_rsaz_1024_norm2red_avx2", referenced from:
      _CNIOBoringSSL_RSAZ_1024_mod_exp_avx2 in CNIOBoringSSL(rsaz_exp.o)
  "_CNIOBoringSSL_rsaz_1024_scatter5_avx2", referenced from:
      _CNIOBoringSSL_RSAZ_1024_mod_exp_avx2 in CNIOBoringSSL(rsaz_exp.o)
  "_CNIOBoringSSL_rsaz_1024_sqr_avx2", referenced from:
      _CNIOBoringSSL_RSAZ_1024_mod_exp_avx2 in CNIOBoringSSL(rsaz_exp.o)
  "_CNIOBoringSSL_bn_scatter5", referenced from:
      _CNIOBoringSSL_BN_mod_exp_mont_consttime in CNIOBoringSSL(exponentiation.o)
  "_CNIOBoringSSL_bn_gather5", referenced from:
      _CNIOBoringSSL_BN_mod_exp_mont_consttime in CNIOBoringSSL(exponentiation.o)
  "_CNIOBoringSSL_bn_power5", referenced from:
      _CNIOBoringSSL_BN_mod_exp_mont_consttime in CNIOBoringSSL(exponentiation.o)
  "vtable for __cxxabiv1::__si_class_type_info", referenced from:
      typeinfo for bssl::CNIOBoringSSL::(anonymous namespace)::ECKeyShare in CNIOBoringSSL(ssl_key_share.o)
      typeinfo for bssl::CNIOBoringSSL::(anonymous namespace)::X25519KeyShare in CNIOBoringSSL(ssl_key_share.o)
      typeinfo for bssl::CNIOBoringSSL::(anonymous namespace)::CECPQ2KeyShare in CNIOBoringSSL(ssl_key_share.o)
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
  "vtable for __cxxabiv1::__class_type_info", referenced from:
      typeinfo for bssl::CNIOBoringSSL::SSLKeyShare in CNIOBoringSSL(ssl_key_share.o)
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
  "_CNIOBoringSSL_ChaCha20_ctr32", referenced from:
      _CNIOBoringSSL_CRYPTO_chacha_20 in CNIOBoringSSL(chacha.o)
  "_CNIOBoringSSL_sha256_block_data_order", referenced from:
      _CNIOBoringSSL_SHA256_Update in CNIOBoringSSL(sha256.o)
      _CNIOBoringSSL_SHA256_Transform in CNIOBoringSSL(sha256.o)
      _sha256_final_impl in CNIOBoringSSL(sha256.o)
      _CNIOBoringSSL_SHA256_TransformBlocks in CNIOBoringSSL(sha256.o)
  "_CNIOBoringSSL_CRYPTO_rdrand", referenced from:
      _rdrand in CNIOBoringSSL(rand.o)
  "_CNIOBoringSSL_gcm_gmult_clmul", referenced from:
      _CNIOBoringSSL_CRYPTO_ghash_init in CNIOBoringSSL(gcm.o)
  "_CNIOBoringSSL_beeu_mod_inverse_vartime", referenced from:
      _ecp_nistz256_scalar_to_montgomery_inv_vartime in CNIOBoringSSL(p256-x86_64.o)
  "_CNIOBoringSSL_ecp_nistz256_select_w7", referenced from:
      _ecp_nistz256_point_mul_base in CNIOBoringSSL(p256-x86_64.o)
  "_CNIOBoringSSL_ecp_nistz256_ord_sqr_mont", referenced from:
      _ecp_nistz256_inv0_mod_ord in CNIOBoringSSL(p256-x86_64.o)
  "_CNIOBoringSSL_bn_from_montgomery", referenced from:
      _CNIOBoringSSL_BN_mod_exp_mont_consttime in CNIOBoringSSL(exponentiation.o)
     (maybe you meant: _CNIOBoringSSL_bn_from_montgomery_small)
  "_CNIOBoringSSL_chacha20_poly1305_seal", referenced from:
      _chacha20_poly1305_seal_scatter in CNIOBoringSSL(e_chacha20poly1305.o)
  "_CNIOBoringSSL_ecp_nistz256_ord_mul_mont", referenced from:
      _ecp_nistz256_inv0_mod_ord in CNIOBoringSSL(p256-x86_64.o)
  "_CNIOBoringSSL_ecp_nistz256_point_add_affine", referenced from:
      _ecp_nistz256_point_mul_base in CNIOBoringSSL(p256-x86_64.o)
      _ecp_nistz256_points_mul_public in CNIOBoringSSL(p256-x86_64.o)
  "_CNIOBoringSSL_gcm_gmult_ssse3", referenced from:
      _CNIOBoringSSL_CRYPTO_ghash_init in CNIOBoringSSL(gcm.o)
  "_CNIOBoringSSL_sha1_block_data_order", referenced from:
      _CNIOBoringSSL_SHA1_Update in CNIOBoringSSL(sha1.o)
      _CNIOBoringSSL_SHA1_Final in CNIOBoringSSL(sha1.o)
      _CNIOBoringSSL_SHA1_Transform in CNIOBoringSSL(sha1.o)
  "_CNIOBoringSSL_gcm_gmult_avx", referenced from:
      _CNIOBoringSSL_CRYPTO_ghash_init in CNIOBoringSSL(gcm.o)
  "_CNIOBoringSSL_ecp_nistz256_point_add", referenced from:
      _ecp_nistz256_add in CNIOBoringSSL(p256-x86_64.o)
      _ecp_nistz256_points_mul_public in CNIOBoringSSL(p256-x86_64.o)
      _ecp_nistz256_windowed_mul in CNIOBoringSSL(p256-x86_64.o)
  "_CNIOBoringSSL_aesni_gcm_decrypt", referenced from:
      _CNIOBoringSSL_CRYPTO_gcm128_decrypt_ctr32 in CNIOBoringSSL(gcm.o)
  "_CNIOBoringSSL_gcm_ghash_avx", referenced from:
      _CNIOBoringSSL_CRYPTO_ghash_init in CNIOBoringSSL(gcm.o)
  "_CNIOBoringSSL_ecp_nistz256_sqr_mont", referenced from:
      _ecp_nistz256_get_affine in CNIOBoringSSL(p256-x86_64.o)
      _ecp_nistz256_mod_inverse_sqr_mont in CNIOBoringSSL(p256-x86_64.o)
  "_CNIOBoringSSL_aesni_gcm_encrypt", referenced from:
      _CNIOBoringSSL_CRYPTO_gcm128_encrypt_ctr32 in CNIOBoringSSL(gcm.o)
  "_CNIOBoringSSL_ecp_nistz256_select_w5", referenced from:
      _ecp_nistz256_windowed_mul in CNIOBoringSSL(p256-x86_64.o)
  "_CNIOBoringSSL_gcm_init_clmul", referenced from:
      _CNIOBoringSSL_CRYPTO_ghash_init in CNIOBoringSSL(gcm.o)
  "_CNIOBoringSSL_aes_hw_set_encrypt_key", referenced from:
      _CNIOBoringSSL_aes_ctr_set_key in CNIOBoringSSL(e_aes.o)
      _aes_init_key in CNIOBoringSSL(e_aes.o)
  "_CNIOBoringSSL_chacha20_poly1305_open", referenced from:
      _chacha20_poly1305_open_gather in CNIOBoringSSL(e_chacha20poly1305.o)
  "_CNIOBoringSSL_rsaz_1024_red2norm_avx2", referenced from:
      _CNIOBoringSSL_RSAZ_1024_mod_exp_avx2 in CNIOBoringSSL(rsaz_exp.o)
  "_CNIOBoringSSL_ecp_nistz256_mul_mont", referenced from:
      _ecp_nistz256_get_affine in CNIOBoringSSL(p256-x86_64.o)
      _ecp_nistz256_cmp_x_coordinate in CNIOBoringSSL(p256-x86_64.o)
      _ecp_nistz256_mod_inverse_sqr_mont in CNIOBoringSSL(p256-x86_64.o)
      _ecp_nistz256_from_mont in CNIOBoringSSL(p256-x86_64.o)
  "_CNIOBoringSSL_aes_hw_ecb_encrypt", referenced from:
      _aes_hw_ecb_cipher in CNIOBoringSSL(e_aes.o)
  "_CNIOBoringSSL_gcm_ghash_clmul", referenced from:
      _CNIOBoringSSL_CRYPTO_ghash_init in CNIOBoringSSL(gcm.o)
  "_CNIOBoringSSL_CRYPTO_rdrand_multiple8_buf", referenced from:
      _rdrand in CNIOBoringSSL(rand.o)
  "_CNIOBoringSSL_vpaes_cbc_encrypt", referenced from:
      _aes_init_key in CNIOBoringSSL(e_aes.o)
  "_CNIOBoringSSL_aes_hw_set_decrypt_key", referenced from:
      _aes_init_key in CNIOBoringSSL(e_aes.o)
  "_CNIOBoringSSL_aes_hw_decrypt", referenced from:
      _aes_init_key in CNIOBoringSSL(e_aes.o)
  "_CNIOBoringSSL_gcm_ghash_ssse3", referenced from:
      _CNIOBoringSSL_CRYPTO_ghash_init in CNIOBoringSSL(gcm.o)
  "_CNIOBoringSSL_gcm_init_avx", referenced from:
      _CNIOBoringSSL_CRYPTO_ghash_init in CNIOBoringSSL(gcm.o)
  "_CNIOBoringSSL_aes_hw_ctr32_encrypt_blocks", referenced from:
      _CNIOBoringSSL_aes_ctr_set_key in CNIOBoringSSL(e_aes.o)
      _aes_init_key in CNIOBoringSSL(e_aes.o)
  "_CNIOBoringSSL_bn_mul_mont", referenced from:
      _CNIOBoringSSL_BN_mod_mul_montgomery in CNIOBoringSSL(montgomery.o)
      _CNIOBoringSSL_bn_mod_mul_montgomery_small in CNIOBoringSSL(montgomery.o)
      _CNIOBoringSSL_BN_mod_exp_mont_consttime in CNIOBoringSSL(exponentiation.o)
  "_CNIOBoringSSL_vpaes_ctr32_encrypt_blocks", referenced from:
      _CNIOBoringSSL_aes_ctr_set_key in CNIOBoringSSL(e_aes.o)
      _aes_init_key in CNIOBoringSSL(e_aes.o)
  "_CNIOBoringSSL_sha512_block_data_order", referenced from:
      _CNIOBoringSSL_SHA512_Update in CNIOBoringSSL(sha512.o)
      _sha512_final_impl in CNIOBoringSSL(sha512.o)
      _CNIOBoringSSL_SHA512_Transform in CNIOBoringSSL(sha512.o)
  "_CNIOBoringSSL_rsaz_1024_mul_avx2", referenced from:
      _CNIOBoringSSL_RSAZ_1024_mod_exp_avx2 in CNIOBoringSSL(rsaz_exp.o)
  "_CNIOBoringSSL_vpaes_decrypt", referenced from:
      _aes_init_key in CNIOBoringSSL(e_aes.o)
  "_CNIOBoringSSL_vpaes_set_decrypt_key", referenced from:
      _aes_init_key in CNIOBoringSSL(e_aes.o)
  "_CNIOBoringSSL_aes_hw_cbc_encrypt", referenced from:
      _aes_init_key in CNIOBoringSSL(e_aes.o)
  "_CNIOBoringSSL_aes_hw_encrypt", referenced from:
      _CNIOBoringSSL_aes_ctr_set_key in CNIOBoringSSL(e_aes.o)
      _aes_init_key in CNIOBoringSSL(e_aes.o)
  "___cxa_begin_catch", referenced from:
      ___clang_call_terminate in CNIOBoringSSL(ssl_cipher.o)
  "_CNIOBoringSSL_md5_block_asm_data_order", referenced from:
      _CNIOBoringSSL_MD5_Update in CNIOBoringSSL(md5.o)
      _CNIOBoringSSL_MD5_Final in CNIOBoringSSL(md5.o)
      _CNIOBoringSSL_MD5_Transform in CNIOBoringSSL(md5.o)
  "_CNIOBoringSSL_vpaes_set_encrypt_key", referenced from:
      _CNIOBoringSSL_aes_ctr_set_key in CNIOBoringSSL(e_aes.o)
      _aes_init_key in CNIOBoringSSL(e_aes.o)
  "_CNIOBoringSSL_bn_mul_mont_gather5", referenced from:
      _CNIOBoringSSL_BN_mod_exp_mont_consttime in CNIOBoringSSL(exponentiation.o)
  "_CNIOBoringSSL_ecp_nistz256_point_double", referenced from:
      _ecp_nistz256_dbl in CNIOBoringSSL(p256-x86_64.o)
      _ecp_nistz256_windowed_mul in CNIOBoringSSL(p256-x86_64.o)
  "_CNIOBoringSSL_ecp_nistz256_neg", referenced from:
      _ecp_nistz256_point_mul_base in CNIOBoringSSL(p256-x86_64.o)
      _ecp_nistz256_points_mul_public in CNIOBoringSSL(p256-x86_64.o)
      _ecp_nistz256_windowed_mul in CNIOBoringSSL(p256-x86_64.o)
  "_CNIOBoringSSL_rsaz_1024_gather5_avx2", referenced from:
      _CNIOBoringSSL_RSAZ_1024_mod_exp_avx2 in CNIOBoringSSL(rsaz_exp.o)
  "_CNIOBoringSSL_vpaes_encrypt", referenced from:
      _CNIOBoringSSL_aes_ctr_set_key in CNIOBoringSSL(e_aes.o)
      _aes_init_key in CNIOBoringSSL(e_aes.o)
  "___gxx_personality_v0", referenced from:
      bssl::CNIOBoringSSL::SSLCipherPreferenceList::~SSLCipherPreferenceList() in CNIOBoringSSL(ssl_cipher.o)
      bssl::CNIOBoringSSL::SSLCipherPreferenceList::Init(std::__1::unique_ptr<stack_st_SSL_CIPHER, bssl::CNIOBoringSSL::internal::Deleter<stack_st_SSL_CIPHER> >, bssl::CNIOBoringSSL::Span<bool const>) in CNIOBoringSSL(ssl_cipher.o)
      bssl::CNIOBoringSSL::SSLCipherPreferenceList::Init(bssl::CNIOBoringSSL::SSLCipherPreferenceList const&) in CNIOBoringSSL(ssl_cipher.o)
      bssl::CNIOBoringSSL::ssl_create_cipher_list(std::__1::unique_ptr<bssl::CNIOBoringSSL::SSLCipherPreferenceList, bssl::CNIOBoringSSL::internal::Deleter<bssl::CNIOBoringSSL::SSLCipherPreferenceList> >*, char const*, bool) in CNIOBoringSSL(ssl_cipher.o)
      bssl::CNIOBoringSSL::ssl_cipher_collect_ciphers(bssl::CNIOBoringSSL::Array<bssl::CNIOBoringSSL::cipher_order_st>*, bssl::CNIOBoringSSL::cipher_order_st**, bssl::CNIOBoringSSL::cipher_order_st**) in CNIOBoringSSL(ssl_cipher.o)
      bssl::CNIOBoringSSL::ssl_cipher_strength_sort(bssl::CNIOBoringSSL::cipher_order_st**, bssl::CNIOBoringSSL::cipher_order_st**) in CNIOBoringSSL(ssl_cipher.o)
      bssl::CNIOBoringSSL::Array<int>::~Array() in CNIOBoringSSL(ssl_cipher.o)
      ...
  "std::terminate()", referenced from:
      ___clang_call_terminate in CNIOBoringSSL(ssl_cipher.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Expected behavior A clear and concise description of what you expected to happen.

Should be able to build the DemoKit target as a Framework.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: macOS 11.5.2
  • Tuist Version: 1.48.1
  • Swift Version: 5.4.2

Additional context Add any other context about the problem here.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 1
  • Comments: 18 (9 by maintainers)

Most upvoted comments

I know this is closed but FWIW, I’m still hitting it on latest releases of all the relevant frameworks and tuist, and it’s unclear what the resolution is based on the above 🤔

The issue pointed out originally and the include of non-modular header inside framework module error pointed out by @kwridan are not related.

The original issue appears in swift-nio-ssl versions prior to 2.18.0 and will be fixed by #4343. The new issue appears starting with 2.18.0 of swift-nio-ssl, as the import has been added fairly recently.

Maybe we should split the generation of the modulemap into a new GitHub issue? Generating the modulemap would probably also help with #3762.

@kwridan actually we already have a modulemap generator for our SPM to Tuist mapping so I think option 1 would be the best:

Do you see the modulemap generated when you generate the project? I would say that it’s either a problem of:

  • logic for when to generate a modulemap. It’s mimicked from SPM, but we might have missed something
  • content of the generated modulemap

Let me know if you need more info about it 🚀

Updated with exact errors