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

Failed build iOS with Codemagic #22

Closed
santomalau03 opened this issue Aug 9, 2022 · 21 comments
Closed

Failed build iOS with Codemagic #22

santomalau03 opened this issue Aug 9, 2022 · 21 comments
Assignees
Labels
bug Something isn't working documentation Improvements or additions to documentation iOS This issue is related to iOS only to be fixed This issue will be fixed in the future waiting for response Response from reporter is needed

Comments

@santomalau03
Copy link

Hello @talsec-app
I tried to build and distribute app within codemagic, but i got this error

Swift Compiler Error (Xcode): No such module 'TalsecRuntime'
/Users/builder/programs/flutter/.pub-cache/hosted/pub.dartlang.org/freerasp-3.0.1/ios/Classes/SwiftFreeraspPlugin.swift:2:7
@talsec-app
Copy link
Member

talsec-app commented Aug 9, 2022

Hello @santomalau03 , please try the following:

  1. Check if the ios/.symlinks/plugins/freerasp/ios contains TalsecRuntime.xcframework symbolic link. If not, create it manually in that folder using the following command:
    ln -s ./Debug/TalsecRuntime.xcframework/ TalsecRuntime.xcframework
    The folder might not be visible. If there is no .symlinks folder at all, create the symlink in the freerasp-3.0.1/ios folder.
  2. Run pod install in the application ios folder.

Kind regards,
Talsec team

@talsec-app talsec-app added bug Something isn't working waiting for response Response from reporter is needed labels Aug 10, 2022
@talsec-app talsec-app added android This issue is related to Android only to be fixed This issue will be fixed in the future iOS This issue is related to iOS only and removed to be fixed This issue will be fixed in the future android This issue is related to Android only labels Aug 17, 2022
@talsec-app
Copy link
Member

Hello @santomalau03 ,

have you managed to solve the issue, or does it still persist? Thank you.

Kind regards,
Talsec team

@acdwisu
Copy link

acdwisu commented Sep 7, 2022

Hello @talsec-app ,

I have similar issue when build ios. In ios directory it has contained the ios/.symlinks/plugins/freerasp/ios/TalsecRuntime.xcframework symlink.

Thank you

@acdwisu
Copy link

acdwisu commented Sep 7, 2022

after some search,

in my case, it turn out because i targeted build for arm64 and armv7, while the latest freerasp-ios support arm64 and simulator arm64 & x86_x64, therefore define arm64 as build target could resolve my issue.

thx, cmiiw.

@talsec-app
Copy link
Member

Thank you @acdwisu , we will investigate this further and add the information into the manual.

@talsec-app talsec-app removed the waiting for response Response from reporter is needed label Sep 9, 2022
@acdwisu
Copy link

acdwisu commented Sep 9, 2022

thank you @talsec-app

@talsec-app talsec-app added to be fixed This issue will be fixed in the future documentation Improvements or additions to documentation labels Sep 18, 2022
@tusharanchliyajain
Copy link

@talsec-app Any update on this, @acdwisu any solution how can I fix this ?

@msikyna
Copy link
Member

msikyna commented Dec 12, 2022

Hello @tusharanchliyajain ,
the definition of arm64 as build target did not help?

@tusharanchliyajain
Copy link

Hey @msikyna,
Not it's not working with arm64 as build target still failing on codemagic build

@yardexx
Copy link
Member

yardexx commented Jan 16, 2023

Hello everyone!

After deep analysis and bug hunting, I was finally able to replicate and track down the issue. To resolve this issue, you have to adjust Codemagic pipeline. Notice that the instructions below apply to the workflow editor (not yaml one).

  1. Go to Applications page where you can see an overview of all of your apps
  2. Click the "⚙️" (Settings) button on the project where you use freeRASP
  3. You are now in the workflow editor. You should see different settings such as "Build for platforms", "Run build on" and also build stages (Build triggers, Environment variables, Dependency caching, etc.). Now find Build stage.
  4. Between Build and Tests stages there is a big "➕"(Add) button (if you haven't changed the pipeline till now). Click on it.
  5. Now you'll see two windows: Post-test script and Pre-build script. We are going to focus on Pre-build one. Copy this script into the Pre-build script window.
#!/bin/sh
flutter pub get
cd ios
pod install
cd .symlinks/plugins/freerasp/iOS
ln -s Debug/TalsecRuntime.xcframework
cd ../../../../
pod install
  1. If you already have some content there, just append the script. Please bear in mind your current working directory.
  2. Don't forget to save changes using the save icon in the right top corner.
  3. And that's all. Now, if you run the pipeline, it should pass without any problem.

Please let us know, if this solution worked for you.

Jaroslav from Talsec Team.

@yardexx yardexx added waiting for response Response from reporter is needed and removed to be fixed This issue will be fixed in the future labels Jan 16, 2023
@tusharanchliyajain
Copy link

@yardexx i used the same script in our code magic flow. I forgot to mention here .. anyways thanks for the reply

@yardexx
Copy link
Member

yardexx commented Jan 17, 2023

@tusharanchliyajain Thank you for your response.

Since solution works for you as well, I am closing this issue. Information about possible issues with Codemagic and how to resolve them will be added into README.md here on GitHub and on next release on pub.dev README as well.

If issue reoccurs, don't hesitate to reopen this issue.

Kind regards,
Jaroslav from Talsec Team

@yardexx yardexx removed the waiting for response Response from reporter is needed label Jan 17, 2023
yardexx added a commit that referenced this issue Jan 17, 2023
@yardexx yardexx closed this as completed Jan 17, 2023
@peer-f
Copy link

peer-f commented Mar 21, 2023

Hi @yardexx, we are using codemagic.yaml since the workflow editor doesn't support all of the features that we need for our pipelines. I've added the script that you provided before the flutter build ipa gets called and I still receive the No such module 'TalsecRuntime' error.

Our script looks like this:

      - flutter packages pub get
      - find . -name "Podfile" -execdir pod install \;
      ...
      - flutter build ipa --export-options-plist ~/export_options.plist --flavor=dev
        --build-name=0.1.0 --build-number=$PROJECT_BUILD_NUMBER

What I've tried so far:

  • put the script before flutter packages pub get
  • converted the script to a find command that I put after pod install
    - find . -type d -name "iOS" -execdir sh -c 'ln -s Debug/TalsecRuntime.xcframework "$0" && cd ../../../../' {} \;

@yardexx
Copy link
Member

yardexx commented Apr 12, 2023

Hello @peer-f

Apologies for the delay. I'll take look into it ASAP.

Jaroslav from Talsec

(Reopening issue)

@yardexx yardexx reopened this Apr 12, 2023
@yardexx
Copy link
Member

yardexx commented May 2, 2023

After long research, I cannot find a solution for the current version.

However, we will test a new version of freeRASP which will contain only a single iOS framework. That will resolve this issue once and for all.

Once released, I'll let you know here.

@peer-f
Copy link

peer-f commented May 3, 2023

Hi @yardexx,

thank you for looking into the issue!
What is the difference in version 5.0.0-dev.1 compared to 4.0.0? Using version 5.0.0-dev.1 our pipeline actually ran through.

@yardexx
Copy link
Member

yardexx commented May 3, 2023

Since its inception, freeRASP has had a crucial feature of distinguishing between dev and release versions. This allows for testing checks without including them in the weekly report, ensuring accurate data. Until freeRASP 4.0.0, this was achieved by using two native SDKs, one for dev and one for release, which were switched based on the type of build (debug/profile/release).

While this approach worked well for Android, it caused a lot of headaches for iOS. Additionally, since Flutter does not directly support Swift Package Manager, it made the situation even more complicated. To resolve this issue, a symlink for the specific SDK is created on build time (using an integration script provided by the integrator), but as you can see, this workaround works sometimes and causes many issues.

To simplify things, the native SDKs were modified so that a single SDK could be used, and a flag would determine whether Talsec SDK operates in dev (false) or release (true - default for security reasons) mode. No changes occur during build time, avoiding any issues with imports.

The new API includes an isProd flag in TalsecConfig, which is not a breaking change since it has a default value (true).

final config = TalsecConfig(
    androidConfig: ...,
    // Defaults to true
    // true - release (no need to write explicitly)
    // false - dev
    isProd: false,
)

The checks have also been improved.

If you're testing freeRASP 5.0.0-dev.1 (we're glad to hear that!), don't forget to remove the old iOS integration script and use isProd instead. If you spot any issues, please report them by opening an issue. The team is currently testing freeRASP on different environments and with various tooling, including Codemagic, to resolve any issues.

However, it's important to note that freeRASP 5.0.0-dev.1 should not be considered stable. We plan to update the API to provide clearer integration. We also plan to merge iOS and Android callbacks into a single callback (e.g. onSimulatorDetected and onEmulatorDetected will be merged) for clearer and less cluttered code.

@yardexx yardexx self-assigned this May 3, 2023
@yardexx yardexx added the to be fixed This issue will be fixed in the future label May 3, 2023
@msikyna
Copy link
Member

msikyna commented May 16, 2023

Hello @peer-f ,
could you try it with the new version? The version is 5.0.0.

Kind regards,
Talsec team

@msikyna msikyna added the waiting for response Response from reporter is needed label May 16, 2023
@peer-f
Copy link

peer-f commented May 22, 2023

Hi @msikyna ,

I will check it asap.

Best Regards,
Peer

@msikyna
Copy link
Member

msikyna commented May 22, 2023

Hello @peer-f ,
try it with version 5.0.2 please.

Kind regards,
Talsec team

@peer-f
Copy link

peer-f commented May 22, 2023

@msikyna it works fine now.
The pipeline runs through flawlessly and we receive reports via email (we used 5.0.0-dev.1 for testing purposes). I've removed the old iOS implementation as described by @yardexx.
Thanks for your help guys!

@msikyna msikyna closed this as completed May 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation iOS This issue is related to iOS only to be fixed This issue will be fixed in the future waiting for response Response from reporter is needed
Projects
None yet
Development

No branches or pull requests

7 participants