-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Adhoc codesign corrupt signatures #46435
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
Conversation
|
Tagging subscribers to this area: @ViktorHofer Issue DetailsFor these 8 libraries, cmake generates a This corrupts the adhoc signature automatically added by the XCode 12 linker. This PR inserts code like the following after the above code to repair the signature. This is at least a reasonable interim fix for #46369 I think Fixes #46369
|
|
Let me take a quick look at why the CMAKE_INSTALL_DO_STRIP is set. I would prefer fixing the cause instead of the symptoms. |
|
8 was a miscount. There are actually 9 libraries with corrupt signatures. Many of them are for testing only. There are three Most libraries/programs have the strip code in their |
|
You may be right and the issue is caused by the install_name_tool. There is a comment in cmake sources that explains that this tool is invoked in case the build tree and install tree use different path components of the install_name field: Looking at one of the libraries, it gets built in However, the strange thing is that on x64 macos, the binaries signatures are not corrupted. So maybe the issue is a bug in the version of the install_name_tool present on the Apple Silicon device. I have verified that crossbuilding for arm64 on the same x64 mac gets the corrupted signatures while the x64 build is correct. Investigating that further on, it seems to me that the signatures are broken for libraries that are installed using Invocations of install_clr in the coreclr work fine, because the install_clr internally uses Reading the cmake install command doc seems to explain why there is a difference. Install PROGRAMS is meant to install executable things that are not targets, so these would be scripts or externally produced executables. I think that's why cmake doesn't try to fix the install name for these. So it looks like binaries that are not affected are in fact installed in an "incorrect" way. However, we use the install in a way that's different from the intended usage. The intended usage is to install the build result to the final location (e.g. /usr/local/bin etc). But we (mis)use it to install it to our "bin" subdirectories where the path doesn't correspond to the final path on the device. I guess that may be the reason we use It seems to me that we should fix the issue by using |
|
@sdmaclea Since the alternative way didn't work for the libraries from the installer repo, let's use your way. But I would like to make the change more localized. I'd change the superpmi stuff handling the way of my now closed PR and call the |
|
I couldn't get generator expressions to work so it was difficult to generalize my approach. Therefore this took a form closer to @janvorli 's proposal this morning. |
|
@janvorli PTAL |
janvorli
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you!
For these 9 libraries, cmake generates a
cmake_install.cmakefile which includes the code below. (I don't really understand why this only affects 8 libraries).This corrupts the adhoc signature automatically added by the XCode 12 linker.
This PR inserts code like the following after the above code to repair the signature.
This is at least a reasonable interim fix for #46369
I think
install(CODE ...)orinstall(SCRIPT ...)is the right approach to fix this type of issue. I couldn't get generator expressions$<TARGET_FILE:target>to work, so I hardcoded the lib prefix and suffix. I think since this is OSX I suspect it should be OK.Fixes #46369