Source-build: coreclr fails to compile on Musl

Created on 13 Nov 2020  路  6Comments  路  Source: dotnet/source-build

Splitting off from #1868, please read there for more context.

On an Alpine Linux edge system using Musl, dotnet currently fails to compile coreclr.

  In file included from /home/bart/Documents/Git/alpine/aports/testing/dotnet/src/source-build-b4d00c370e0a592c26040c74349273c0389509d4/artifacts/src/coreclr.d989459717cbce34262060c4b8b949185033e379/src/pal/src/misc/tracepointprovider.cpp:19:
  In file included from /home/bart/Documents/Git/alpine/aports/testing/dotnet/src/source-build-b4d00c370e0a592c26040c74349273c0389509d4/artifacts/src/coreclr.d989459717cbce34262060c4b8b949185033e379/src/pal/src/include/pal/palinternal.h:620:
  In file included from /usr/bin/../lib/gcc/x86_64-alpine-linux-musl/10.2.1/../../../../include/c++/10.2.1/stdlib.h:30:
  /usr/include/stdlib.h:23:11: error: 'atoll' is missing exception specification 'throw()'
  long long atoll (const char *);
            ^
  /home/bart/Documents/Git/alpine/aports/testing/dotnet/src/source-build-b4d00c370e0a592c26040c74349273c0389509d4/artifacts/src/coreclr.d989459717cbce34262060c4b8b949185033e379/src/pal/inc/pal.h:4224:33: note: previous declaration is here
  PALIMPORT long long int __cdecl atoll(const char *) THROW_DECL;
                                  ^
  1 error generated.
  make[2]: *** [src/pal/src/CMakeFiles/tracepointprovider.dir/build.make:82: src/pal/src/CMakeFiles/tracepointprovider.dir/misc/tracepointprovider.cpp.o] Error 1
  make[1]: *** [CMakeFiles/Makefile2:2362: src/pal/src/CMakeFiles/tracepointprovider.dir/all] Error 2
  make: *** [Makefile:149: all] Error 2
  Failed to build CoreCLR component.

  'coreclr-portable' failed during build.
  See '/home/bart/Documents/Git/alpine/aports/testing/dotnet/src/source-build-b4d00c370e0a592c26040c74349273c0389509d4/artifacts/logs/coreclr-portable.log' for more information.
  'coreclr' failed during build.
  'corefx' failed during build.
  'msbuild' failed during build.
  'known-good' failed during build.

Build FAILED.

This is using Clang 10.0.1 and Musl 1.2.2.

All 6 comments

Triage notes: @PureTryOut are you able to build the dotnet/coreclr (or dotnet/runtime) repo without source-build involved? We think it would be best to try to repro this with a standalone clone and report the problem as a dotnet/runtime issue because they're most familiar with this build.

@crummel, you mentioned remembering this being because of a specific Clang version difference or mismatch, can you try to find that and post here? @dseefeld mentioned we build with Clang 9 in CI currently.

I got pretty much the exact opposite error a while back which I fixed via https://github.com/dotnet/coreclr/pull/28045:

 In file included from /home/omajid/devel/dotnet/coreclr/src/ToolBox/SOS/Strike/strike.cpp:116:
 In file included from /home/omajid/devel/dotnet/coreclr/src/vm/hillclimbing.h:19:
 In file included from /home/omajid/devel/dotnet/coreclr/src/inc/complex.h:16:
 In file included from /usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/math.h:36:
 In file included from /usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/cmath:45:
 In file included from /usr/include/math.h:290:
 /usr/include/bits/mathcalls.h:53:13: error: exception specification in declaration does not match previous declaration
 __MATHCALL (acos,, (_Mdouble_ __x));
             ^
 /home/omajid/devel/dotnet/coreclr/src/pal/inc/pal.h:4395:26: note: previous declaration is here
 PALIMPORT double __cdecl acos(double);
                          ^

It looks like glibc has throw in the function declaration but musl doesn't?

Agreed that this should be sorted out in dotnet/runtime repo first.

are you able to build the dotnet/coreclr (or dotnet/runtime) repo without source-build involved?

I seem to not be able to no, I've reported an issue there. https://github.com/dotnet/runtime/issues/44988

So that particular issue has now been fixed. Now I wonder how I can make source-build use that particular fix. I'd be fine with building git master of dotnet/runtime for now, but I'm not sure how to do that through source-build :thinking:

Now I wonder how I can make source-build use that particular fix.

You can git format-patch -1 <sha of commit> in the runtime repo and put the generated patch in patches/runtime/. source-build applies all patches in patches/$REPO/ when building $REPO.

Ah cool, that is useful. Sadly the patch doesn't apply on the release/3.1 branch (as I expected), so I'm building master for now.

However, Darc seems to segfault now.

[00:33:41.18] Running Darc command: '/home/bart/Documents/Git/source-build/.dotnet/dotnet /home/bart/Documents/Git/source-build/.dotnet/tools/.store/microsoft.dotnet.darc/1.1.0-beta.19568.2/microsoft.dotnet.darc/1.1.0-beta.19568.2/tools/netcoreapp3.0/any/Microsoft.DotNet.Darc.dll clone  --git-dir-folder /home/bart/Documents/Git/source-build/.git/modules/src/ --include-toolset --ignore-repos ";https://dev.azure.com/dnceng/internal/_git/dotnet-optimization;https://dev.azure.com/devdiv/DevDiv/_git/DotNet-Trusted;https://devdiv.visualstudio.com/DevDiv/_git/DotNet-Trusted;https://[email protected]/dnceng/internal/_git/dotnet-optimization;https://dev.azure.com/dnceng/internal/_git/dotnet-core-setup;https://github.com/dotnet/source-build-reference-packages" --debug --azdev-pat bogus --github-pat bogus --depth 0' from working dir /home/bart/Documents/Git/source-build/
  info: Microsoft.DotNet.Darc.Operations.Operation[0]
        Getting a collection of dependencies from 'eng/Version.Details.xml' in repo '/home/bart/Documents/Git/source-build'...
  info: Microsoft.DotNet.Darc.Operations.Operation[0]
        Reading 'eng/Version.Details.xml' in repo '/home/bart/Documents/Git/source-build' and branch ''...
  info: Microsoft.DotNet.Darc.Operations.Operation[0]
        Reading 'eng/Version.Details.xml' from repo '/home/bart/Documents/Git/source-build' and branch '' succeeded!
  dbug: Microsoft.DotNet.Darc.Operations.Operation[0]
        Skipping ignored repo https://github.com/dotnet/source-build-reference-packages (at f041a764460c12af7a3e5ff539a1c411a5262fd3)
  info: Microsoft.DotNet.Darc.Operations.Operation[0]
        Found 28 local dependencies.  Starting deep clone...
  dbug: Microsoft.DotNet.Darc.Operations.Operation[0]
        Starting master copy for https://github.com/dotnet/arcade in /home/bart/Documents/Git/source-build/artifacts/src/arcade with .gitdir /home/bart/Documents/Git/source-build/.git/modules/src/arcade.git
  dbug: Microsoft.DotNet.Darc.Operations.Operation[0]
        Master .gitdir /home/bart/Documents/Git/source-build/.git/modules/src/arcade.git does not exist
  info: Microsoft.DotNet.Darc.Operations.Operation[0]
        Cloning master copy of https://github.com/dotnet/arcade into /home/bart/Documents/Git/source-build/artifacts/src/arcade with .gitdir path /home/bart/Documents/Git/source-build/.git/modules/src/arcade.git
  dbug: Microsoft.DotNet.Darc.Operations.Operation[0]
        Cloning https://github.com/dotnet/arcade to /home/bart/Documents/Git/source-build/artifacts/src/arcade
  Segmentation fault
/home/bart/Documents/Git/source-build/tools-local/init-build.proj(119,5): error MSB3073: The command "/home/bart/Documents/Git/source-build/.dotnet/dotnet /home/bart/Documents/Git/source-build/.dotnet/tools/.store/microsoft.dotnet.darc/1.1.0-beta.19568.2/microsoft.dotnet.darc/1.1.0-beta.19568.2/tools/netcoreapp3.0/any/Microsoft.DotNet.Darc.dll clone  --git-dir-folder /home/bart/Documents/Git/source-build/.git/modules/src/ --include-toolset --ignore-repos ";https://dev.azure.com/dnceng/internal/_git/dotnet-optimization;https://dev.azure.com/devdiv/DevDiv/_git/DotNet-Trusted;https://devdiv.visualstudio.com/DevDiv/_git/DotNet-Trusted;https://[email protected]/dnceng/internal/_git/dotnet-optimization;https://dev.azure.com/dnceng/internal/_git/dotnet-core-setup;https://github.com/dotnet/source-build-reference-packages" --debug --azdev-pat bogus --github-pat bogus --depth 0 --repos-folder /home/bart/Documents/Git/source-build/artifacts/src/" exited with code 139.

Build FAILED.

/home/bart/Documents/Git/source-build/packages/restored/microsoft.dotnet.arcade.sdk/5.0.0-beta.20426.4/tools/ProjectLayout.props(8,3): warning MSB4011: "/home/bart/Documents/Git/source-build/packages/restored/microsoft.dotnet.arcade.sdk/5.0.0-beta.20426.4/tools/RepoLayout.props" cannot be imported again. It was already imported at "/home/bart/Documents/Git/source-build/packages/restored/microsoft.dotnet.arcade.sdk/5.0.0-beta.20426.4/tools/Build.proj (49,3)". This is most likely a build authoring error. This subsequent import will be ignored. 
/home/bart/Documents/Git/source-build/tools-local/tasks/Microsoft.DotNet.SourceBuild.Tasks.XPlat/DownloadFileSB.cs(397,35): warning CS0108: 'DownloadFileSB.CustomHttpRequestException.StatusCode' hides inherited member 'HttpRequestException.StatusCode'. Use the new keyword if hiding was intended. [/home/bart/Documents/Git/source-build/tools-local/tasks/Microsoft.DotNet.SourceBuild.Tasks.XPlat/Microsoft.DotNet.SourceBuild.Tasks.XPlat.csproj]
/home/bart/Documents/Git/source-build/tools-local/init-build.proj(119,5): error MSB3073: The command "/home/bart/Documents/Git/source-build/.dotnet/dotnet /home/bart/Documents/Git/source-build/.dotnet/tools/.store/microsoft.dotnet.darc/1.1.0-beta.19568.2/microsoft.dotnet.darc/1.1.0-beta.19568.2/tools/netcoreapp3.0/any/Microsoft.DotNet.Darc.dll clone  --git-dir-folder /home/bart/Documents/Git/source-build/.git/modules/src/ --include-toolset --ignore-repos ";https://dev.azure.com/dnceng/internal/_git/dotnet-optimization;https://dev.azure.com/devdiv/DevDiv/_git/DotNet-Trusted;https://devdiv.visualstudio.com/DevDiv/_git/DotNet-Trusted;https://[email protected]/dnceng/internal/_git/dotnet-optimization;https://dev.azure.com/dnceng/internal/_git/dotnet-core-setup;https://github.com/dotnet/source-build-reference-packages" --debug --azdev-pat bogus --github-pat bogus --depth 0 --repos-folder /home/bart/Documents/Git/source-build/artifacts/src/" exited with code 139.
    2 Warning(s)
    1 Error(s)
Was this page helpful?
0 / 5 - 0 ratings