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

flutter run fails on x86_64 emulator #553

Closed
JssDWt opened this issue May 5, 2023 · 10 comments · Fixed by breez/breez-sdk-greenlight#479
Closed

flutter run fails on x86_64 emulator #553

JssDWt opened this issue May 5, 2023 · 10 comments · Fixed by breez/breez-sdk-greenlight#479

Comments

@JssDWt
Copy link
Contributor

JssDWt commented May 5, 2023

SDK version: breez/breez-sdk-greenlight@4db7c57
c-breez version: b58026f
OS: macOS Ventura 13.3.1
clang version:

Apple clang version 14.0.3 (clang-1403.0.22.14.1)
Target: x86_64-apple-darwin22.4.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

rustc version: 1.69.0
NDK version: 25.2.9519653
Emulator properties:

Properties
avd.ini.displayname              Pixel XL API 33
avd.ini.encoding                 UTF-8
AvdId                            Pixel_XL_API_33
disk.dataPartition.size          6442450944
fastboot.chosenSnapshotFile
fastboot.forceChosenSnapshotBoot no
fastboot.forceColdBoot           no
fastboot.forceFastBoot           yes
hw.accelerometer                 yes
hw.arc                           false
hw.audioInput                    yes
hw.battery                       yes
hw.camera.back                   virtualscene
hw.camera.front                  emulated
hw.cpu.ncore                     4
hw.device.hash2                  MD5:f78477654d5471c3d7f705251d14e72f
hw.device.manufacturer           Google
hw.device.name                   pixel_xl
hw.dPad                          no
hw.gps                           yes
hw.gpu.enabled                   yes
hw.gpu.mode                      auto
hw.initialOrientation            Portrait
hw.keyboard                      yes
hw.lcd.density                   560
hw.lcd.height                    2560
hw.lcd.width                     1440
hw.mainKeys                      no
hw.ramSize                       1536
hw.sdCard                        yes
hw.sensors.orientation           yes
hw.sensors.proximity             yes
hw.trackBall                     no
image.androidVersion.api         33
image.sysdir.1                   system-images/android-33/google_apis/x86_64/
PlayStore.enabled                false
runtime.network.latency          none
runtime.network.speed            full
showDeviceFrame                  yes
skin.dynamic                     yes
tag.display                      Google APIs
tag.id                           google_apis
vm.heapSize                      384

Output

✓  Built build/app/outputs/flutter-apk/app-debug.apk.
Installing build/app/outputs/flutter-apk/app-debug.apk...        2.641ms
I/flutter ( 4514): log list indexes: [1]
I/flutter ( 4514): Logfile is /data/user/0/com.cBreez.client/app_flutter/logs/c_breez.1.log
E/Main    ( 4514): FlutterError: Invalid argument(s): Failed to load dynamic library 'libbreez_sdk_core.so': dlopen failed: cannot locate symbol "__extenddftf2" referenced by "/data/app/~~UcBFNlatEEBdCCcwgFiyIw==/com.cBreez.client-Sa2PlTMqW3zf_nxnw3Cxjw==/lib/x86_64/libbreez_sdk_core.so"...
E/Main    ( 4514): Invalid argument(s): Failed to load dynamic library 'libbreez_sdk_core.so': dlopen failed: cannot locate symbol "__extenddftf2" referenced by "/data/app/~~UcBFNlatEEBdCCcwgFiyIw==/com.cBreez.client-Sa2PlTMqW3zf_nxnw3Cxjw==/lib/x86_64/libbreez_sdk_core.so"... 
E/Main    ( 4514):      #0      _open (dart:ffi-patch/ffi_dynamic_library_patch.dart:11:43)
E/Main    ( 4514):      #1      new DynamicLibrary.open (dart:ffi-patch/ffi_dynamic_library_patch.dart:22:12)
E/Main    ( 4514):      #2      getNativeToolkit (package:breez_sdk/native_toolkit.dart:17:51)
E/Main    ( 4514):      #3      new BreezBridge (package:breez_sdk/breez_bridge.dart:10:22)
E/Main    ( 4514):      #4      ServiceInjector.breezLib (package:c_breez/services/injector.dart:53:48)
E/Main    ( 4514):      #5      main.<anonymous closure> (package:c_breez/main.dart:45:31)
E/Main    ( 4514):      <asynchronous suspension>
E/Main    ( 4514):

@erdemyerebasmaz found a related issue here mozilla/rust-android-gradle#105 (comment)

@erdemyerebasmaz
Copy link
Collaborator

I was able to reproduce on pretty much the same environment. The x86_64 emulator I used had an old version of c-breez installed that was functional.

@ok300
Copy link
Collaborator

ok300 commented Jun 13, 2023

I had the exact same error when trying to run the React Native SDK example on an Android x86_64 image:

Failed to load dynamic library 'libbreez_sdk_core.so': dlopen failed: cannot locate symbol "__extenddftf2"

After some research, it turns out the issue doesn't exist on ARM (running the app on a connected physical Android) or just x86 emulator images.

Try to use an x86 (instead of x86_64) image in your Android Studio, chances are that will fix this problem.

cc @dangeross @ademar111190

@dangeross
Copy link
Contributor

Could it be related to this issue:

Several configure&make packages give binaries with cannot locate symbol "__extendsftf2"

Seems it could be related to the NDK version and maybe fixable with this workaround when building the library:

RUSTFLAGS+=" -C link-arg=$($CC -print-libgcc-file-name)" 

@ok300
Copy link
Collaborator

ok300 commented Jun 13, 2023

Same behavior for me on x86_64, even with the extra RUSTFLAGS.

@ademar111190
Copy link
Collaborator

Just confirmed the same behavior on an Android x86_64 emulator in a Linux host.

@yukibtc
Copy link

yukibtc commented Sep 22, 2023

Try this workaround (must be added in build.rs)

https://github.com/smartvaults/smartvaults/blob/master/bindings/smartvaults-sdk-ffi/build.rs

@JssDWt
Copy link
Contributor Author

JssDWt commented Sep 23, 2023

@yukibtc Thanks a lot! Just tried your code and it works for us too. Made a PR here breez/breez-sdk-greenlight#479
Question: Do I need to include the copyright notice there?

@yukibtc
Copy link

yukibtc commented Sep 24, 2023

Nice!

Question: Do I need to include the copyright notice there?

No

@JssDWt
Copy link
Contributor Author

JssDWt commented Sep 25, 2023

@JssDWt
Copy link
Contributor Author

JssDWt commented May 17, 2024

For people stumbling on this issue for a solution, I recommend checking our current solution which links the right clang path for x86_64 builds here

Probably even better to look at the latest version on the main branch in case more updates will be added later: https://github.com/breez/breez-sdk/blob/main/libs/sdk-bindings/build.rs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants