Skip to content
This repository has been archived by the owner on Jan 17, 2024. It is now read-only.

Run in release mode, compile error report Undefined symbol: _rust_greeting #75

Closed
Aaron009 opened this issue Feb 4, 2021 · 5 comments
Closed

Comments

@Aaron009
Copy link

Aaron009 commented Feb 4, 2021

I know this problem has been raised by many people, but I also followed the solution they said, but it did not solve the problem.

Flutter 1.25.0-8.3.pre • channel beta • https://github.com/flutter/flutter.git
Framework • revision 5d36f2e7f5 (3 weeks ago) • 2021-01-14 15:57:49 -0800
Engine • revision 7a8f8ca02c
Tools • Dart 2.12.0 (build 2.12.0-133.7.beta)

I first clone the project by executing the command:

git clone https://github.com/brickpop/flutter-rust-ffi

Then when debugging, an error occurred, I deleted the project IOS folder and executed the following command:

flutter create .

At this time, the debugging operation was successful, but it failed when it was released. The error screenshot is as follows1.png

Then, I found the following information to solve this problem, but it didn't work after trying.

brickpop/flutter-rust-ffi#7

dart-lang/native#897

shekohex/flutterust#17

  1. In Xcode, go to Target Runner > Build Settings > Strip Style.
    Change from All Symbols to Non-Global Symbols.
    2.png
    Test result: No
  2. IOS Failed to lookup symbol (dlsym(RTLD_DEFAULT, test_func): symbol not found) dart-lang/native#897
    enable testability.
    3.png
    Test result: No
@brickpop
Copy link

brickpop commented Feb 4, 2021

brickpop/flutter-rust-ffi#16 might be the one relevant here.

The STRIP_STYLE setting may not be needed on the Flutter project, but on the plugin project you export (Pod spec file)

@Aaron009
Copy link
Author

Aaron009 commented Feb 5, 2021

brickpop/flutter-rust-ffi#16 might be the one relevant here.

The STRIP_STYLE setting may not be needed on the Flutter project, but on the plugin project you export (Pod spec file)

I found the solution:

Step 1:

When publishing, it must be tested on a real machine, otherwise it will prompt that "Module'mylib" is not found

Step 2:

Find "Architectures" in "Build Seetings" and make the following modifications
1.png

XCode's default "standard architecture (arm64, armv7)" and ".a" files do not contain "armv7", and the new version of Rust has eliminated armv7.

I am a little depressed. Before I went to bed, I could still publish my work normally, but when I was preparing for the Pull Request the next day, a new problem appeared.

After compilation, after the new version is released, the application will be grayed out.

@brickpop
Copy link

brickpop commented Feb 5, 2021

Apple is currently supporting arm64 and x86_64 only. If your app is targeting iOS 9 or earlier, then you'd need to compile the static library for armv7, but the amount of people still using iphone 5 in 2021 is negligible I think.

The greyed out problem is new to me :(

@shekohex
Copy link

Hey @Aaron009 if this solution worked well for you, could you please add these steps to the flutterust README? it would be appreciated

@Aaron009
Copy link
Author

@brickpop @brickpop
Regarding the gray screen of running App after release, I solved it by recreating the Flutter plug-in project.

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

No branches or pull requests

3 participants