Skip to content

Fatal error: 'elf.h' file not found on macOS 10.15 #1744

Closed
@asbjornu

Description

@asbjornu

In Homebrew/homebrew-core#60929 I've got dotnet to build for macOS 10.13 and 10.14, but on 10.15 the build fails with the following error:

/tmp/dotnet-20200912-76027-168kcki/artifacts/src/coreclr.f897710bc4efe6a046068fde0acf641667a8fff5/src/pal/src/exception/remote-unwind.cpp:68:10: fatal error: 'elf.h' file not found
#include <elf.h>
         ^~~~~~~

The end result reports something completely unrelated, but I suspect it's the missing elf.h file causing problem and not this:

  make: *** [all] Error 2
  Failed to build CoreCLR component.
  
  'coreclr' failed during build.
  See '/private/tmp/dotnet-20200912-4021-l77t2w/artifacts/logs/coreclr.log' for more information.
  'corefx' failed during build.
  'msbuild' failed during build.
  'known-good' failed during build.

Build FAILED.

/private/tmp/dotnet-20200912-4021-l77t2w/packages/restored/microsoft.dotnet.arcade.sdk/1.0.0-beta.19359.6/tools/ProjectLayout.props(8,3): warning MSB4011: "/private/tmp/dotnet-20200912-4021-l77t2w/packages/restored/microsoft.dotnet.arcade.sdk/1.0.0-beta.19359.6/tools/RepoLayout.props" cannot be imported again. It was already imported at "/private/tmp/dotnet-20200912-4021-l77t2w/packages/restored/microsoft.dotnet.arcade.sdk/1.0.0-beta.19359.6/tools/Build.proj (52,3)". This is most likely a build authoring error. This subsequent import will be ignored. 
/private/tmp/dotnet-20200912-4021-l77t2w/repos/Directory.Build.targets(296,5): error MSB3073: The command "/private/tmp/dotnet-20200912-4021-l77t2w/artifacts/src/coreclr.f897710bc4efe6a046068fde0acf641667a8fff5//build.sh x64 Release skiptests -ignoreWarnings -skipmanagedtools -skiprestore -nopgooptimize msbuildonunsupportedplatform cmakeargs -DCLR_CMAKE_USE_SYSTEM_LIBUNWIND=TRUE /bl /p:ILLinkTrimAssembly=false /p:CheckCDefines=false /p:PackagesDir=/private/tmp/dotnet-20200912-4021-l77t2w/packages/restored/ /p:ContinuousIntegrationBuild=true /p:VersionSuffix="servicing" -warnAsError:0 /v:minimal  /p:DotNetPackageVersionPropsPath=/private/tmp/dotnet-20200912-4021-l77t2w/artifacts/obj/x64/Release/PackageVersions.props /p:DotNetRestoreSourcePropsPath=/private/tmp/dotnet-20200912-4021-l77t2w/artifacts/obj/x64/Release/RestoreSources.props >> /private/tmp/dotnet-20200912-4021-l77t2w/artifacts/logs/coreclr.log 2>&1" exited with code 1. [/private/tmp/dotnet-20200912-4021-l77t2w/repos/coreclr.proj]
    1 Warning(s)
    1 Error(s)

Here's the coreclr.log file for inspection.

I don't have any good ideas how to resolve this. Since Homebrew's libelf formula does not seem to bundle elf.h, taking a dependency on libelf won't help. There's also no easy way to make dependencies conditional on the macOS version afaik.

As suggested in the same SO thread, there's a possibility to source elf.h from Apple's dtrace, but even better would be if elf.h was provided out of the box from source-build itself somehow.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions