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

Fix macOS arm64 signature corruption at install #46452

Closed

Conversation

janvorli
Copy link
Member

@janvorli janvorli commented Dec 29, 2020

Using install(TARGET...) for copying built binaries into the artifacts/bin/
results in cmake calling install_name_tool on the binary to set its id, which
invalidates the code signature on macOS arm64.
We were using install(TARGET...) only in the installer, libraries and coreclr
use install(PROGRAMS...).
This change fixes the problem by replacing the install(TARGET...) by
install(PROGRAMS...). Even though the install(TARGET...) is the intended
way to install executables produced by the build in cmake, it is meant for
installing the binaries to their final location (like /usr/local/bin etc).
But we don't use install in this way, we use it to copy the result into our
artifacts/bin/... subfolder where the path doesn't match the final binary
location in any way. So the extra massaging that cmake does for install(TARGET...
is useless for our purposes anyways.

Close #46369

Using `install(TARGET...)` for copying built binaries into the artifacts/bin/
results in cmake calling install_name_tool on the binary to set its id, which
invalidates the code signature on macOS arm64.
We were using `install(TARGET...)` only in the installer, libraries and coreclr
use `install(PROGRAMS...)`.
This change fixes the problem by replacing the `install(TARGET...)` by
`install(PROGRAMS...)`. Even though the `install(TARGET...)` is the intended
way to install executables produced by the build in cmake, it is meant for
installing the binaries to their final location (like /usr/local/bin etc).
But we don't use install in this way, we use it to copy the result into our
`artifacts/bin/...` subfolder where the path doesn't match the final binary
location in any way. So the extra massaging that cmake does for `install(TARGET...`
is useless for our purposes anyways.
@janvorli janvorli requested a review from sdmaclea December 29, 2020 15:31
@janvorli janvorli self-assigned this Dec 29, 2020
@Dotnet-GitSync-Bot
Copy link
Collaborator

I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label.

@sdmaclea
Copy link
Contributor

/cc @jkoritzinsky

@sdmaclea
Copy link
Contributor

sdmaclea commented Dec 29, 2020

The Windows export libraries are missing with this approach.

.packages\microsoft.dotnet.build.tasks.packaging\6.0.0-beta.20621.12\build\Packaging.targets(1250,5): 
error : (NETCORE_ENGINEERING_TELEMETRY=Build) Error when creating nuget lib package from F:\workspace\_work\1\s\artifacts\packages\Debug\specs\runtime.win-x86.Microsoft.NETCore.DotNetAppHost.nuspec. 
NuGet.Packaging.Core.PackagingException: 
File not found: 'F:\workspace\_work\1\s\artifacts\bin\win-x86.Debug\corehost\nethost.lib'.
   at NuGet.Packaging.PackageBuilder.AddFiles(String basePath, String source, String destination, String exclude)
   at NuGet.Packaging.PackageBuilder.PopulateFiles(String basePath, IEnumerable`1 files)
   at Microsoft.DotNet.Build.Tasks.Packaging.NuGetPack.Pack(String nuspecPath, String nupkgPath, Manifest manifest, Boolean packSymbols) in /_/src/Microsoft.DotNet.Build.Tasks.Packaging/src/NuGetPack.cs:line 253

@janvorli
Copy link
Member Author

The Windows export libraries are missing with this approach.

Hmm, too bad. Let's go your way then but make it more localized. I'll comment on your PR and close this one.

@janvorli janvorli closed this Dec 29, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Jan 28, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Apple Silicon official runtime build unsigned binaries
3 participants