flutter-rsa icon indicating copy to clipboard operation
flutter-rsa copied to clipboard

Failed to lookup symbol 'RSABridgeCall': dlsym(RTLD_DEFAULT, RSABridgeCall): symbol not found

Open 215ly opened this issue 9 months ago • 19 comments

When I use the Flutter project to sign the plugin for example:

RSA.signPKCS1v15bytes (signData, fastRsa. Hash.SHA256, pemPrivate Key)

The following error message appears

Failed to lookup symbol 'RSABridgeCall': dlsym(RTLD_DEFAULT, RSABridgeCall): symbol not found

This error only occurs on the IOS platform and does not occur on the Android platform

  • Xcode version:15.3
  • IOS version: eighteen point three
  • fluter version:3.19.6
  • fast_rsa: ^3.6.6

I am wondering if the conflict occurred due to the introduction of other plugins?

If you have any response, I would greatly appreciate it

215ly avatar Feb 11 '25 03:02 215ly

I'm seeing the same issue when building with FlutterFlow:

[ERROR:flutter/runtime/dart_vm_initializer.cc(40)] Unhandled Exception: Invalid argument(s): Failed to lookup symbol 'RSABridgeCall': dlsym(RTLD_DEFAULT, RSABridgeCall): symbol not found

dustinkerstein avatar Feb 13 '25 19:02 dustinkerstein

Same on 3.8.3. It looks like this happens only for iOS:

Invalid argument(s): Failed to lookup symbol 'RSABridgeCall': dlsym(RTLD_DEFAULT, RSABridgeCall): symbol not found
#0      DynamicLibrary.lookup (dart:ffi-patch/ffi_dynamic_library_patch.dart:33)
#1      Binding._library= (package:fast_rsa/bridge/binding.dart)
#2      new Binding._internal (package:fast_rsa/bridge/binding.dart:29)
#3      Binding._instance (package:fast_rsa/bridge/binding.dart:18)
#4      RSABridge.bindingEnabled (package:fast_rsa/fast_rsa_bridge.dart)
#5      RSABridge.call (package:fast_rsa/fast_rsa_bridge.dart)
#6      RSA.decryptPrivateKey (package:fast_rsa/fast_rsa.dart:160)

It was reproduced by one of our testers on his iOS device. However, I was not able to reproduce with the same private key and password on my device and on the Simulator.

This is not happening on version 3.6.3.

UPDATE: I was able to reproduce when building the app for iOS in release mode on 3.8.3. Version 3.8.2 doesn't have this problem

Arley011 avatar May 01 '25 13:05 Arley011

Yes, we had to downgrade for this issue.

iosephmagno avatar May 13 '25 06:05 iosephmagno

Hi everyone,

so after some digging, it seems the code gets stripped away, as of missing a reference in code (it is only called via dlsym reflection).

There are thre options, two of them as workaround, from least favourable to desired:

  1. Option: in Target 'Runner'/Build Settings/Linkage - General/Dead Code Stripping Change YES to NO Unfavourable

  2. Option: Create an m.file with

//
//  keeprsa.m
//  Runner
//
//  Created by trauma-and-drama on 15.05.2025.
//
#import <RSABridge/librsa_bridge.h>

// Trick to prevent RSABridgeCall from being stripped in release mode
__attribute__((used)) static void _keep_RSABridgeCall() {
    RSABridgeCall(NULL, NULL, 0);
}

Mind the attribute __attribute__((used)) which prevents stripping. No further reference required, just put it in your Runner folder, where appDelegate.swift is located.

  1. Option: and most favorable: RSABridgeCall the pod needs to be updated with that attribute to prevent stripping.

Hope that helped. It was the only solution that helped me regardless of version.

trauma-and-drama avatar May 15 '25 13:05 trauma-and-drama

Hi @trauma-and-drama thanks for sharing this, I'm going to include it in the next version to prevent stripping

jerson avatar May 15 '25 13:05 jerson

Dear @jerson ,

I had no luck making my proposal work in Testflight, while it only worked in local release.

It seems like the Appstore processing strips away like a mofo. Even though having a mock call in swift in the AppDelegate _ = RSABridge.RSAEncodeText(nil, nil) did not help.

The only thing that helped was the first option.

Strip linked Product = NO Strip Style NonGlobalSymbols Dead Code Stripping = false

Not sure what is happening.

trauma-and-drama avatar Jun 02 '25 10:06 trauma-and-drama

fast_rsa: ^3.6.6

When using flutter run --debug Everything is OK

When using flutter run --profile catch: Invalid argument(s): Failed to lookup symbol 'RSABridgeCall': dlsym(RTLD_DEFAULT, RSABridgeCall): symbol not found.

yanmingLiu avatar Jun 13 '25 06:06 yanmingLiu

I just released a new version fixing the Failed to lookup symbol 'RSABridgeCall' in profile mode please take a look https://pub.dev/packages/fast_rsa/versions/3.8.4

jerson avatar Jun 14 '25 03:06 jerson

This issue still facing in TestFlight build (release and debug mode all things are working fine but issue in TestFlight build [] am using https://pub.dev/packages/fast_rsa/versions/3.8.5 I got same message '[Failed to lookup symbol 'RSABridgeCall': dlsym(RTLD_DEFAULT, RSABridgeCall): symbol not found]'. Android all things are working fine . my flutter doctor Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel stable, 3.32.3, on macOS 15.5 24F74 darwin-arm64, locale en-US) [✓] Android toolchain - develop for Android devices (Android SDK version 35.0.1) [✓] Xcode - develop for iOS and macOS (Xcode 16.4) [✓] Chrome - develop for the web [✓] Android Studio (version 2024.3) [✓] VS Code (version 1.100.3) [✓] Connected device (3 available) ! Error: Browsing on the local area network for iPhone. Ensure the device is unlocked and attached with a cable or associated with the same local area network as this Mac. The device must be opted into Developer Mode to connect wirelessly. (code -27) [✓] Network resources

• No issues found!

DipinTahrtech avatar Jul 22 '25 05:07 DipinTahrtech

We're successfully using fast_rsa version 3.6.2. Is there any specific reason to upgrade?

delfme avatar Jul 22 '25 08:07 delfme

@delfme Thanks, the app is working correctly in TestFlight with fast_rsa version 3.6.2

DipinTahrtech avatar Jul 23 '25 11:07 DipinTahrtech

Same here using 3.8.6 but still having the same issue, had to downgrade to 3.6.2

wizlif avatar Aug 15 '25 09:08 wizlif

Just wanted to see if anyone was able to get the latest code (3.8.5) working on TestFlight builds. I'm running into the same issue (and am unable to use the older versions).

dustinkerstein avatar Aug 21 '25 18:08 dustinkerstein

FYI, I'm able to replicate this issue with the example project in the repo when archiving to TestFlight, and when changing the "Stripe Style" build setting from "All Symbols" to "Non-Global Symbols", the issue goes away. Note this is on version 3.8.5.

dustinkerstein avatar Sep 05 '25 20:09 dustinkerstein

Still experiencing the same issue on 3.8.5. Are there any updates?

amansinh79 avatar Sep 16 '25 09:09 amansinh79

same issue i face on test flight with the latest version of fast_rsa (3.8.5) not working on TestFlight builds. while test release without testflight work fine .

FlutterEngineers avatar Sep 17 '25 10:09 FlutterEngineers

I faced the same issue, and I had to replace fast_rsa with encrypt and pointycastle for RSA encryption to fix it. I tried versions 3.8.4, 3.8.5, and 3.6.2, but the issue still persists.

vahid75hj avatar Oct 14 '25 10:10 vahid75hj

Tested several versions and can confirm that the issue appears in version 3.8.3. Downgraded to 3.8.2 for now.

jesscmoore avatar Oct 23 '25 05:10 jesscmoore

I have released a new version which may fix issue, https://pub.dev/packages/fast_rsa/versions/3.8.6 is using force load like 3.8.2 or previous versions

jerson avatar Oct 25 '25 01:10 jerson

I have released a new version which may fix issue, https://pub.dev/packages/fast_rsa/versions/3.8.6 is using force load like 3.8.2 or previous versions

I got the same error on 3.8.6. We downgraded to 3.6.3 and now it works.

Fasust avatar Nov 19 '25 13:11 Fasust