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

Build fails with local includes using <> and not quotes #1113

Open
bradmartin opened this issue Mar 28, 2019 · 4 comments
Open

Build fails with local includes using <> and not quotes #1113

bradmartin opened this issue Mar 28, 2019 · 4 comments

Comments

@bradmartin
Copy link

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.3.0
  • Cross-platform modules: 5.3.1
  • iOS Runtime: 5.3.0
  • Plugin(s): @teammaestro/nativescript-svg

Describe the bug
Build fails when this plugin is added (assuming cocoapod SVGKit is doing something in platforms for itself causing the issue).

To Reproduce
Not produceable on every machine, some other users I've talked with don't have the issue and some do have the issue.

Expected behavior

Successful build

Sample project
https://github.com/bradmartin/xcode-bad-build (master has the <> in main.m causing failed build)
https://github.com/bradmartin/xcode-bad-build/tree/fix-build (has the main.m modified using "" for local includes to fix the build)

Additional context
Teodor Dermendzhiev - replied on NS Slack asking for some extra info. So internally he's at least somewhat aware of this happening on my machine.

This SO post https://stackoverflow.com/questions/1044360/import-using-angle-brackets-and-quote-marks/1044399#1044399 provides some context on using <> and "" quotes for includes.

Output from failed build:

Brads-MBP:demo bradmartin$ tns build ios
Copying template files...
Platform ios successfully added. v5.3.0
Preparing project...
Successfully prepared plugin @teammaestro/nativescript-svg for ios.
Successfully prepared plugin tns-core-modules for ios.
Successfully prepared plugin tns-core-modules-widgets for ios.
Installing pods...
Analyzing dependencies
Pre-downloading: `SVGKit` from `https://github.com/SVGKit/SVGKit.git`, branch `2.x`
Downloading dependencies
Installing CocoaLumberjack (3.4.2)
Installing SVGKit (2.1.0)
Generating Pods project
Integrating client project

[!] Please close any current Xcode sessions and use `demo.xcworkspace` for this project from now on.
Sending stats
Pod installation complete! There is 1 dependency from the Podfile and 2 total pods installed.

[!] Automatically assigning platform `ios` with version `9.0` on target `demo` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.
Project successfully prepared (ios)
Building project...
Xcode build...
/Users/bradmartin/Desktop/nativescript-svg/demo/platforms/ios/internal/main.m:8:10: error:
      'TNSExceptionHandler.h' file not found with <angled> include; use "quotes" instead
#include <TNSExceptionHandler.h>
         ^~~~~~~~~~~~~~~~~~~~~~~
         "TNSExceptionHandler.h"
/Users/bradmartin/Desktop/nativescript-svg/demo/platforms/ios/internal/main.m:11:10: error:
      'TNSDebugging.h' file not found with <angled> include; use "quotes" instead
#include <TNSDebugging.h>
         ^~~~~~~~~~~~~~~~
         "TNSDebugging.h"
/Users/bradmartin/Desktop/nativescript-svg/demo/platforms/ios/internal/main.m:12:10: fatal error:
      'TKLiveSync.h' file not found
#include <TKLiveSync.h>
         ^~~~~~~~~~~~~~
3 errors generated.
error: the following command failed with exit code 1 but produced no further output
CompileC /Users/bradmartin/Library/Developer/Xcode/DerivedData/demo-agkbvoazyfqvuvdhxoolsrrthxzw/Build/Intermediates.noindex/demo.build/Debug-iphonesimulator/demo.build/Objects-normal/x86_64/main.o /Users/bradmartin/Desktop/nativescript-svg/demo/platforms/ios/internal/main.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
note: Using new build systemnote: Planning buildnote: Constructing build description
** BUILD FAILED **

Command xcodebuild failed with exit code 65

This only happens when the plugin is added. I've currently got a fork of the plugin https://github.com/bradmartin/nativescript-svg that I'm going to PR to the @teammaestro version to get that in master. However, that's not the issue as this seems to happen regardless which fork I'm using. I discovered it working on a private project, and have repro'd it on 3 projects, with xcode 10.1 and 10.2. Also with NS 5.2.x and 5.3.x

@bradmartin
Copy link
Author

In the meantime, I've documented the fix which is to change the platforms/ios/internal/main.m includes to the following:


#include <Foundation/Foundation.h>
#include <JavaScriptCore/JavaScriptCore.h>
#include <NativeScript/NativeScript.h>
#include "TNSExceptionHandler.h"

#if DEBUG
#include "TNSDebugging.h"
#include "./TKLiveSync/include/TKLiveSync.h"
#endif

Only changing the NS includes there for TNS and livesync to use "" as the xcode build error indicates. Then I'm able to run the projects just fine and the SVGKit plugin works 💯

@bradmartin
Copy link
Author

As of now, I'm on xcode 10.2 and latest MacOS update 10.14.4

@bradmartin
Copy link
Author

Informed @tdermendjiev of findings. I was running cocoapods 1.6.0-beta.1. After updating to 1.6.1 the problem went away. So this should be repro'd by using that version of Cocoapods, but it's a beta so likely just a bug with the SVGKit and cocoapods. Since it's not happening on the 1.6.1 release of cocoapods.

@tdermendjiev
Copy link
Contributor

I will install the same cocoapods version so I am able to reproduce the issue. Right now I can only speculate that it generates a xcworkspace with the wrong settings (probably Header search paths). What I know about the angle-bracketed includes is they should be used for adding system headers while the quotes - for local headers. That said, it seems a good idea to update them.

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