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

Reduce Android image sizes. #747

Merged
merged 1 commit into from
Jun 3, 2022
Merged

Conversation

Alexhuszagh
Copy link
Contributor

Delete unused toolchains to save ~600MB in our total image sizes. This is done by removing the toolchains for other targets in /android-ndk/sysroot/usr/lib/.

Closes #739.

@Alexhuszagh Alexhuszagh requested a review from a team as a code owner June 3, 2022 02:29
@otavio
Copy link
Contributor

otavio commented Jun 3, 2022

bors r+

@bors
Copy link
Contributor

bors bot commented Jun 3, 2022

Merge conflict.

@otavio
Copy link
Contributor

otavio commented Jun 3, 2022

@Alexhuszagh can you rebase?

@Alexhuszagh Alexhuszagh force-pushed the android_minimal branch 2 times, most recently from 037fb19 to 9e87b5f Compare June 3, 2022 12:57
Copy link
Member

@Emilgardis Emilgardis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bors r=otavio,emilgardis

bors bot added a commit that referenced this pull request Jun 3, 2022
747: Reduce Android image sizes. r=otavio,emilgardis a=Alexhuszagh

Delete unused toolchains to save ~600MB in our total image sizes. This is done by removing the toolchains for other targets in `/android-ndk/sysroot/usr/lib/`.

Closes #739.

Co-authored-by: Alex Huszagh <ahuszagh@gmail.com>
@bors
Copy link
Contributor

bors bot commented Jun 3, 2022

Build failed:

@Alexhuszagh Alexhuszagh marked this pull request as draft June 3, 2022 13:52
@Alexhuszagh
Copy link
Contributor Author

Alexhuszagh commented Jun 3, 2022

Ok this has issues for aarch64 and i686, not sure why but I'm marking as a draft until I fix this. I checked armv7 and arm, so I assumed this was working.

Oh right, we have the following in the Dockerfiles:

RUN /android-ndk.sh x86 28
RUN /android-ndk.sh arm64 28

Delete unused toolchains to save ~600MB in our total image sizes. This is done by removing the toolchains for other targets in `/android-ndk/sysroot/usr/lib/`.

Closes cross-rs#739.
@Alexhuszagh
Copy link
Contributor Author

bors try --target android

bors bot added a commit that referenced this pull request Jun 3, 2022
@Alexhuszagh
Copy link
Contributor Author

Ok I've fixed these issues by converting the provided architecture to the triple prefix:

    local triple_arch="${arch}"
    case "${arch}" in
      arm64)
        triple_arch="aarch64"
        ;;
      x86)
        triple_arch="i686"
        ;;
    esac
    triples=(...)
    for triple in "${triples[@]}"; do
      if ! [[ "${triple}" =~ ^"${triple_arch}".* ]]; then
        rm -rf "/android-ndk/sysroot/usr/lib/${triple}"
      fi
    done

Copy link
Member

@Emilgardis Emilgardis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bors r+

@bors
Copy link
Contributor

bors bot commented Jun 3, 2022

try

Build succeeded:

@bors
Copy link
Contributor

bors bot commented Jun 3, 2022

Build succeeded:

@bors bors bot merged commit ee4df2b into cross-rs:main Jun 3, 2022
@Emilgardis Emilgardis added this to the v0.2.2 milestone Jun 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reduce Android Image Sizes
3 participants