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 - Workaround "EXPORTED_SYMBOLS_FILE" is not working #1212

Closed
manuelfrey opened this issue Oct 14, 2019 · 3 comments

Comments

@manuelfrey
Copy link

At the moment I have a problem which looks similar to #1061. But the described workaround is failing in my solution.

My scenario:
I would like to create a NativeScript Plugin. The Plugin should contain an objective C clas which wraps a c++ class. For testing purpose it is just a simple getnumber method ehich return a simple number an other method returns a string.
I am using NativeScript 6.1.2.

I tried the following:

1.) I built an 'fat' dynamic framework with XCode and an objective C clas, The check with lipo returns the following info:
Architectures in the fat file: test3 are: x86_64 i386 armv7 armv7s arm64

2.) I included it in my Nativescript plugin and started the demo app

declare const MyNative: any;

const native = new MyNative();
const res = native.getNumber();

3.) In My demo app I always got the error message:

"Metadata for 'test3.MyNatuve' found but symbol not available at runtime."

4.) I searched with google and found the issue '#1061' and tried to solve it in the same way

I called the following command
nm --defined-only test3 | grep " T " | cut -f 3 -d' ' | egrep -v '^$|test3' > test3_defined

The content looks like:

__ZN8MyNative10getCppTextEv
__ZN8MyNative16getCppStaticTextEv
__ZN8MyNative9getNumberEv

...and extendend the buildxconfig with the folloing lines:

STRIPFLAGS=$(inherited) -s ${PROJECT_DIR}/../../../src/platforms/ios/test3_defined
EXPORTED_SYMBOLS_FILE = ${PROJECT_DIR}/../../../src/platforms/ios/test3_defined

(The path must be correct, if I change it I got an error message withw rong path)

5.) I can rebuild and run the demo app without errors. But if I call the function I got the error again:
"Metadata for 'test3.MyNatuve' found but symbol not available at runtime."

I don't have any ideas any more to solve this problem or just to find further informations.

Thanks in advance for any hints or assistance.

@mbektchiev
Copy link
Contributor

Hi @manu-f, as far as I can see you are trying to directly access a C++ class (MyNative) from JavaScript. NativeScript's iOS bridge, however, supports only Objective-C. In order to call your native methods, you have to wrap them in Objective-C @interfaces. I hope this sheds light on the issue, if you need any other directions, feel free to ask.

@mbektchiev
Copy link
Contributor

I recommend examining the iOS runtime documentation: https://docs.nativescript.org/core-concepts/ios-runtime/Overview

@manuelfrey
Copy link
Author

Hi @mbektchiev, thanks a lot for your fast response and this hint. You're right. I made the mistake that I just put the c++ - header file in the objective-c umbrella header. After I made a real objective-c class and wrapped the c++ class it works. 👍
And thank you very much for your offer to response to further questions.
Perfect! :-)

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