Skip to content

[NativeAOT] How to compile linux-musl-arm64 shared libraries on Ubuntu( x64) #106029

Closed

Description

@CeSun

I want to compile a shared library for the arm64 platform that libc is musl.
But I only have ubuntu (wsl) on x86
I found a cross-platform compiler: aarch64-linux-musl-cross
However, dotnet's publish command does not recognize the compiler, it seems that it only recognizes clang and gcc

image
image

Activity

  1. added
    untriaged
    on Aug 6, 2024
  2. dotnet-policy-service commented on Aug 6, 2024

    @dotnet-policy-service
    Contributor

    Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas
    See info in area-owners.md if you want to be subscribed.

  3. MichalStrehovsky commented on Aug 7, 2024

    @MichalStrehovsky
    Member

    If you have a correctly configured cross toolchain, adding -p:CppCompilerAndLinker=aarch64-linux-musl-gcc should be all that's needed.

    You might want to also look at https://www.nuget.org/packages/PublishAotCross#readme-body-tab.

  4. added
    question
    on Aug 7, 2024
  5. added this to the Future milestone on Aug 7, 2024
  6. removed
    untriaged
    on Aug 7, 2024
  7. CeSun commented on Aug 7, 2024

    @CeSun
    ContributorAuthor

    If you have a correctly configured cross toolchain, adding -p:CppCompilerAndLinker=aarch64-linux-musl-gcc should be all that's needed.

    You might want to also look at https://www.nuget.org/packages/PublishAotCross#readme-body-tab.

    Thank you.
    PublishAotCross is a good project, But I encountered a new problem, maybe I need add an issue?
    EXEC : error : unsupported linker arg: -e0x0
    QQ_1723006528549

  8. MichalStrehovsky commented on Aug 7, 2024

    @MichalStrehovsky
    Member

    PublishAotCross is a good project, But I encountered a new problem, maybe I need add an issue?

    Can you try finding clang.cmd in your NuGet package cache (the contents should look like this: https://github.com/MichalStrehovsky/PublishAotCross/blob/master/src/clang.cmd) and add set args=%args:-Wl,-e0x0 =% after line 20? If that works, we can just upstream it to PublishAotCross.

  9. CeSun commented on Aug 7, 2024

    @CeSun
    ContributorAuthor

    PublishAotCross is a good project, But I encountered a new problem, maybe I need add an issue?

    Can you try finding clang.cmd in your NuGet package cache (the contents should look like this: https://github.com/MichalStrehovsky/PublishAotCross/blob/master/src/clang.cmd) and add set args=%args:-Wl,-e0x0 =% after line 20? If that works, we can just upstream it to PublishAotCross.

    It worked!

  10. added
    in-pr
    on Aug 7, 2024
  11. added a commit that references this issue on Aug 8, 2024
    9bd900d
  12. locked and limited conversation to collaborators on Sep 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-NativeAOT-coreclrin-prquestion

    Type

    No type

    Projects

    • Status
      No status

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions