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

Error with Turbo Module after adding Swift file #48359

Open
CaptainJeff opened this issue Dec 22, 2024 · 0 comments
Open

Error with Turbo Module after adding Swift file #48359

CaptainJeff opened this issue Dec 22, 2024 · 0 comments
Labels
Needs: Triage 🔍 Type: New Architecture Issues and PRs related to new architecture (Fabric/Turbo Modules)

Comments

@CaptainJeff
Copy link

Description

I'm getting an error with adding my TurboModule if I add a swift file to the module - I have a bridging header and everything and still doesn't work. If i remove the swift file then it works again

Steps to reproduce

  1. npx create-react-native-library@latest BleYolanda
  2. yarn install && npx pod-install && npx expo run:ios (expo doesn't use prebuild. I manage the android and ios directories). Note everything works here
  3. in modules/demo-turbo-module/ios add ble-yolanda-Bridging-Header.h and BleYolanda.swift and run all of the commands again and I get the following errors
❌  (ios/Pods/Headers/Public/ReactCodegen/BleManagerSpec/BleManagerSpec.h:15:2)

  13 | 
  14 | #ifndef __cplusplus
> 15 | #error This file must be compiled as Obj-C++. If you are importing it, you must change your file extension to .mm.
     |  ^ This file must be compiled as Obj-C++. If you are importing it, you must change your file extension to .mm.
  16 | #endif
  17 | 
  18 | // Avoid multiple includes of BleManagerSpec symbols


❌  (ios/Pods/Headers/Public/RCTRequired/RCTRequired/RCTRequired.h:8:10)

   6 |  */
   7 | 
>  8 | #include <utility>
     |          ^ 'utility' file not found
   9 | 
  10 | // The inliner doesn't take into account ARC optimizations that may occur after
  11 | // inlining when computing the inline cost of an ObjC++ function. Here we make


❌  (ios/Pods/Headers/Public/RCTTypeSafety/RCTTypeSafety/RCTConvertHelpers.h:8:9)

   6 |  */
   7 | 
>  8 | #import <optional>
     |         ^ 'optional' file not found
   9 | 
  10 | #import <vector>
  11 | 


❌  (ios/Pods/Headers/Public/React-jsi/jsi/jsi.h:10:10)

   8 | #pragma once
   9 | 
> 10 | #include <cassert>
     |          ^ 'cassert' file not found
  11 | #include <cstring>
  12 | #include <exception>
  13 | #include <functional>


❌  (ios/Pods/Headers/Public/DoubleConversion/double-conversion/utils.h:139:1)

  137 | #endif
  138 | 
> 139 | namespace double_conversion {
      | ^ unknown type name 'namespace'
  140 | 
  141 | static const int kCharSize = sizeof(char);
  142 | 


❌  (ios/Pods/Headers/Public/DoubleConversion/double-conversion/utils.h:139:28)

  137 | #endif
  138 | 
> 139 | namespace double_conversion {
      |                            ^ expected ';' after top level declarator
  140 | 
  141 | static const int kCharSize = sizeof(char);
  142 | 


❌  (ios/Pods/Headers/Public/DoubleConversion/double-conversion/bignum-dtoa.h:33:1)

  31 | #include "utils.h"
  32 | 
> 33 | namespace double_conversion {
     | ^ unknown type name 'namespace'
  34 | 
  35 | enum BignumDtoaMode {
  36 |   // Return the shortest correct representation.


❌  (ios/Pods/Headers/Public/DoubleConversion/double-conversion/bignum-dtoa.h:33:28)

  31 | #include "utils.h"
  32 | 
> 33 | namespace double_conversion {
     |                            ^ expected ';' after top level declarator
  34 | 
  35 | enum BignumDtoaMode {
  36 |   // Return the shortest correct representation.


❌  (ios/Pods/Headers/Public/DoubleConversion/double-conversion/bignum.h:33:1)

  31 | #include "utils.h"
  32 | 
> 33 | namespace double_conversion {
     | ^ unknown type name 'namespace'
  34 | 
  35 | class Bignum {
  36 |  public:


❌  (ios/Pods/Headers/Public/DoubleConversion/double-conversion/bignum.h:33:28)

  31 | #include "utils.h"
  32 | 
> 33 | namespace double_conversion {
     |                            ^ expected ';' after top level declarator
  34 | 
  35 | class Bignum {
  36 |  public:


❌  (ios/Pods/Headers/Public/DoubleConversion/double-conversion/diy-fp.h:33:1)

  31 | #include "utils.h"
  32 | 
> 33 | namespace double_conversion {
     | ^ unknown type name 'namespace'
  34 | 
  35 | // This "Do It Yourself Floating Point" class implements a floating-point number
  36 | // with a uint64 significand and an int exponent. Normalized DiyFp numbers will


❌  (ios/Pods/Headers/Public/DoubleConversion/double-conversion/diy-fp.h:33:28)

  31 | #include "utils.h"
  32 | 
> 33 | namespace double_conversion {
     |                            ^ expected ';' after top level declarator
  34 | 
  35 | // This "Do It Yourself Floating Point" class implements a floating-point number
  36 | // with a uint64 significand and an int exponent. Normalized DiyFp numbers will


❌  (ios/Pods/Headers/Public/DoubleConversion/double-conversion/cached-powers.h:33:1)

  31 | #include "diy-fp.h"
  32 | 
> 33 | namespace double_conversion {
     | ^ unknown type name 'namespace'
  34 | 
  35 | class PowersOfTenCache {
  36 |  public:


❌  (ios/Pods/Headers/Public/DoubleConversion/double-conversion/cached-powers.h:33:28)

  31 | #include "diy-fp.h"
  32 | 
> 33 | namespace double_conversion {
     |                            ^ expected ';' after top level declarator
  34 | 
  35 | class PowersOfTenCache {
  36 |  public:


❌  (ios/Pods/Headers/Public/DoubleConversion/double-conversion/double-conversion.h:33:1)

  31 | #include "utils.h"
  32 | 
> 33 | namespace double_conversion {
     | ^ unknown type name 'namespace'
  34 | 
  35 | class DoubleToStringConverter {
  36 |  public:


❌  (ios/Pods/Headers/Public/DoubleConversion/double-conversion/double-conversion.h:33:28)

  31 | #include "utils.h"
  32 | 
> 33 | namespace double_conversion {
     |                            ^ expected ';' after top level declarator
  34 | 
  35 | class DoubleToStringConverter {
  36 |  public:


❌  (ios/Pods/Headers/Public/DoubleConversion/double-conversion/fast-dtoa.h:33:1)

  31 | #include "utils.h"
  32 | 
> 33 | namespace double_conversion {
     | ^ unknown type name 'namespace'
  34 | 
  35 | enum FastDtoaMode {
  36 |   // Computes the shortest representation of the given input. The returned


❌  (ios/Pods/Headers/Public/DoubleConversion/double-conversion/fast-dtoa.h:33:28)

  31 | #include "utils.h"
  32 | 
> 33 | namespace double_conversion {
     |                            ^ expected ';' after top level declarator
  34 | 
  35 | enum FastDtoaMode {
  36 |   // Computes the shortest representation of the given input. The returned


❌  (ios/Pods/Headers/Public/DoubleConversion/double-conversion/fixed-dtoa.h:33:1)

  31 | #include "utils.h"
  32 | 
> 33 | namespace double_conversion {
     | ^ unknown type name 'namespace'
  34 | 
  35 | // Produces digits necessary to print a given number with
  36 | // 'fractional_count' digits after the decimal point.


❌  (ios/Pods/Headers/Public/DoubleConversion/double-conversion/fixed-dtoa.h:33:28)

  31 | #include "utils.h"
  32 | 
> 33 | namespace double_conversion {
     |                            ^ expected ';' after top level declarator
  34 | 
  35 | // Produces digits necessary to print a given number with
  36 | // 'fractional_count' digits after the decimal point.


❌  (ios/Pods/Headers/Public/DoubleConversion/double-conversion/ieee.h:33:1)

  31 | #include "diy-fp.h"
  32 | 
> 33 | namespace double_conversion {
     | ^ unknown type name 'namespace'
  34 | 
  35 | // We assume that doubles and uint64_t have the same endianness.
  36 | static uint64_t double_to_uint64(double d) { return BitCast<uint64_t>(d); }


❌  (ios/Pods/Headers/Public/DoubleConversion/double-conversion/ieee.h:33:28)

  31 | #include "diy-fp.h"
  32 | 
> 33 | namespace double_conversion {
     |                            ^ expected ';' after top level declarator
  34 | 
  35 | // We assume that doubles and uint64_t have the same endianness.
  36 | static uint64_t double_to_uint64(double d) { return BitCast<uint64_t>(d); }


❌  (ios/Pods/Headers/Public/DoubleConversion/double-conversion/strtod.h:33:1)

  31 | #include "utils.h"
  32 | 
> 33 | namespace double_conversion {
     | ^ unknown type name 'namespace'
  34 | 
  35 | // The buffer must only contain digits in the range [0-9]. It must not
  36 | // contain a dot or a sign. It must not start with '0', and must not be empty.


❌  (ios/Pods/Headers/Public/glog/glog/logging.h:42:10)

  40 | #include <string.h>
  41 | #include <time.h>
> 42 | #include <iosfwd>
     |          ^ 'iosfwd' file not found
  43 | #include <ostream>
  44 | #include <sstream>
  45 | #include <string>


❌  (modules/BleYolanda/ios/BleYolanda.h:2:9)

  1 | 
> 2 | #import <RNBleYolandaSpec/RNBleYolandaSpec.h>
    |         ^ could not build module 'ReactCodegen'
  3 | 
  4 | @interface BleYolanda : NSObject <NativeBleYolandaSpec>
  5 | 

I've tried just about everything... I can see in xcode that RNBleYolandaSpec/RNBleYolandaSpec.h does exist and links to it properly, etc..

React Native Version

0.76.5

Affected Platforms

Runtime - iOS, Build - MacOS

Areas

TurboModule - The New Native Module System

Output of npx react-native info

System:
  OS: macOS 14.6
  CPU: (14) arm64 Apple M3 Max
  Memory: 748.00 MB / 36.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 22.9.0
    path: ~/.asdf/installs/nodejs/22.9.0/bin/node
  Yarn:
    version: 1.22.22
    path: ~/.asdf/installs/nodejs/22.9.0/bin/yarn
  npm:
    version: 10.9.1
    path: ~/Sites/ccr-mobile/node_modules/.bin/npm
  Watchman:
    version: 2024.12.02.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.16.2
    path: /Users/x/.asdf/shims/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.2
      - iOS 18.2
      - macOS 15.2
      - tvOS 18.2
      - visionOS 2.2
      - watchOS 11.2
  Android SDK: Not Found
IDEs:
  Android Studio: 2024.2 AI-242.21829.142.2421.12409432
  Xcode:
    version: 16.2/16C5032a
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.12
    path: /usr/bin/javac
  Ruby:
    version: 3.1.4
    path: /Users/x/.asdf/shims/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 15.1.2
    wanted: ^15.1.2
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native:
    installed: 0.76.5
    wanted: 0.76.5
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: true
  newArchEnabled: true

Stacktrace or Logs

❌  (ios/Pods/Headers/Public/ReactCodegen/BleManagerSpec/BleManagerSpec.h:15:2)

  13 | 
  14 | #ifndef __cplusplus
> 15 | #error This file must be compiled as Obj-C++. If you are importing it, you must change your file extension to .mm.
     |  ^ This file must be compiled as Obj-C++. If you are importing it, you must change your file extension to .mm.
  16 | #endif
  17 | 
  18 | // Avoid multiple includes of BleManagerSpec symbols


❌  (ios/Pods/Headers/Public/RCTRequired/RCTRequired/RCTRequired.h:8:10)

   6 |  */
   7 | 
>  8 | #include <utility>
     |          ^ 'utility' file not found
   9 | 
  10 | // The inliner doesn't take into account ARC optimizations that may occur after
  11 | // inlining when computing the inline cost of an ObjC++ function. Here we make


❌  (ios/Pods/Headers/Public/RCTTypeSafety/RCTTypeSafety/RCTConvertHelpers.h:8:9)

   6 |  */
   7 | 
>  8 | #import <optional>
     |         ^ 'optional' file not found
   9 | 
  10 | #import <vector>
  11 | 


❌  (ios/Pods/Headers/Public/React-jsi/jsi/jsi.h:10:10)

   8 | #pragma once
   9 | 
> 10 | #include <cassert>
     |          ^ 'cassert' file not found
  11 | #include <cstring>
  12 | #include <exception>
  13 | #include <functional>


❌  (ios/Pods/Headers/Public/DoubleConversion/double-conversion/utils.h:139:1)

  137 | #endif
  138 | 
> 139 | namespace double_conversion {
      | ^ unknown type name 'namespace'
  140 | 
  141 | static const int kCharSize = sizeof(char);
  142 | 


❌  (ios/Pods/Headers/Public/DoubleConversion/double-conversion/utils.h:139:28)

  137 | #endif
  138 | 
> 139 | namespace double_conversion {
      |                            ^ expected ';' after top level declarator
  140 | 
  141 | static const int kCharSize = sizeof(char);
  142 | 


❌  (ios/Pods/Headers/Public/DoubleConversion/double-conversion/bignum-dtoa.h:33:1)

  31 | #include "utils.h"
  32 | 
> 33 | namespace double_conversion {
     | ^ unknown type name 'namespace'
  34 | 
  35 | enum BignumDtoaMode {
  36 |   // Return the shortest correct representation.


❌  (ios/Pods/Headers/Public/DoubleConversion/double-conversion/bignum-dtoa.h:33:28)

  31 | #include "utils.h"
  32 | 
> 33 | namespace double_conversion {
     |                            ^ expected ';' after top level declarator
  34 | 
  35 | enum BignumDtoaMode {
  36 |   // Return the shortest correct representation.


❌  (ios/Pods/Headers/Public/DoubleConversion/double-conversion/bignum.h:33:1)

  31 | #include "utils.h"
  32 | 
> 33 | namespace double_conversion {
     | ^ unknown type name 'namespace'
  34 | 
  35 | class Bignum {
  36 |  public:


❌  (ios/Pods/Headers/Public/DoubleConversion/double-conversion/bignum.h:33:28)

  31 | #include "utils.h"
  32 | 
> 33 | namespace double_conversion {
     |                            ^ expected ';' after top level declarator
  34 | 
  35 | class Bignum {
  36 |  public:


❌  (ios/Pods/Headers/Public/DoubleConversion/double-conversion/diy-fp.h:33:1)

  31 | #include "utils.h"
  32 | 
> 33 | namespace double_conversion {
     | ^ unknown type name 'namespace'
  34 | 
  35 | // This "Do It Yourself Floating Point" class implements a floating-point number
  36 | // with a uint64 significand and an int exponent. Normalized DiyFp numbers will


❌  (ios/Pods/Headers/Public/DoubleConversion/double-conversion/diy-fp.h:33:28)

  31 | #include "utils.h"
  32 | 
> 33 | namespace double_conversion {
     |                            ^ expected ';' after top level declarator
  34 | 
  35 | // This "Do It Yourself Floating Point" class implements a floating-point number
  36 | // with a uint64 significand and an int exponent. Normalized DiyFp numbers will


❌  (ios/Pods/Headers/Public/DoubleConversion/double-conversion/cached-powers.h:33:1)

  31 | #include "diy-fp.h"
  32 | 
> 33 | namespace double_conversion {
     | ^ unknown type name 'namespace'
  34 | 
  35 | class PowersOfTenCache {
  36 |  public:


❌  (ios/Pods/Headers/Public/DoubleConversion/double-conversion/cached-powers.h:33:28)

  31 | #include "diy-fp.h"
  32 | 
> 33 | namespace double_conversion {
     |                            ^ expected ';' after top level declarator
  34 | 
  35 | class PowersOfTenCache {
  36 |  public:


❌  (ios/Pods/Headers/Public/DoubleConversion/double-conversion/double-conversion.h:33:1)

  31 | #include "utils.h"
  32 | 
> 33 | namespace double_conversion {
     | ^ unknown type name 'namespace'
  34 | 
  35 | class DoubleToStringConverter {
  36 |  public:


❌  (ios/Pods/Headers/Public/DoubleConversion/double-conversion/double-conversion.h:33:28)

  31 | #include "utils.h"
  32 | 
> 33 | namespace double_conversion {
     |                            ^ expected ';' after top level declarator
  34 | 
  35 | class DoubleToStringConverter {
  36 |  public:


❌  (ios/Pods/Headers/Public/DoubleConversion/double-conversion/fast-dtoa.h:33:1)

  31 | #include "utils.h"
  32 | 
> 33 | namespace double_conversion {
     | ^ unknown type name 'namespace'
  34 | 
  35 | enum FastDtoaMode {
  36 |   // Computes the shortest representation of the given input. The returned


❌  (ios/Pods/Headers/Public/DoubleConversion/double-conversion/fast-dtoa.h:33:28)

  31 | #include "utils.h"
  32 | 
> 33 | namespace double_conversion {
     |                            ^ expected ';' after top level declarator
  34 | 
  35 | enum FastDtoaMode {
  36 |   // Computes the shortest representation of the given input. The returned


❌  (ios/Pods/Headers/Public/DoubleConversion/double-conversion/fixed-dtoa.h:33:1)

  31 | #include "utils.h"
  32 | 
> 33 | namespace double_conversion {
     | ^ unknown type name 'namespace'
  34 | 
  35 | // Produces digits necessary to print a given number with
  36 | // 'fractional_count' digits after the decimal point.


❌  (ios/Pods/Headers/Public/DoubleConversion/double-conversion/fixed-dtoa.h:33:28)

  31 | #include "utils.h"
  32 | 
> 33 | namespace double_conversion {
     |                            ^ expected ';' after top level declarator
  34 | 
  35 | // Produces digits necessary to print a given number with
  36 | // 'fractional_count' digits after the decimal point.


❌  (ios/Pods/Headers/Public/DoubleConversion/double-conversion/ieee.h:33:1)

  31 | #include "diy-fp.h"
  32 | 
> 33 | namespace double_conversion {
     | ^ unknown type name 'namespace'
  34 | 
  35 | // We assume that doubles and uint64_t have the same endianness.
  36 | static uint64_t double_to_uint64(double d) { return BitCast<uint64_t>(d); }


❌  (ios/Pods/Headers/Public/DoubleConversion/double-conversion/ieee.h:33:28)

  31 | #include "diy-fp.h"
  32 | 
> 33 | namespace double_conversion {
     |                            ^ expected ';' after top level declarator
  34 | 
  35 | // We assume that doubles and uint64_t have the same endianness.
  36 | static uint64_t double_to_uint64(double d) { return BitCast<uint64_t>(d); }


❌  (ios/Pods/Headers/Public/DoubleConversion/double-conversion/strtod.h:33:1)

  31 | #include "utils.h"
  32 | 
> 33 | namespace double_conversion {
     | ^ unknown type name 'namespace'
  34 | 
  35 | // The buffer must only contain digits in the range [0-9]. It must not
  36 | // contain a dot or a sign. It must not start with '0', and must not be empty.


❌  (ios/Pods/Headers/Public/glog/glog/logging.h:42:10)

  40 | #include <string.h>
  41 | #include <time.h>
> 42 | #include <iosfwd>
     |          ^ 'iosfwd' file not found
  43 | #include <ostream>
  44 | #include <sstream>
  45 | #include <string>


❌  (modules/BleYolanda/ios/BleYolanda.h:2:9)

  1 | 
> 2 | #import <RNBleYolandaSpec/RNBleYolandaSpec.h>
    |         ^ could not build module 'ReactCodegen'
  3 | 
  4 | @interface BleYolanda : NSObject <NativeBleYolandaSpec>
  5 |

Reproducer

https://github.com/CaptainJeff/reproducer-react-native

Screenshots and Videos

No response

@CaptainJeff CaptainJeff added Needs: Triage 🔍 Type: New Architecture Issues and PRs related to new architecture (Fabric/Turbo Modules) labels Dec 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs: Triage 🔍 Type: New Architecture Issues and PRs related to new architecture (Fabric/Turbo Modules)
Projects
None yet
Development

No branches or pull requests

1 participant