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

Updates scripts for LLVM/Clang versions that are double digits #2386

Merged
merged 1 commit into from
Jun 24, 2021

Conversation

Thefrank
Copy link
Contributor

TL;DR:
Version additions for LLVM/CLANG + fix typo. Should be low impact.

Overview:

eng/build.sh

  • FreeBSD (and other BSD-like) return amd64 for intel/amd 64bit from the uname command issued.
  • I had to dig around on this one, but$lowerI appears to be left over from when some of the scripts were consolidated and a new function was made to lowercase things

eng/common/native/find-native-compiler.sh

  • Add new cases for double digit compilers that don't use dot revision (e.g., 10, 11, 12)
  • Added detection for the newer versions added in case

eng/gen-buildsys-clang.sh

  • Same as second part of find-native-compiler.sh

Unnecessarily detailed stackexchange-like explanation:

uname does not have many POSIX compliant options that can be passed to it. So trying to make the script use only POSIX complaint uname options and understand what is returned by them would be too much of a hassle; output can be different from Linux distro to distro and even stranger outside the world of Linux even if the same uname -option is passed! The script tries to work around quirks in different Linux distros as it is. A simple |amd64 is added to the x86_64 case to cover how FreeBSD returns the uname issued to it.

Before the changes noted above, the script would work under most environments without issue unless someone tried to pass -clangx.y. This would fail as $lowerI evaluated to, um, empty string(?)...empty variable(?)... NULL(?). Fallback would use command -v clang and this is the compiler that ships with the base OS for most BSD-like (and the odd linux distro). This is unacceptable on FreeBSD (and likely other BSD) as the compiler that ships with the OS is for the OS and not for the user. The update also handles cases like clang11 or clang-11 but the user still must use -clangx.y (e.g.,-clang11.0). The fallback is maintained as this behavior was there originally and is likely acceptable on other OSes. The detection of newer non-dotted (typically double digit) LLVM/CLANG are placed at the end of the if/else block to respect preference for dotted revision LLVM/CLANG (e.g., 3.8, 3.9)

Finally, this does not fix actually building FOR FreeBSD as I thought it would be cleaner to separate the detection code from the FreeBSD work. That will, hopefully, be coming later.

@dnfadmin
Copy link

dnfadmin commented Jun 23, 2021

CLA assistant check
All CLA requirements met.

@mikem8361 mikem8361 merged commit 250740a into dotnet:main Jun 24, 2021
@Thefrank Thefrank deleted the newer-compilers branch June 24, 2021 23:38
@github-actions github-actions bot locked and limited conversation to collaborators Jan 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants