talsec/Free-RASP-ReactNative

Unsupported Swift architecture

Closed this issue ยท 7 comments

Describe the bug
Hello, I am having an error when trying to build using the last release (3.0.0) on a M1 Pro : Unsupported Swift architecture, Could not build Objective-C module 'freerasp_react_native'

Screenshots
image

Please complete the following information:

  • Device: iPhone 14 pro simulator
  • OS version: 16.4
  • Version of freeRASP: 3.0.0

Additional context
I tried the following :

  • EXCLUDED_ARCHS[sdk=iphonesimulator*] = arm64
  • config.build_settings["ONLY_ACTIVE_ARCH"] = "YES"
  • using Rosetta

Facing same issue for iOS Simulator (Xcode 14.2)
Builds fine in Phone.

Screenshot 2023-06-28 at 2 57 30 PM

Hello @anoirakby , @ritikadhandia ,

the new version has minimum supported version of Xcode 14.3. We will add this into the documentation. Could you try it with newer Xcode?

Kind regards,
Talsec team

Hello @msikyna , the issue was reported while using a version of Xcode 14.3

image
tobob commented
2023-06-30 12:44:07.530 xcodebuild[20418:116355] DVTCoreDeviceEnabledState: DVTCoreDeviceEnabledState_Disabled set via user default (DVTEnableCoreDevice=disabled)
--- xcodebuild: WARNING: Using the first of multiple matching destinations:
{ platform:iOS Simulator, id:22D33ED2-FEB3-423F-8DB9-9FCA20C3DB36, OS:16.4, name:iPhone 14 }
{ platform:iOS Simulator, id:22D33ED2-FEB3-423F-8DB9-9FCA20C3DB36, OS:16.4, name:iPhone 14 }
** BUILD FAILED **


The following build commands failed:
	SwiftCompile normal x86_64 /Users/****/app-mobile/node_modules/freerasp-react-native/ios/FreeraspReactNative.swift (in target 'freerasp-react-native' from project 'Pods')
	SwiftCompile normal x86_64 Compiling\ FreeraspReactNative.swift /Users/*****/app-mobile/node_modules/freerasp-react-native/ios/FreeraspReactNative.swift (in target 'freerasp-react-native' from project 'Pods')
	SwiftEmitModule normal x86_64 Emitting\ module\ for\ freerasp_react_native (in target 'freerasp-react-native' from project 'Pods')
(3 failures)

info Run CLI with --verbose flag for more details.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Hello,

We have investigated the problem you reported and will be doing our best to resolve it as soon as possible.

We observed that the problem you encountered does not occur when Rosetta is not used. For now, we suggest to run the app without Rosetta, if possible.

We will keep you updated on our progress. If you have any further information or insights that might assist us in diagnosing the issue, please don't hesitate to share them with us (e.g. did you encounter the issue in previous version of freeRASP?).

Thank you for your patience and understanding.

Same issue here with Xcode 14.3.1

Hi everyone,

We found several solutions how you can fix the problem for now:

  1. Build with Apple Silicon,

or

  1. Go to <your_project>/node_modules/freerasp-react-native/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/TalsecRuntime-Swift.h and move this code (lines 4 and 5) to the top of the file:
#ifndef TALSECRUNTIME_SWIFT_H
#define TALSECRUNTIME_SWIFT_H

This will define the required header even though arm64 macro is not set. We didn't encounter any problem with this solution so far. However, as we are messing here with an automatically generated code, we cannot guarantee that this doesn't break something else.

or

  1. Use freerasp-react-native@2.0.2, that is built with older Swift compatible with Rosetta

Explanation:
There were some changes made when a project is generated using newer versions of Swift (swiftlang-5.8.0) that we use now to build freeRASP. For some reason which is unknown for us, when you try to run app on iPhone simulator with Rosetta, the __arm64__ macro is not set properly, therefore our header file is not included in the build and the build fails. We are aware that none of these solutions is perfect. However, we wanted to provide you a working solution before we are able to resolve the issue properly, which may take a longer time as the issue is quite complex.

Best,

Tomas, Talsec developer