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

Numerous bug fixes for musl and other images. #905

Merged
merged 1 commit into from
Jul 3, 2022

Conversation

Alexhuszagh
Copy link
Contributor

@Alexhuszagh Alexhuszagh commented Jul 3, 2022

Provide qemu-runner that allows native or non-native for any architecture, and install qemu-user binaries for x86 musl images. In addition, create symlinks so dynamically-linked binaries can be run, including for C++, with musl images.

Adding qemu-user runners is also useful for running dynamically-linked x86 binaries, since otherwise they may be unable to find the linked musl libc, and we cannot install it in /lib or /usr/lib due to conflicts with the system.

@Alexhuszagh
Copy link
Contributor Author

Alexhuszagh commented Jul 3, 2022

This is a very preliminary draft (will need a CHANGELOG entry once it's more established), but it aims to do the following:

  • Allow musl images to run dynamically-linked binaries
  • Add qemu-user and native runners for all musl images (very handy for x86)
  • Provide a single script for symlinking all musl libc locations, to ensure it is found.

I also hope this will close #902, but this isn't there yet.

This has fixed C++ support and other issues in a lot of targets, with the only ones failing with C++ or dynamic library support now are:

  • aarch64-unknown-linux-musl
  • mips64el-unknown-linux-muslabi64
    • undefined reference to symbol '__trunctfsf2@@GCC_3.0'
    • error adding symbols: DSO missing from command line
  • mips64-unknown-linux-muslabi64
    • undefined reference to symbol '__trunctfsf2@@GCC_3.0'
    • error adding symbols: DSO missing from command line
  • x86_64-unknown-linux-musl
    • /lib64/ld-linux-x86-64.so.2 (causes segfault)

So, 2 targets link to glibc, and 2 targets have symbol errors in GCC. Those 2 symbol errors are issues with missing symbols from soft-float builtins.

@Alexhuszagh
Copy link
Contributor Author

bors try

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

bors bot commented Jul 3, 2022

try

Build failed:

@Alexhuszagh Alexhuszagh marked this pull request as ready for review July 3, 2022 17:40
@Alexhuszagh Alexhuszagh requested a review from a team as a code owner July 3, 2022 17:40
@Alexhuszagh
Copy link
Contributor Author

I've fixed the bug with CI trying to use qemu-system (It had previously hard-coded qemu-arm, so CROSS_RUNNER was being ignored) for armv7-unknown-linux-gnueabi, so this should be ready for review. All targets pass (well, armv7-unknown-linux-gnueabi should pass).

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.

looks good!

Would it make sense to actually have MUSL_SYSROOT as an ENV instead of simply a build arg?

@Alexhuszagh
Copy link
Contributor Author

looks good!

Would it make sense to actually have MUSL_SYSROOT as an ENV instead of simply a build arg?

If so we should probably prefix it as CROSS_MUSL_SYSROOT, but absolutely.

Provide `qemu-runner` that allows native or non-native for any architecture, and install `qemu-user` binaries for x86 musl images. In addition, create symlinks so dynamically-linked binaries can be run, including for C++, with musl images.

Adding `qemu-user` runners is also useful for running dynamically-linked x86 binaries, since otherwise they may be unable to find the linked musl libc, and we cannot install it in `/lib` or `/usr/lib` due to conflicts with the system.
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 Jul 3, 2022

Build succeeded:

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.

2 participants