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

Default compiler is misidentified on OpenBSD #201

Closed
ararslan opened this issue May 11, 2018 · 12 comments
Closed

Default compiler is misidentified on OpenBSD #201

ararslan opened this issue May 11, 2018 · 12 comments

Comments

@ararslan
Copy link
Contributor

In the configure script, having GCC on the user's PATH takes precedence over Clang or cc. This ends up picking up OpenBSD's default GCC 4.2.1 installation, which is too old to build BLIS. GCC is actually no longer the default compiler on OpenBSD; cc now points to clang as of OpenBSD 6.2.

This poses a subtly different problem on FreeBSD, where Clang is the default compiler as of FreeBSD 11.0 and GCC is no longer installed by default. If someone installs GCC from the Ports Collection then reconfigures BLIS without specifying CC=, they will suddenly be using GCC instead of Clang.

It seems like the best course of action across all platforms would be to check cc first rather than last, and fall back to looking for GCC or Clang if that fails.

@devinamatthews
Copy link
Member

One possible problem is that using cc will pick up the system compiler on macOS (which is a problem for homebrew users who would prefer gcc or non-Apple clang) and on Linux (where a user-built or -loaded compiler will be skipped). I see three options:

  1. Pick the "least bad" ordering and stick with it.
  2. Use different ordering for different operating systems.
  3. Detect all compilers and pick the "best" one.

@jeffhammond
Copy link
Member

On Mac, BLIS is doing the right thing, because the system compiler is crippled (e.g. has no OpenMP). For OpenBSD, we should prioritize cc over compilers PATH.

@fgvanzee
Copy link
Member

Thanks for breaking it down for us, Devin. Also, thanks for your suggestion, Jeff.

I've never used OpenBSD, nor do I have access to a system with it installed. Can someone tell me if we can rely on uname to detect OpenBSD, and if so, what is the expected output of uname -s? Is it simply OpenBSD?

@ararslan
Copy link
Contributor Author

Yes, uname -s is OpenBSD on OpenBSD.

@fgvanzee
Copy link
Member

@ararslan Okay, give 55ebf24 a shot. The normal search list/order is now gcc clang cc, except on OpenBSD, where it is cc gcc clang. (And if CC is set, it is added to the beginning of the search list automatically.)

@ararslan
Copy link
Contributor Author

Any chance it could be cc clang gcc (Clang before GCC) on both OpenBSD and FreeBSD?

@ararslan
Copy link
Contributor Author

Looks like 55ebf24 fixes this on OpenBSD. Thanks!

@fgvanzee
Copy link
Member

@ararslan Yes, I will change it to cc clang gcc for OpenBSD and FreeBSD.

@fgvanzee
Copy link
Member

Okay, try 9dbce16.

@devinamatthews
Copy link
Member

Is cc updated when a newer version of clang is installed (via ports?)? If not, then perhaps clang gcc cc would make the most sense on *BSD (or gcc last).

@ararslan
Copy link
Contributor Author

No, cc always points to the system's default compiler, which remains static for each version of the OS. The same is true of clang, at least on FreeBSD (with which I'm more familiar than OpenBSD but I assume they're the same in this regard). On FreeBSD, when you install a new version of Clang from Ports, it's actually not available in your PATH; you have to fully qualify it in order to use it. This avoids shadowing the system's clang.

@ararslan
Copy link
Contributor Author

I haven't tried BLIS on NetBSD or DragonFly, but it may be worthwhile to note that they use GCC as their default compiler; it's only FreeBSD and OpenBSD that use Clang by default at the moment.

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

No branches or pull requests

4 participants