Skip to content

ICU-23151 Fix building on Windows using msbuild with clang-cl. #3537

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

KaylinFinke
Copy link

@KaylinFinke KaylinFinke commented Jun 28, 2025

When building the latest release 77.1 on Windows from the command line I encountered two issues when using Clang-CL as a compiler (cl compiled fine). I have described them in the ticket, but to reiterate the first is a failure to generate sbr files in debug builds and the second is nullptr passed to strcmp when building data in x64 builds.

For the sbr files, I have removed browse information from the solution. If this is not an acceptable solution I am happy to revisit it, but my understanding is browse information isn't needed anymore per reading this documentation https://learn.microsoft.com/en-us/cpp/build/reference/creating-an-dot-sbr-file and the option could be fairly safely removed.

The second issue I fixed by piggy backing on the existing dll architecture option. This appears to currently specify an architecture for a building a data file instead of letting the system auto-detect it and seemed harmless to always perform. I Updated the code to store off this architecture, and pass it through to writeObjectCode allowing Clang-CL builds to generate the appropriate data file. I updated the data generation code to handle ARM in addition since that option was missing and couldn't be worse than the previous undefined behavior, and preserved support for lowercase options used by --cpu-arch with genccode. I did not add a new option as -c was already used, and having two different ways to specify the architecture seemed more bug prone, but I am open to suggestions.

I compiled the project using the 8 variants of: Win32/x64, Debug/Release, and MSVC/Clang-CL as well as ran the tests for all these configurations which passed. I also compiled all 8 of these variants to ensure Win32 Release Clang-CL as well as all 4 MSVC configurations passed without the change, while the other 3 Clang-CL variants failed to build.

I was not able to test ARM / ARM64 though invocations of the tool did not change in the makedata.mak scripts for these platforms. My reason for adding the ARM variant is it can't be worse than the previous code here which if reached would have had the same issue with strcmp.

Checklist

  • Required: Issue filed: ICU-23151
  • Required: The PR title must be prefixed with a JIRA Issue number. Example: "ICU-1234 Fix xyz"
  • Required: Each commit message must be prefixed with a JIRA Issue number. Example: "ICU-1234 Fix xyz"
  • Issue accepted (done by Technical Committee after discussion)
  • Tests included, if applicable
  • API docs and/or User Guide docs changed or added, if applicable

Add config all 4 windows platforms instead of just ARM.

Store off CPU Arch for use with writeObjectCode

Change checkCpuArchitecture to accept uppercase option values. Preserve lowercase option values for compatibility with previous versions in case people are using these options.
Removed browse information which isn't needed for modern Visual Studio.
@CLAassistant
Copy link

CLAassistant commented Jun 28, 2025

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants