NativeScript / ios-jsc

NativeScript for iOS using JavaScriptCore

Home Page:http://docs.nativescript.org/runtimes/ios

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

metadata not generated via Xcode due to LD -> nsld.sh override not working

chris-praxis opened this issue · comments

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: 6.0.3
  • Cross-platform modules: ???
  • Core modules: 6.0.7
  • Android Runtime: 6.0.2
  • iOS Runtime: 6.0.2
  • Plugin(s): N/A
  • macOS Mojave (10.14.5)
  • Xcode 10.2.1

Describe the bug
I added an Objective C class in "app/App_Resources/iOS/src" with a modulemap and I was able to instantiate it and call methods on it from a Vue component. But when I added methods, they did not show up in JS. I realized that the metadata in ""platforms/ios/Build/Debug-iphoneos" was not being updated, and no matter what I've tried I cannot get it to updated after the initial build for the app. Removing and re-adding the iOS platform does not help and results in missing metadata: ld: can't open -sectcreate file "metadata-arm64.bin" .

I found the documentation regarding "nsld.h" here "https://docs.nativescript.org/troubleshooting" and I determined that it is never being run. That is, the linker setting which assigns LD to this script does not work. Possibly an Xcode change?

To Reproduce

  1. Create new project.
    $ tns create bug7762 --vue
  2. Copy native (Objective C) files into it with modulemap.
  3. Try to run.
    $ tns run ios
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    ld: can't open -sectcreate file: [working path]/bug7762/platforms/ios/build/Debug-iphoneos/metadata-armv7.bin
  4. Try to build.
    $ tns build ios
    ld: can't open -sectcreate file: [working path]/bug7762/platforms/ios/build/Debug-iphonesimulator/metadata-x86_64.bin
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    [Notice that this did a simulator build, but the result is the same.]
  5. If for some reason the metadata files are generated, then...
    $ tns platform remove ios
    $ tns platform add ios
    $ tns run ios

So the metadata files are generally not being generated, and if they are, then they are not updated on subsequent builds after code has been changed.

Expected behavior
Metadata should be kept up-to-date with source as part of the build process.

Sample project
See attachment.

Additional context
My guess is that an Xcode/clang update broke the linker override (LD -> nsld.sh).

bug7762.zip

My workaround was to make a new script that is nsld.sh without the linking part and append it to the pre-build step. According to the docs this will not work correctly for Swift, but I'm using Objective C.
tools.zip

I have confirmed that fix #1204 works for me.