Skip to content

Cannot build React Native 0.55.3 with Xcode 8 due to RCTLayout typedefs #18944

Closed

Description

@confiks

Environment

Environment:
  OS: macOS Sierra 10.12.6
  Node: 9.11.1
  Yarn: 1.5.1
  npm: 5.6.0
  Watchman: 4.7.0
  Xcode: Xcode 8.3.2 Build version 8E2002
  Android Studio: 3.0 AI-171.4443003

Packages: (wanted => installed)
  react: ^16.3.2 => 16.3.2
  react-native: ^0.55.3 => 0.55.3

Steps to Reproduce

Either build the project with xcode using yarn run react-native run-ios or build the project in Xcode.

Expected Behavior

A successful build.

Actual Behavior

The build fails on a few RCTLayout typedefs.

In file included from /[redacted]/node_modules/react-native/React/Views/RCTShadowView+Internal.m:8:
In file included from /[redacted]/node_modules/react-native/React/Views/RCTShadowView+Layout.h:10:
In file included from /[redacted]/node_modules/react-native/React/Views/RCTShadowView.h:11:
/[redacted]/node_modules/react-native/React/Views/RCTLayout.h:30:43: error: expected ';' after top level declarator
typedef struct CG_BOXABLE RCTLayoutMetrics RCTLayoutMetrics;
                                          ^
                                          ;
/[redacted]/node_modules/react-native/React/Views/RCTLayout.h:30:44: warning: declaration does not declare anything [-Wmissing-declarations]
typedef struct CG_BOXABLE RCTLayoutMetrics RCTLayoutMetrics;
                                           ^~~~~~~~~~~~~~~~
/[redacted]/node_modules/react-native/React/Views/RCTLayout.h:37:43: error: expected ';' after top level declarator
typedef struct CG_BOXABLE RCTLayoutContext RCTLayoutContext;
                                          ^
                                          ;
/[redacted]/node_modules/react-native/React/Views/RCTLayout.h:37:44: warning: declaration does not declare anything [-Wmissing-declarations]
typedef struct CG_BOXABLE RCTLayoutContext RCTLayoutContext;
                                           ^~~~~~~~~~~~~~~~
/[redacted]/node_modules/react-native/React/Views/RCTLayout.h:39:74: error: variable has incomplete type 'RCTLayoutMetrics' (aka 'struct CG_BOXABLE')
static inline BOOL RCTLayoutMetricsEqualToLayoutMetrics(RCTLayoutMetrics a, RCTLayoutMetrics b)
                                                                         ^
/[redacted]/node_modules/react-native/React/Views/RCTLayout.h:30:16: note: forward declaration of 'struct CG_BOXABLE'
typedef struct CG_BOXABLE RCTLayoutMetrics RCTLayoutMetrics;
               ^
/[redacted]/node_modules/react-native/React/Views/RCTLayout.h:39:94: error: variable has incomplete type 'RCTLayoutMetrics' (aka 'struct CG_BOXABLE')
static inline BOOL RCTLayoutMetricsEqualToLayoutMetrics(RCTLayoutMetrics a, RCTLayoutMetrics b)
                                                                                             ^
/[redacted]/node_modules/react-native/React/Views/RCTLayout.h:30:16: note: forward declaration of 'struct CG_BOXABLE'
typedef struct CG_BOXABLE RCTLayoutMetrics RCTLayoutMetrics;
               ^
/[redacted]/node_modules/react-native/React/Views/RCTLayout.h:39:74: warning: unused parameter 'a' [-Wunused-parameter]
static inline BOOL RCTLayoutMetricsEqualToLayoutMetrics(RCTLayoutMetrics a, RCTLayoutMetrics b)
                                                                         ^
/[redacted]/node_modules/react-native/React/Views/RCTLayout.h:39:94: warning: unused parameter 'b' [-Wunused-parameter]
static inline BOOL RCTLayoutMetricsEqualToLayoutMetrics(RCTLayoutMetrics a, RCTLayoutMetrics b)

                                                                                           ^
4 warnings and 4 errors generated.

There are two reproductions of the same problem in #18793 (by @DarkSector and @f3ist), but since the title of that issue is incorrect (it fails in the Xcode GUI as well as on the command line), the original reproduction case is messy due to third-party dependencies, and an old version of RN is used, I decided to create a new issue.

Activity

  1. randerson112358 commented on Apr 29, 2018

    @randerson112358

    Same issue for me.

    Environment:
      OS: macOS X El Capitan 10.11.6
      Node: 8.11.1
      npm: 6.0.0
      Watchman: 4.9.0
      Xcode: Xcode 8.2.1 Build version 8C1002
    
    Packages: (wanted => installed)
    react-native-cli: 2.0.1
      react-native: ^0.55.3 => 0.55.3
    

    THE ERROR MESSAGE I GET:
    /Users//Desktop/AwesomeProject/node_modules/react-native/React/Views/RCTLayout.h:30:44: warning: declaration does not declare anything [-Wmissing-declarations]
    typedef struct CG_BOXABLE RCTLayoutMetrics RCTLayoutMetrics;
    ^~~~~~~~~~~~~~~~
    /Users//Desktop/AwesomeProject/node_modules/react-native/React/Views/RCTLayout.h:37:43: error: expected ';' after top level declarator
    typedef struct CG_BOXABLE RCTLayoutContext RCTLayoutContext;
    ^
    ;
    /Users//Desktop/AwesomeProject/node_modules/react-native/React/Views/RCTLayout.h:37:44: warning: declaration does not declare anything [-Wmissing-declarations]
    typedef struct CG_BOXABLE RCTLayoutContext RCTLayoutContext;
    ^~~~~~~~~~~~~~~~
    /Users//Desktop/AwesomeProject/node_modules/react-native/React/Views/RCTLayout.h:39:74: error: variable has incomplete type 'RCTLayoutMetrics' (aka 'struct CG_BOXABLE')
    static inline BOOL RCTLayoutMetricsEqualToLayoutMetrics(RCTLayoutMetrics a, RCTLayoutMetrics b)
    ^
    /Users//Desktop/AwesomeProject/node_modules/react-native/React/Views/RCTLayout.h:30:16: note: forward declaration of 'struct CG_BOXABLE'
    typedef struct CG_BOXABLE RCTLayoutMetrics RCTLayoutMetrics;

      ^
    

    /Users//Desktop/AwesomeProject/node_modules/react-native/React/Views/RCTLayout.h:39:94: error: variable has incomplete type 'RCTLayoutMetrics' (aka 'struct CG_BOXABLE')
    static inline BOOL RCTLayoutMetricsEqualToLayoutMetrics(RCTLayoutMetrics a, RCTLayoutMetrics b)
    ^
    /Users//Desktop/AwesomeProject/node_modules/react-native/React/Views/RCTLayout.h:30:16: note: forward declaration of 'struct CG_BOXABLE'
    typedef struct CG_BOXABLE RCTLayoutMetrics RCTLayoutMetrics;
    ^
    /Users//Desktop/AwesomeProject/node_modules/react-native/React/Views/RCTLayout.h:39:74: warning: unused parameter 'a' [-Wunused-parameter]
    static inline BOOL RCTLayoutMetricsEqualToLayoutMetrics(RCTLayoutMetrics a, RCTLayoutMetrics b)
    ^
    /Users//Desktop/AwesomeProject/node_modules/react-native/React/Views/RCTLayout.h:39:94: warning: unused parameter 'b' [-Wunused-parameter]
    static inline BOOL RCTLayoutMetricsEqualToLayoutMetrics(RCTLayoutMetrics a, RCTLayoutMetrics b)
    ^
    4 warnings and 4 errors generated.

    ** BUILD FAILED **

    The following build commands failed:
    CompileC /Users//Desktop/AwesomeProject/ios/build/Build/Intermediates/React.build/Debug-iphonesimulator/React.build/Objects-normal/x86_64/RCTShadowView+Internal.o Views/RCTShadowView+Internal.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
    (1 failure)

    Installing build/Build/Products/Debug-iphonesimulator/AwesomeProject.app
    An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=2):
    Failed to install the requested application
    An application bundle was not found at the provided path.
    Provide a valid path to the desired application bundle.
    Print: Entry, ":CFBundleIdentifier", Does Not Exist

    Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/AwesomeProject.app/Info.plist
    Print: Entry, ":CFBundleIdentifier", Does Not Exist

  2. srslafazan commented on May 6, 2018

    @srslafazan

    I solved this issue by upgrading to High Sierra and upgrading XCode to latest.

  3. confiks commented on May 6, 2018

    @confiks
    Author

    I didn't upgrade to High Sierra, but installed the latest version compatible with Sierra, XCode 9.2. It can be downloaded here.

  4. cidevant commented on May 8, 2018

    @cidevant

    I cant upgrade to sierra (macbook pro late 2009), so how to solve it?

  5. buf1024 commented on May 8, 2018

    @buf1024

    this is due to the newer version of react native use some new feature of xcode sdk, it should fixed when upgrade new version xcode in theory,

  6. TyrealGray commented on May 16, 2018

    @TyrealGray

    So it also means 0.55 documentation is wrong because it said "If you have already installed Xcode on your system, make sure it is version 8 or higher."

  7. stephenkopylov commented on May 16, 2018

    @stephenkopylov

    Guys, if you're using cocoapods in your projects, just try to renew your pods

  8. react-native-bot commented on Jun 12, 2018

    @react-native-bot
    Collaborator

    Closing as resolved. Please use Xcode 9.

  9. LeoNatan commented on Jul 7, 2018

    @LeoNatan
    Contributor

    This can easily be fixed by using a custom macro in the form of

    #if __has_attribute(objc_boxable)
    #define RCT_BOXABLE __attribute__((objc_boxable))
    #else
    #define RCT_BOXABLE
    #endif
    
  10. LeoNatan commented on Jul 7, 2018

    @LeoNatan
    Contributor
  11. pranavjandial123 commented on Aug 28, 2018

    @pranavjandial123

    @stephenkopylov renewing the pods fixed my issue!! Thanks..

  12. locked as resolved and limited conversation to collaborators on Jun 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions