Re: dex2oatd fails due to unexpected mmap address

177 views
Skip to first unread message

Michael Goffioul

unread,
Jul 28, 2022, 2:32:25 PMJul 28
to android-...@googlegroups.com
I forgot to mention the Android version is 7.1.2.

On Tue, Jul 26, 2022 at 2:34 PM Michael Goffioul <michael....@gmail.com> wrote:
Hi,

I've been compiling an arm64 firmware (for AMLogic chipset) on the same Fedora-based system for a couple of years now. Today, after rebuilding from scratch, I faced the following error. Would anybody have any insight on what is going on?

[100% 2/2] build out/target/product/p212/obj/APPS/AppInstaller_intermediates/oat/arm64/package.odex
FAILED: /bin/bash -c "(mkdir -p out/target/product/p212/obj/APPS/AppInstaller_intermediates/oat/arm64/ && rm -f out/target/product/p212/obj/APPS/AppInstaller_intermediates/oat/arm64/package.odex ) && (find out/target/common/obj/APPS/AppInstaller_intermediates/ -maxdepth 1 -name \"classes*.dex\" | sort | xargs zip -qjX out/target/product/p212/obj/APPS/AppInstaller_intermediates/oat/arm64/package.odex ) && (mv out/target/product/p212/obj/APPS/AppInstaller_intermediates/oat/arm64/package.odex out/target/product/p212/obj/APPS/AppInstaller_intermediates/oat/arm64/package.odex.input ) && (rm -f out/target/product/p212/obj/APPS/AppInstaller_intermediates/oat/arm64/package.odex ) && (mkdir -p out/target/product/p212/obj/APPS/AppInstaller_intermediates/oat/arm64/ ) && (ANDROID_LOG_TAGS=\"*:e\" out/host/linux-x86/bin/dex2oatd --runtime-arg -Xms64m --runtime-arg -Xmx512m --runtime-arg -classpath --runtime-arg \"&\" --boot-image=out/target/product/p212/dex_bootjars/system/framework/boot.art --dex-file=out/target/product/p212/obj/APPS/AppInstaller_intermediates/oat/arm64/package.odex.input --dex-location=/system/app/AppInstaller/AppInstaller.apk --oat-file=out/target/product/p212/obj/APPS/AppInstaller_intermediates/oat/arm64/package.odex --android-root=out/target/product/p212/system --instruction-set=arm64 --instruction-set-variant=generic --instruction-set-features=default --include-patch-information --runtime-arg -Xnorelocate --no-generate-debug-info --abort-on-hard-verifier-error --no-inline-from=core-oj.jar   --compile-pic ) && (rm out/target/product/p212/obj/APPS/AppInstaller_intermediates/oat/arm64/package.odex.input )"
dex2oatd E 449109 449109 art/runtime/gc/heap.cc:324] Could not create image space with image file 'out/target/product/p212/dex_bootjars/system/framework/boot.art'. Attempting to fall back to imageless running. Error was: Failed to load /system image 'out/target/product/p212/dex_bootjars/system/framework/arm64/boot-framework.art': Failed to mmap at expected address, mapped at 0x7fdaa8a00000 instead of 0x70514000
dex2oatd E 449109 449109 art/runtime/gc/heap.cc:324] Attempted image: out/target/product/p212/dex_bootjars/system/framework/boot-framework.art
dex2oatd E 449109 449109 art/runtime/runtime.cc:1050] Dex file fallback disabled, cannot continue without image.
dex2oatd E 449109 449109 art/dex2oat/dex2oat.cc:2232] Failed to create runtime
ninja: build stopped: subcommand failed.

Thanks,
Michael.

Michael Goffioul

unread,
Jul 28, 2022, 2:32:25 PMJul 28
to android-...@googlegroups.com
This seems to be due to the kernel update on the build host, which switched from 5.17 to 5.18. Because the error is related to unexpected mmap address, and there was a recent kernel update on the Fedora build host, and after suspecting everything else, I ended up suspecting the kernel itself. I rebooted into the previous 5.17 kernel, and the error went away.

It would be nice if the Android devs could come up with a workaround that does not involve not upgrading the build host kernel. I'm happy to test any proposed solution.

Thanks,
Michael.

Michael Goffioul

unread,
Jul 28, 2022, 2:32:25 PMJul 28
to android-...@googlegroups.com

Dan Willemsen

unread,
Jul 28, 2022, 2:58:50 PMJul 28
to android-...@googlegroups.com
Have you tried to reproduce with a newer version of Android? Android 7 is about 6 years old, so I wouldn't be expecting any changes to it.

You may want to talk to your distribution, this could be a configuration change during the kernel upgrade. Breaking existing binaries is something the kernel generally attempts to avoid.

- Dan

--
--
You received this message because you are subscribed to the "Android Building" mailing list.
To post to this group, send email to android-...@googlegroups.com
To unsubscribe from this group, send email to
android-buildi...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-building?hl=en

---
You received this message because you are subscribed to the Google Groups "Android Building" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-buildi...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-building/CAB-99LsRWE%3D62Q9VOVD9ok4oSvwVdUYCB%3D7NRnXn_QM-QjMh2g%40mail.gmail.com.

Michael Goffioul

unread,
Aug 24, 2022, 5:50:40 PMAug 24
to android-...@googlegroups.com
On Thu, Jul 28, 2022 at 8:58 PM 'Dan Willemsen' via Android Building <android-...@googlegroups.com> wrote:
Have you tried to reproduce with a newer version of Android? Android 7 is about 6 years old, so I wouldn't be expecting any changes to it.

You may want to talk to your distribution, this could be a configuration change during the kernel upgrade. Breaking existing binaries is something the kernel generally attempts to avoid.

I agree. So the most probable conclusion is that the problem comes from the Android side, not the kernel/distribution side.

Michael Goffioul

unread,
Aug 24, 2022, 5:50:43 PMAug 24
to android-...@googlegroups.com
After adding debug lines in dex2oatd source code, it appears the error comes from this line: https://cs.android.com/android/platform/superproject/+/android-7.1.2_r1:art/runtime/mem_map.cc;l=891 where addr=0x70514000 and flags=00000002. Correct me if I'm wrong, but given that the mmap flags do not include MAP_FIXED, the provided address is only interpreted as a hint, there's no guarantee that the mapped address will be the one provided as argument.

Dan Willemsen

unread,
Sep 28, 2022, 2:52:45 PMSep 28
to android-...@googlegroups.com
You can try this change, which was backported to Android 9 (P): https://android-review.googlesource.com/c/platform/art/+/2226578/

- Dan

--
--
You received this message because you are subscribed to the "Android Building" mailing list.
To post to this group, send email to android-...@googlegroups.com
To unsubscribe from this group, send email to
android-buildi...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-building?hl=en

---
You received this message because you are subscribed to the Google Groups "Android Building" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-buildi...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages