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

Metadata found but symbol not available at runtime #1061

Closed
jibon57 opened this issue Jan 17, 2019 · 22 comments
Closed

Metadata found but symbol not available at runtime #1061

jibon57 opened this issue Jan 17, 2019 · 22 comments

Comments

@jibon57
Copy link

jibon57 commented Jan 17, 2019

Environment
Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):

  • CLI: 5.1.0
  • Cross-platform modules: 5.1.2
  • iOS Runtime: 5.1.0

Describe the bug

I am trying to implement a custom plugin for NativeScript using libsodium (https://github.com/jedisct1/libsodium). I have downloaded source files & complied to generate libsodium.a & header files. After that I put in my plugin following "https://docs.nativescript.org/plugins/plugin-reference". It's generating typescript definition correctly but when I am trying to use in demo app like this:

console.dir(crypto_aead_aes256gcm_abytes())

But getting errors like this:

 file:///app/main-view-model.js:8:49: JS ERROR ReferenceError: Metadata for "sodium.crypto_aead_aes256gcm_abytes" found but symbol not available at runtime.
    (CoreFoundation) *** Terminating app due to uncaught exception 'NativeScript encountered a fatal error: ReferenceError: Metadata for "sodium.crypto_aead_aes256gcm_abytes" found but symbol not available at runtime.

Architectures:

lipo -info sodium.a    
Architectures in the fat file: sodium.a are: i386 armv7 armv7s x86_64 arm64

In where I am doing mistake? Please give me suggestions.

To Reproduce
Download latest release from here: https://github.com/jedisct1/libsodium/releases or clone the git repo. It has supplied a building script under dist-build named ios.sh to build static library for iOS.

@mbektchiev
Copy link
Contributor

mbektchiev commented Jan 18, 2019

The reason that these functions are missing at runtime is that the linker by default strips any unused C++ symbols. Since you call the functions from JS, the compiler and linker cannot detect that they are actually needed and remove them from the final executable. We've planned to add support for specifying an exported symbols file in NativeScript plugins, but currently, there isn't such out of the box. You may try to add an EXPORTED_SYMBOLS_FILE setting in your {N} project's build.xcconfig and list there all symbols that you need to be able to call. To retrieve a list of the mangled names of all symbols defined in the library you can use: nm --defined-only libsodium.a.

** UPDATE ** You will most probably need to specify STRIPFLAGS=$(inherited) -s <exported-symbols-file> along with EXPORTED_SYMBOLS_FILE=<exported-symbols-file>

@jibon57
Copy link
Author

jibon57 commented Jan 18, 2019

Thanks for response. I tried to follow your instructions like this:

nm --defined-only sodium.a > sodium_defined

then included that files inside build.xcconfig like this:

STRIPFLAGS=$(inherited) -s ${PROJECT_DIR}/../../node_modules/nativescript-simple-libsodium/platforms/ios/sodium_defined
EXPORTED_SYMBOLS_FILE = ${PROJECT_DIR}/../../node_modules/nativescript-simple-libsodium/platforms/ios/sodium_defined

Now I am getting long erros:

ld: warning: Auto-Linking framework not found CoreServices
Undefined symbols for architecture x86_64:
  "0000000000000000 T _crypto_pwhash_alg_argon2i13", referenced from:
     -exported_symbol[s_list] command line option
  "0000000000000010 T _crypto_secretbox_noncebytes", referenced from:
     -exported_symbol[s_list] command line option
  "0000000000000000 T _crypto_aead_chacha20poly1305_encrypt_detached", referenced from:
     -exported_symbol[s_list] command line option
  "00000000000001e0 T _crypto_secretbox_open_detached", referenced from:
     -exported_symbol[s_list] command line option
  "0000000000000140 T _crypto_box_seal_open", referenced from:
     -exported_symbol[s_list] command line option
  "00000000000007d0 T _crypto_aead_chacha20poly1305_ietf_messagebytes_max", referenced from:
     -exported_symbol[s_list] command line option
  "0000000000000240 T _fe25519_invert", referenced from:
     -exported_symbol[s_list] command line option
  "00000000000009e0 T _initialize", referenced from:
     -exported_symbol[s_list] command line option
  "0000000000000470 T _encode_string", referenced from:
     -exported_symbol[s_list] command line option
  "00000000000000a0 T _crypto_pwhash_argon2id_memlimit_min", referenced from:
     -exported_symbol[s_list] command line option
  "00000000000007f0 T _crypto_aead_chacha20poly1305_keybytes", referenced from:
     -exported_symbol[s_list] command line option
  "0000000000000830 T _crypto_aead_chacha20poly1305_messagebytes_max", referenced from:
     -exported_symbol[s_list] command line option
  "0000000000000030 t _randombytes_sysrandom_stir", referenced from:
     -exported_symbol[s_list] command line option
  "0000000000000070 T _crypto_kx_client_session_keys", referenced from:
     -exported_symbol[s_list] command line option
  "0000000000000010 T _crypto_auth_keybytes", referenced from:
     -exported_symbol[s_list] command line option
  "0000000000000c0c b _global.3", referenced from:
     -exported_symbol[s_list] command line option
  "0000000000000010 t _randombytes_salsa20_random", referenced from:
     -exported_symbol[s_list] command line option
  "00000000000013d0 T _crypto_hash_sha256_final", referenced from:
     -exported_symbol[s_list] command line option
  "0000000000000000 T __crypto_sign_ed25519_verify_detached", referenced from:
     -exported_symbol[s_list] command line option
  "0000000000049010 s _curve25519_A", referenced from:
.....

Am I missing anything?

sodium_defined.txt

@mbektchiev
Copy link
Contributor

The exported symbols file should comprise of just a symbol name on each line. If you want to create it automatically from all symbols, you'll have to extract only the symbol names (3-rd column). E.g. nm --defined-only libsodium.a | cut -f 3 -d' ' | egrep -v '^$|libsodium\.a'

@jibon57
Copy link
Author

jibon57 commented Jan 18, 2019

Thanks for quick response. I just tried your solution but I am getting long errors again. Please check the log.txt file.

sodium_defined.txt
log.txt

@mbektchiev
Copy link
Contributor

mbektchiev commented Jan 18, 2019

It seems that more filtering will be needed. From man nm:

Each symbol name is preceded by its value (blanks if undefined).  Unless the -m option is specified, this value 
is followed by one of the following characters, representing the symbol type:  
U (undefined),  
A (absolute),  
T (text section symbol), 
D (data section symbol), 
B (bss section symbol), 
C (common symbol), 
- (for debugger symbol table entries; see -a below), 
S (symbol in a section other than those above), or 
I (indirect symbol).  

If the symbol is local (non-external), the symbol's type is instead represented by the corresponding lowercase letter.  
A lower case u in a  dynamic shared library indicates an undefined reference to a private external in another module 
in the same library.

I suggest that you try to only get the public symbols from the TEXT section of the binary: nm --defined-only libsodium.a | grep " T " | cut -f 3 -d' ' | egrep -v '^$|libsodium\.a'

@jibon57
Copy link
Author

jibon57 commented Jan 18, 2019

Thanks but still getting errors:

ld: warning: cannot export hidden symbol __crypto_generichash_blake2b_pick_best_implementation from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libsodium_la-generichash_blake2b.o)
ld: warning: cannot export hidden symbol __crypto_onetimeauth_poly1305_pick_best_implementation from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libsodium_la-onetimeauth_poly1305.o)
ld: warning: cannot export hidden symbol _free_instance from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libsodium_la-argon2-core.o)
ld: warning: cannot export hidden symbol _finalize from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libsodium_la-argon2-core.o)
ld: warning: cannot export hidden symbol _fill_memory_blocks from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libsodium_la-argon2-core.o)
ld: warning: cannot export hidden symbol _validate_inputs from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libsodium_la-argon2-core.o)
ld: warning: cannot export hidden symbol _fill_first_blocks from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libsodium_la-argon2-core.o)
ld: warning: cannot export hidden symbol _initial_hash from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libsodium_la-argon2-core.o)
ld: warning: cannot export hidden symbol _initialize from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libsodium_la-argon2-core.o)
ld: warning: cannot export hidden symbol _argon2_pick_best_implementation from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libsodium_la-argon2-core.o)
ld: warning: cannot export hidden symbol __crypto_pwhash_argon2_pick_best_implementation from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libsodium_la-argon2-core.o)
ld: warning: cannot export hidden symbol __crypto_scalarmult_curve25519_pick_best_implementation from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libsodium_la-scalarmult_curve25519.o)
ld: warning: cannot export hidden symbol __crypto_sign_ed25519_ref10_hinit from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libsodium_la-sign.o)
ld: warning: cannot export hidden symbol __crypto_sign_ed25519_detached from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libsodium_la-sign.o)
ld: warning: cannot export hidden symbol __crypto_sign_ed25519_verify_detached from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libsodium_la-open.o)
ld: warning: cannot export hidden symbol _crypto_stream_chacha20_ietf_ext from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libsodium_la-stream_chacha20.o)
ld: warning: cannot export hidden symbol _crypto_stream_chacha20_ietf_ext_xor_ic from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libsodium_la-stream_chacha20.o)
ld: warning: cannot export hidden symbol __crypto_stream_chacha20_pick_best_implementation from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libsodium_la-stream_chacha20.o)
ld: warning: cannot export hidden symbol __crypto_stream_salsa20_pick_best_implementation from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libsodium_la-stream_salsa20.o)
ld: warning: cannot export hidden symbol __sodium_dummy_symbol_to_prevent_memzero_lto from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libsodium_la-utils.o)
ld: warning: cannot export hidden symbol __sodium_dummy_symbol_to_prevent_memcmp_lto from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libsodium_la-utils.o)
ld: warning: cannot export hidden symbol __sodium_dummy_symbol_to_prevent_compare_lto from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libsodium_la-utils.o)
ld: warning: cannot export hidden symbol __sodium_alloc_init from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libsodium_la-utils.o)
ld: warning: cannot export hidden symbol __sodium_runtime_get_cpu_features from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libsodium_la-runtime.o)
ld: warning: cannot export hidden symbol _argon2_ctx from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libsodium_la-argon2.o)
ld: warning: cannot export hidden symbol _argon2_hash from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libsodium_la-argon2.o)
ld: warning: cannot export hidden symbol _argon2i_hash_encoded from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libsodium_la-argon2.o)
ld: warning: cannot export hidden symbol _argon2i_hash_raw from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libsodium_la-argon2.o)
ld: warning: cannot export hidden symbol _argon2id_hash_encoded from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libsodium_la-argon2.o)
ld: warning: cannot export hidden symbol _argon2id_hash_raw from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libsodium_la-argon2.o)
ld: warning: cannot export hidden symbol _argon2_verify from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libsodium_la-argon2.o)
ld: warning: cannot export hidden symbol _argon2i_verify from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libsodium_la-argon2.o)
ld: warning: cannot export hidden symbol _argon2id_verify from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libsodium_la-argon2.o)
ld: warning: cannot export hidden symbol _blake2b_compress_avx2 from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libavx2_la-blake2b-compress-avx2.o)
ld: warning: cannot export hidden symbol _blake2b_compress_ref from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libsodium_la-blake2b-compress-ref.o)
ld: warning: cannot export hidden symbol _blake2b_compress_sse41 from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libsse41_la-blake2b-compress-sse41.o)
ld: warning: cannot export hidden symbol _blake2b_compress_ssse3 from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libssse3_la-blake2b-compress-ssse3.o)
ld: warning: cannot export hidden symbol _blake2b_long from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libsodium_la-blake2b-long.o)
ld: warning: cannot export hidden symbol _crypto_generichash_blake2b__init_param from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libsodium_la-blake2b-ref.o)
ld: warning: cannot export hidden symbol _crypto_generichash_blake2b__init from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libsodium_la-blake2b-ref.o)
ld: warning: cannot export hidden symbol _crypto_generichash_blake2b__init_salt_personal from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libsodium_la-blake2b-ref.o)
ld: warning: cannot export hidden symbol _crypto_generichash_blake2b__init_key from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libsodium_la-blake2b-ref.o)
ld: warning: cannot export hidden symbol _crypto_generichash_blake2b__update from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libsodium_la-blake2b-ref.o)
ld: warning: cannot export hidden symbol _crypto_generichash_blake2b__init_key_salt_personal from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libsodium_la-blake2b-ref.o)
ld: warning: cannot export hidden symbol _crypto_generichash_blake2b__final from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libsodium_la-blake2b-ref.o)
ld: warning: cannot export hidden symbol _crypto_generichash_blake2b__blake2b from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libsodium_la-blake2b-ref.o)
ld: warning: cannot export hidden symbol _crypto_generichash_blake2b__blake2b_salt_personal from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libsodium_la-blake2b-ref.o)
ld: warning: cannot export hidden symbol _crypto_generichash_blake2b__pick_best_implementation from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libsodium_la-blake2b-ref.o)
ld: warning: cannot export hidden symbol _decode_string from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libsodium_la-argon2-encoding.o)
ld: warning: cannot export hidden symbol _encode_string from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libsodium_la-argon2-encoding.o)
ld: warning: cannot export hidden symbol _fe25519_frombytes from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libsodium_la-ed25519_ref10.o)
ld: warning: cannot export hidden symbol _fe25519_tobytes from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libsodium_la-ed25519_ref10.o)
ld: warning: cannot export hidden symbol _fe25519_invert from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libsodium_la-ed25519_ref10.o)
ld: warning: cannot export hidden symbol _ge25519_add from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libsodium_la-ed25519_ref10.o)
ld: warning: cannot export hidden symbol _ge25519_frombytes from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libsodium_la-ed25519_ref10.o)
ld: warning: cannot export hidden symbol _ge25519_frombytes_negate_vartime from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libsodium_la-ed25519_ref10.o)
ld: warning: cannot export hidden symbol _ge25519_p1p1_to_p2 from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libsodium_la-ed25519_ref10.o)
ld: warning: cannot export hidden symbol _ge25519_p1p1_to_p3 from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libsodium_la-ed25519_ref10.o)
ld: warning: cannot export hidden symbol _ge25519_p3_to_cached from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libsodium_la-ed25519_ref10.o)
ld: warning: cannot export hidden symbol _ge25519_p3_tobytes from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libsodium_la-ed25519_ref10.o)
ld: warning: cannot export hidden symbol _ge25519_sub from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libsodium_la-ed25519_ref10.o)
ld: warning: cannot export hidden symbol _ge25519_tobytes from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libsodium_la-ed25519_ref10.o)
ld: warning: cannot export hidden symbol _ge25519_double_scalarmult_vartime from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libsodium_la-ed25519_ref10.o)
ld: warning: cannot export hidden symbol _ge25519_scalarmult from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libsodium_la-ed25519_ref10.o)
ld: warning: cannot export hidden symbol _ge25519_scalarmult_base from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libsodium_la-ed25519_ref10.o)
ld: warning: cannot export hidden symbol _ge25519_is_on_curve from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libsodium_la-ed25519_ref10.o)
ld: warning: cannot export hidden symbol _ge25519_is_on_main_subgroup from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libsodium_la-ed25519_ref10.o)
ld: warning: cannot export hidden symbol _ge25519_is_canonical from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libsodium_la-ed25519_ref10.o)
ld: warning: cannot export hidden symbol _ge25519_has_small_order from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libsodium_la-ed25519_ref10.o)
ld: warning: cannot export hidden symbol _sc25519_muladd from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libsodium_la-ed25519_ref10.o)
ld: warning: cannot export hidden symbol _sc25519_invert from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libsodium_la-ed25519_ref10.o)
ld: warning: cannot export hidden symbol _sc25519_reduce from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libsodium_la-ed25519_ref10.o)
ld: warning: cannot export hidden symbol _sc25519_is_canonical from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libsodium_la-ed25519_ref10.o)
ld: warning: cannot export hidden symbol _ge25519_from_uniform from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libsodium_la-ed25519_ref10.o)
ld: warning: cannot export hidden symbol _fill_segment_avx2 from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libavx2_la-argon2-fill-block-avx2.o)
ld: warning: cannot export hidden symbol _fill_segment_avx512f from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libavx512f_la-argon2-fill-block-avx512f.o)
ld: warning: cannot export hidden symbol _fill_segment_ref from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libsodium_la-argon2-fill-block-ref.o)
ld: warning: cannot export hidden symbol _fill_segment_ssse3 from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libssse3_la-argon2-fill-block-ssse3.o)
ld: warning: cannot export hidden symbol _sodium_crit_enter from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libsodium_la-core.o)
ld: warning: cannot export hidden symbol _sodium_crit_leave from /Users/jibon/Desktop/test/nativescript-simple-libsodium/demo/node_modules/nativescript-simple-libsodium/platforms/ios/sodium.a(libsodium_la-core.o)
Undefined symbols for architecture i386:
  "_stream_salsa20_xmm6", referenced from:
     -exported_symbol[s_list] command line option
     (maybe you meant: _crypto_stream_salsa20_xmm6int_sse2_implementation, _crypto_stream_salsa20_xmm6int_avx2_implementation )
  "_crypto_scalarmult_curve25519_sandy2x_fe_frombytes", referenced from:
     -exported_symbol[s_list] command line option
  "_crypto_scalarmult_curve25519_sandy2x_ladder", referenced from:
     -exported_symbol[s_list] command line option
  "stream_salsa20_xmm6_xor_ic", referenced from:
     -exported_symbol[s_list] command line option
  "crypto_scalarmult_curve25519_sandy2x_fe51_mul", referenced from:
     -exported_symbol[s_list] command line option
  "stream_salsa20_xmm6", referenced from:
     -exported_symbol[s_list] command line option
     (maybe you meant: _crypto_stream_salsa20_xmm6int_sse2_implementation, _crypto_stream_salsa20_xmm6int_avx2_implementation )
  "_crypto_scalarmult_curve25519_sandy2x_ladder_base", referenced from:
     -exported_symbol[s_list] command line option
  "crypto_scalarmult_curve25519_sandy2x_fe51_pack", referenced from:
     -exported_symbol[s_list] command line option
  "_stream_salsa20_xmm6_xor_ic", referenced from:
     -exported_symbol[s_list] command line option
  "_crypto_scalarmult_curve25519_sandy2x_fe51_mul", referenced from:
     -exported_symbol[s_list] command line option
  "crypto_scalarmult_curve25519_sandy2x_fe51_nsquare", referenced from:
     -exported_symbol[s_list] command line option
  "_crypto_scalarmult_curve25519_sandy2x_fe51_pack", referenced from:
     -exported_symbol[s_list] command line option
  "crypto_scalarmult_curve25519_sandy2x_ladder_base", referenced from:
     -exported_symbol[s_list] command line option
  "_crypto_scalarmult_curve25519_sandy2x_fe51_nsquare", referenced from:
     -exported_symbol[s_list] command line option
  "_crypto_scalarmult_curve25519_sandy2x_fe51_invert", referenced from:
     -exported_symbol[s_list] command line option
  "crypto_scalarmult_curve25519_sandy2x_ladder", referenced from:
     -exported_symbol[s_list] command line option
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
** BUILD FAILED **

@mbektchiev
Copy link
Contributor

Well, it seems that this isn't going to lead us anywhere... I would suggest that initially you find and add only the functions that you know you will call from JavaScript. You can find their mangled names in the list and include only them in the file with exported symbols. The linker will automatically leave any other symbols that may be needed by them.

@jibon57
Copy link
Author

jibon57 commented Jan 18, 2019

Thanks @mbektchiev . I am doing so now. This is solving my problem temporary :) because I don't need all functions.

@mbektchiev
Copy link
Contributor

If you really want to keep everything you may continue with the other approach by manually removing all symbols which are reported as unavailable or hidden by the linker. It might work out in the end.

@jibon57
Copy link
Author

jibon57 commented Jan 18, 2019

@mbektchiev This methods are working after removing error methods. Have ~477 methods to work with ;). If you want then can close this issue as it's solve my problem or can keep open for future reference. Thank you so much :) :)

sodium_defined.txt

@mbektchiev
Copy link
Contributor

mbektchiev commented Feb 8, 2019

@jibon57 I'm glad you managed to make it work! Closing this issue as after the implementation of NativeScript/nativescript-cli#4157, plugins will be able to define their own lists of exported symbols and the workaround to manually specify the options and lists in applications will no longer be required.

@henrychavez
Copy link

Hey guys, my plugin nativescript-bottom-navigation stop working in NS6.

I'm getting this error
ERROR ReferenceError: Metadata for "MaterialComponents.MDCBottomNavigationBar" found but symbol not available at runtime.

any ideas?

@mbektchiev
Copy link
Contributor

Hey @henrychavez, thank you for the heads up. We'll investigate what is causing the issue and update you when we have more information.

@henrychavez
Copy link

Thanks @mbektchiev
the weirdest thing is that other components from the library material-components-ios works without problems

@mbektchiev
Copy link
Contributor

mbektchiev commented Jul 26, 2019

I have a clue now, but still looking for a solution. It turns out that the issue is caused by both tns-core-modules and nativescript-bottom-navigation using the MaterialComponents CocoaPod. Obviously, there are some differences in both versions used and that's what causes some symbols to be missing. I'll continue investigating and write back with more details later.

Even Xcode complains about this, but I initially ignored these warnings:

Xcode build...
warning: ignoring duplicated output file: '/Users/bektchiev/work/_scratch/test/platforms/ios/build/Debug-iphonesimulator/test.app/Frameworks/MDFInternationalization.framework' in shell script build phase '[CP] Embed Pods Frameworks'. This warning represents an extremely serious project misconfiguration and will likely cause some shell scripts in your project to be skipped entirely, leading to other build failures or missing files in the build directory. This will be a hard error in the future. (in target 'test')
warning: ignoring duplicated output file: '/Users/bektchiev/work/_scratch/test/platforms/ios/build/Debug-iphonesimulator/test.app/Frameworks/MaterialComponents.framework' in shell script build phase '[CP] Embed Pods Frameworks'. This warning represents an extremely serious project misconfiguration and will likely cause some shell scripts in your project to be skipped entirely, leading to other build failures or missing files in the build directory. This will be a hard error in the future. (in target 'test')

@mbektchiev
Copy link
Contributor

@henrychavez We will release a new version of tns-core-modules (probably early next week, today we intend to release v6.0.2 which won't contain the fix).

It will ship with a Podfile instead of the pre-built .framework bundles.

The reason that we had included the binaries in the first place was to optimize build times, but it turns out that we've missed the fact that this approach can lead to incompatibilities similar to the one with nativescript-bottom-navigation.

I'm sorry for the inconvenience this has caused so far.

@henrychavez
Copy link

Thanks @mbektchiev,

My plugin will be part of the official Nativescript-material-components and I was a little worried that the implementation for iOS was broken 😅

Thanks again for your help,
Happy coding 😁

@sidthesloth
Copy link

sidthesloth commented Jul 30, 2019

Hi @henrychavez,

I'm getting the error too so question is should we still use the official Nativescript-material-components of which nativescript-bottom-navigation is a part?

@henrychavez
Copy link

Hi @sidthesloth,

the plugin isn't merged yet, I'm waiting the issue to be fixed before releasing the plugin inside the nativescript-material-components mono repo

@erkanarslan
Copy link

@mbektchiev I have the same problem related to nativescript-bottom-navigation. We need a fix for this.

@mbektchiev
Copy link
Contributor

Can you please state exactly what is your problem? The causes for Metadata found but symbol not available at runtime can be very different, so you'd better explain the situation with more details so that we can understand how it can be fixed.

@erkanarslan
Copy link

Upgrading tns-core-modules from 6.1.1 to 6.1.2 solved the problem.

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

5 participants