software-mansion / react-native-svg

SVG library for React Native, React Native Web, and plain React web projects.
MIT License
7.5k stars 1.13k forks source link

iOS Build Started Failing with 9.5.0 #1025

Closed eahrold closed 5 years ago

eahrold commented 5 years ago

Bug

iOS Build Started Failing with 9.5.0 (9.4.0 works fine)

▸ Compiling RNSVGImage.m

❌  /../node_modules/react-native-svg/ios/Elements/RNSVGImage.m:13:9: 'React/RCTGIFImageDecoder.h' file not found

#import <React/RCTGIFImageDecoder.h>
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

Environment info

React native info output:

  React Native Environment Info:
    System:
      OS: macOS High Sierra 10.13.6
      CPU: (8) x64 Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz
      Memory: 1.24 GB / 16.00 GB
      Shell: 3.2.57 - /bin/bash
    Binaries:
      Node: 10.15.3 - /usr/local/bin/node
      Yarn: 1.12.3 - /usr/local/bin/yarn
      npm: 6.9.0 - /usr/local/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
      Android SDK:
        API Levels: 21, 23, 24, 25, 26, 27, 28
        Build Tools: 23.0.1, 24.0.1, 25.0.0, 25.0.1, 25.0.2, 25.0.3, 26.0.0, 26.0.1, 26.0.2, 28.0.3
        System Images: a...gle_apis | Google APIs Intel x86 Atom_64 ..., a... | Intel x86 Atom_64, a...pis | Google APIs ARM EABI v7a Syste..., a...gle_apis | Google APIs Intel x86 Atom_64 ..., a...s_playstore | Google Play Intel x86 Atom Sys...
    IDEs:
      Android Studio: 3.3 AI-182.5107.16.33.5314842
      Xcode: 10.1/10B61 - /usr/bin/xcodebuild
    npmPackages:
      react: 16.8.3 => 16.8.3 
      react-native: 0.59.3 => 0.59.3 
    npmGlobalPackages:
      react-native-cli: 2.0.1

Library version: 9.5.0

Steps To Reproduce

Describe what you expected to happen:

  1. iOS Build should succeed

Full Output of react-native run-ios

> react-native run-ios

info Found Xcode workspace MyProject.xcworkspace
info Building using "xcodebuild -workspace MyProject.xcworkspace -configuration Debug -scheme OpesOne -destination id=A5621FA4-D684-480B-830A-5F59BEA4663F -derivedDataPath build/<MyProject"
    The iOS Simulator deployment target is set to 7.0, but the range of supported deployment target versions for this platform is 8.0 to 12.1. (in target 'TouchID')
    Not running swift-stdlib-tool: ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES is enabled, but the product type 'com.apple.product-type.library.static' is not a wrapper type. (in target 'RNReactNativeZoomSdk')
▸ Running script 'Start Packager'
▸ Running script 'Include RCTJSCProfiler'
▸ Running script 'Run Script'
▸ Compiling ReactNativeConfig.m
▸ Building library libReactNativeConfig.a
▸ Compiling RNSVGBezierElement.m
▸ Compiling RNSVGTextProperties.m
▸ Compiling RNSVGCircle.m
▸ Compiling RNSVGBrush.m
▸ Compiling RCTConvert+RNSVG.m
▸ Compiling RNSVGClipPathManager.m
▸ Compiling RNSVGDefs.m
▸ Compiling RNSVGDefsManager.m
▸ Compiling RNSVGClipPath.m
▸ Compiling RNSVGViewBox.m
▸ Compiling RNSVGUseManager.m
▸ Compiling RNSVGUse.m
▸ Compiling RNSVGTextPathManager.m
▸ Compiling RNSVGTextPath.m
▸ Compiling RNSVGTextManager.m
▸ Compiling RNSVGText.m
▸ Compiling RNSVGTSpanManager.m
▸ Compiling RNSVGTSpan.m
▸ Compiling RNSVGSymbolManager.m
▸ Compiling RNSVGSymbol.m
▸ Compiling RNSVGSvgViewManager.m
▸ Compiling RNSVGSvgView.m
▸ Compiling RNSVGSolidColorBrush.m
▸ Compiling RNSVGRenderableManager.m
▸ Compiling RNSVGRenderable.m
▸ Compiling RNSVGRectManager.m
▸ Compiling RNSVGRect.m
▸ Compiling RNSVGRadialGradientManager.m
▸ Compiling RNSVGRadialGradient.m
▸ Compiling RNSVGPropHelper.m
▸ Compiling RNSVGPercentageConverter.m
▸ Compiling RNSVGPatternManager.m
▸ Compiling RNSVGPattern.m
▸ Compiling RNSVGPathParser.m
▸ Compiling RNSVGPathManager.m
▸ Compiling RNSVGPath.m
▸ Compiling RNSVGPainterBrush.m
▸ Compiling RNSVGPainter.m
▸ Compiling RNSVGNodeManager.m
▸ Compiling RNSVGNode.m
▸ Compiling RNSVGMaskManager.m
▸ Compiling RNSVGMask.m
▸ Compiling RNSVGLinearGradientManager.m
▸ Compiling RNSVGLinearGradient.m
▸ Compiling RNSVGLineManager.m
▸ Compiling RNSVGLine.m
▸ Compiling RNSVGLength.m
▸ Compiling RNSVGImageManager.m
▸ Compiling RNSVGImage.m

❌  /.../node_modules/react-native-svg/ios/Elements/RNSVGImage.m:13:9: 'React/RCTGIFImageDecoder.h' file not found

#import <React/RCTGIFImageDecoder.h>
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

▸ Compiling RNSVGGroupManager.m
▸ Compiling RNSVGGroup.m
▸ Compiling RNSVGGlyphContext.m
▸ Compiling RNSVGFontData.m
▸ Compiling RNSVGEllipseManager.m
▸ Compiling RNSVGEllipse.m
error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65. To debug build logs further, consider building your app with Xcode.app, by opening MyProject.xcworkspace
SmirnovM91 commented 5 years ago

+1

msand commented 5 years ago

Hmm, interesting, I'm unable to replicate this. Can you try relinking or if you're using cocoapods, run pod install?

SmirnovM91 commented 5 years ago

Tried 3 times, nothing changes

msand commented 5 years ago

Could you try upgrading react-native? Are you able to reproduce this in a clean project?

SmirnovM91 commented 5 years ago

I use react-native 0.59.9, tried everything, nothing works

eahrold commented 5 years ago

I first detected this issue w/ AppCenter builds, so the builds were clean Here are a list of my dependancies. I did have to hold at RN 0.59.3, for other reasons, but maybe you can reproduce with these. It is really weird that it's not finding the header.

    "dependencies": {
        "@react-native-community/async-storage": "^1.2.2",
        "@react-native-community/netinfo": "^3.2.0",
        "axios": "^0.18.0",
        "base-64": "^0.1.0",
        "bcryptjs": "^2.4.3",
        "ecdsa-secp256r1": "^1.3.3",
        "eosjs": "^20.0.0",
        "history": "^4.9.0",
        "isaac": "0.0.5",
        "js-crypto-ec": "^0.5.0",
        "localstorage-polyfill": "^1.0.1",
        "lodash": "^4.17.11",
        "moment": "^2.24.0",
        "node-jose": "^1.1.3",
        "node-libs-react-native": "^1.0.3",
        "p-cancelable": "^2.0.0",
        "react": "16.8.3",
        "react-native": "0.59.3",
        "react-native-bcrypt": "^2.4.0",
        "react-native-bip39": "^2.3.0",
        "react-native-camera": "^2.1.1",
        "react-native-config": "^0.11.7",
        "react-native-device-info": "^1.5.0",
        "react-native-gesture-handler": "^1.1.0",
        "react-native-image-store": "^1.0.0",
        "react-native-keyboard-aware-scrollview": "^2.0.0",
        "react-native-keychain": "^3.1.1",
        "react-native-qrcode": "^0.2.7",
        "react-native-qrcode-scanner": "^1.1.2",
        "react-native-svg": "^9.5.0",
        "react-native-touch-id": "^4.4.1",
        "react-native-vector-icons": "^6.4.2",
        "react-native-webview": "^5.8.1",
        "react-navigation": "^3.5.1",
        "react-zlib-js": "^1.0.4",
        "seamless-immutable": "^7.1.4",
        "stream-browserify": "^2.0.2"
    },
    "devDependencies": {
        "@babel/core": "^7.4.0",
        "@babel/runtime": "^7.4.2",
        "@react-native-community/eslint-config": "0.0.3",
        "babel-jest": "^24.5.0",
        "babel-plugin-module-resolver": "^3.2.0",
        "eslint": "^5.15.3",
        "eslint-config-airbnb": "^17.1.0",
        "eslint-plugin-import": "^2.16.0",
        "eslint-plugin-jsx-a11y": "^6.2.1",
        "faker": "^4.1.0",
        "jest": "^24.5.0",
        "metro-react-native-babel-preset": "^0.53.1",
        "prettier": "1.17.1",
        "react-test-renderer": "16.8.3"
    },
SmirnovM91 commented 5 years ago

Got it! react-native link is not working as expected. just use pod and everything is working.

eahrold commented 5 years ago

@SmirnovM91 That's interesting. I'm not using CocoaPods to install this, so I'm wondering if the Header Search Paths for this lib got changed in the 9.5.0 branch.

msand commented 5 years ago

I'm testing with react-native 0.60, where cocoapods are the default, and works fine. Haven't tested with plain linking in pre v60.

eahrold commented 5 years ago

I noticed that RCTGIFImageDecoder.h is getting imported in RNSVGImage.m, but it doesn't look like it's used

Here's the diff between 9.4.0 and 9.5.0 https://github.com/react-native-community/react-native-svg/compare/9.4.0...9.5.0#diff-2cfcf6db21340daa07cc44b787f6ee23R13

Removing that import fixes this issue for me.

msand commented 5 years ago

That import come in a pr which did nothing except add that import, to fix some cocoapods issue: https://github.com/react-native-community/react-native-svg/pull/1002

eahrold commented 5 years ago

Ha .... stealing from Peter to pay Paul

msand commented 5 years ago

I can replicate the issue by not using cocoapods in the latest stable react-native. This seems like a tricky tradeoff. Should find some way to get it to find the header with normal linking. Seems to be something strange with the structure. @janicduplessis @shergin Could you or someone on the rn team please advise?

eahrold commented 5 years ago

That really strange, I don't see anywhere that RCTGIFImageDecoder is used in react-native-svg, can you point me to where I may find it being used. [Edited] I know it's Part of the RTCImage Lib.

msand commented 5 years ago

Seems like it's not included in the "Headers" and "Copy Headers" build phases of the React.xcodeproj, and thus they can't be imported unless they're added there. I wonder why it would even be needed, seems to me it shouldn't, but the PR got several stars very quickly so it seemed like a legit issue. A shame if it's strictly needed for cocoapods to work correctly, but won't work for non-cocoapods without patching/modifying React.xcodeproj.

Screen Shot 2019-06-09 at 19 30 35 Screen Shot 2019-06-09 at 19 30 39
msand commented 5 years ago

@eahrold I published v9.5.1 with that pr reverted.

eahrold commented 5 years ago

@msand Thanks. I can confirm it builds for me now.

jakecronin commented 5 years ago

@msand Thank you.

npm install react-native-svg
react-native run-ios

Works :)

phonganhhung9xtb commented 5 years ago

i faced error: Declaration of 'RCTImageLoaderCancellationBlock' must be imported from module 'React.RCTGIFImageDecoder' before it is required in RNSVGImage.m But i cant fix this. Can u help me?

BulletButcher88 commented 2 years ago

@jakecronin that worked for me too