-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Cannot start servo on android #1495
Comments
Somebody who wants to compile android properly, plz refer below. |
0xdeadbaad is used by the Android libc abort() function when native heap corruption is detected. |
Using a bit of hackery, we're definitely getting the
Break on
|
OK, this is the cause of the task failure: |
With help from @acrichto I was able to work around this. Basically, the problem is that we are unable to load the crate map and so libuv crashes with the error above. The code should just work when we statically link, but I also have some patches to libstd that fix it. The new issue is:
I'll look into it more this weekend as time permits. |
OK, we can load now: Loading remote URLs does not work yet because of:
|
I did not try to load remote URL since I could not find proper way to set system permission to servo. |
@larsbergstrom Great works! Can you share the patch to fix them? I'm not sure that your problem is caused by android permission or not. Until now, we actually implemented servo-android port with local pages. I think it may be simple problem if rust-arm works well. We'll also look into it. |
It looks that "#link(name = "XXX")" and #[link_args="-lXXX" are different each other in internal operation on android. |
@aydinkim https://gist.github.com/larsbergstrom/8513764 There are two main diffs:
|
@larsbergstrom Thanks. Ok. I understood it. There are duplicated libglut* actually so that it causes liking errors. As you know we need library pointer before rust main trigger because of glut callbacks linking. Until now, we changed hash of library in jni/main.cpp of servo-android-glue by manual, we need to change it more conveniently. I'll try to find a better solution. |
@larsbergstrom Just on more question, crate map is used only for logging? I remember that there was no runtime crash even if rust runtime doesn't have any crate maps. In my opinion, It is better way that we can launch the program entry in certain library regardless of crate maps presence. Of course the best solution would be automatic create map maker from linked libraries without no hard coding. |
According to @acrichto, the crate map is required by the new libuv framework used by the runtime. If the crate map is not found, then the runtime falls back to a different I/O manager. That I/O manager crashes immediately on Android. I did not check into why, but instead fixed the crate map (since it also fixed logging, which I wanted). |
@larsbergstrom ok. I modified servo-android-glue. Probably you don't need to know exact name of libglut anymore with this commit - https://github.com/webconvforge/servo-android-glue/commit/d1b83336c8c15006f4bf600f28e0e763c4b03c36 And I had tried to run servo-android according to your diff(https://gist.github.com/larsbergstrom/8513764), I failed due to same error(no crate map). Do you think I need to do something more? |
@aydinkim Did you force all of rust to rebuild (e.g., "touch arm-linux-androideabi/src/compiler/rust/rust-auto-clean-stamp") to get a new libstd and then did the build scripts pick up that .so file and generate a new APK file? I've had trouble sometimes with unreliable rebuilds. |
@larsbergstrom Yeap. I had removed all build directory and rebuilded it. 01-21 10:28:15.100: I/native-activity(6132): go into android_start() I think symbols had been loaded, but orrurs 01-21 10:28:15.110: V/stderr(6132): task '' failed at 'Unhandled condition: io_error: io::IoError{kind: IoUnavailable, desc: "I/O is unavailable", detail: None}', /home/aydin.kim/servo/mozilla/aaa/src/compiler/rust/src/libstd/condition.rs:139 |
@larsbergstrom librustuv is needed now? It seems there is no relation to other libraries. we need to load symbols of librustuv to memory manually? |
I added some logs into crate_map.rs. 12-17 18:23:07.990: V/stdout(4522): Loading libservo.so dl::symbol doesn't work. I will look into it. |
@larsbergstrom I had checked symbols in libservo. Unfortunately crate_map toplevel is not exist actually. Instead of that, just _rust_crate_map_servo is exist. I'm now trying to rebuild after change to that. Let you know if I would be succeeded. |
With some modification like below,
I could have a "_rust_crate_map_toplevel" symbol in the libservo.so But launching was failed with same log.
|
@larsbergstrom In addition, librustuv is not used on android, is it right? I had tried to find but I couldn't. There is no linkage to other libraries at all.. Can you make sure that this is normal or abnormal? Sorry for bother you, but I have fought with this issue all day :( The problem might be from more simple reason that I expected.. |
@aydinkim I definitely have the symbol in my binary: https://gist.github.com/larsbergstrom/8478915#file-gistfile1-txt-L707 The only other thing I can think of is that I used the android-18 NDK toolset instead of the android-14 toolset as described in the page that you had created. Can you get a stack backtrace on where that error is coming from? I have some information on it at: https://github.com/mozilla/servo/wiki/Building-for-Android and then you can use |
without modification of rust, it was like below (no toplevel cate map symbol) So I had modified rust for workaround.
Finally I also have that in libservo. In addition, I currently use android API-18 and ndk r9. So you mean you don't have any more changes compared to what you posted to me before? |
If the |
@larsbergstrom I'm using ndk version below. But I will make sure that again. |
I think I found it - I have a diff here:
|
@larsbergstrom With glancing at rust, it seems similar to my rust code change. Possibly It might be used in llvm.. Anyway I'm trying to rebuild with fix. let you know the result after rebuilded. |
@aydinkim That makefile change is in the servo makefile. It causes rust to emit a crate map in the library libservo-whatever.so. |
@larsbergstrom Yes. I mean it seems almost same(logically) with my rust modification stuffs before. I couldn't find any other use case of "gen_crate_map". And the result are same. Found _rust_crate_map_toplevel, and crashed with same error logs unfortunately.
and,
Should I change the change ndk version to r9b? |
@larsbergstrom Could you please send me your libservo binary? I tried to build with ndk r9c, I had failed.I want to look into the binary |
Ok. we need to add some code into servo.rc
|
The problem is that Rust usually attempts to dynamically inject libuv into the process, but this does not work on Android. This tip was provided in the conversation at: |
@aydinkim are you planning to land these extra changes in the related modules, or should I attempt to do so? I am trying to get the related Rust bug fixed (about the crate map), but we will need all of these other changes landed as well in order to start working on Android buildbot support for Servo. |
@larsbergstrom If it doesn't bother you too much, why not? I just have hesitated it because I cannot catch up the rust changes so far. I think we should update rust-mozjs and servo-android-glue. |
@aydinkim OK, if you do not open the PRs yourself, I will create PRs for those two modules tomorrow. Thanks! |
I opened a PR in servo-android-glue with both your prior changes and my changes. I will check on rust-mozjs once I start in on the Rust upgrade. Hopefully the changes they have been making with libstdc++ and linker flags have fixed the issue we were having. |
Fixed by #2070 |
With some fixes, I can reached android_start finally with newer rust.
But see error messages below.
12-17 12:50:58.160: I/native-activity(2341): go into android_start()
12-17 12:50:58.160: I/stderr(2341): warning: RUST_LOG set, but no crate map found.
12-17 12:50:58.160: A/libc(2341): Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1), thread 2358 (le.ServoAndroid)
12-17 12:50:58.160: I/stderr(2341): task 'Constellation' failed at 'task '' failed at 'Unhandled condition: io_error: io::IoError{kind: IoUnavailable, desc: "I/O is unavailable", detail: None}', /home/aydin.kim/servo/mozilla/aaa/src/compiler/rust/src/libstd/condition.rs:Unhandled condition: io_error: io::IoError{kind: IoUnavailable, desc: "I/O is unavailable", detail: None}', /home/aydin.kim/servo/mozilla/aaa/src/compiler/rust/src/libstd/condition.rs:139
These messages are same case as with previous version of rust.
It had occured after rustuv change on 30 Oct.
In the past, The solution was rewinding the rust version back to before.
I expected that this problem would be solved with rust upgrade, but it doesn't.
Any ideas?
The text was updated successfully, but these errors were encountered: