-
-
Notifications
You must be signed in to change notification settings - Fork 9.9k
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
ENV.cc and ENV.cxx is not correctly set when depending on gcc formula #10170
Comments
I think this is intentional, as many of the formulae just depend on |
I see. I can use (on Mac)
which gives me ... If I want gcc@9, I need to use:
If I want gcc@7, I need to use:
It's not the shortest syntax but it works. |
Yes. I haven't managed to figure out how to use |
Ok so I can live with the fails_with syntax for the time being. I think the biggest issue I have right now is on Linux: ENV.cc and friends will always point to the highest gcc installed. If I I would expect the following behaviour (on Linux): I have no clue how to change that behaviour right now. |
The logic is in compilers.rb, but compiler selection is pretty hairy currently and we'd need to think carefully about how to handle this. In particular:
Do we want gcc@5 to be used if the system compiler is newer? |
I would like. Almost everything is compiled with gcc5 on linux CI: I would like to use brewed gcc5 as a fallback when no gcc5 is present. This makes sure the builds have more chances to pass if someone builds from source. |
One thing I noticed though is that
if you want gcc@7. |
Yes,
Something like this seems reasonable for Linux-only with a concept of preferring a specific compiler version that we use for building bottles. |
This is on the todo list then for the linuxbrew-core migration. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
- Fixes Homebrew#10170 by preferring gcc@5 on linux (by using the PREFERRED_GCC const) This makes sure ENV.cc and ENV.cxx is correctly set: - If a formula does not depend explicitely on a brewed gcc, ENV.cc is set to gcc-5 (system gcc-5 or brewed gcc-5) evend if other gcc versions are installed on the system - Use fails_with as a way to remove all other compilers from the list of available compilers. This avoids having to set any fails_with on linux. A small workaround is present for the current setup where gcc == version 5 on linuxbrew-core, and we do not want to remove gcc-5 from the list unless explicitely specified. That workaround can be removed once https://github.com/Homebrew/linuxbrew-core/pull/21380 is merged
Fixes Homebrew#10170 by preferring gcc@5 on linux This makes sure ENV.cc and ENV.cxx is correctly set: If a formula does not explicitely depend on a brewed gcc, ENV.cc is set to gcc-5 (system gcc-5 or brewed gcc-5) with this change, even if other gcc versions are installed on the system.
What you were trying to do (and why)
Trying to install a meson-based formula (https://github.com/Homebrew/linuxbrew-core/pull/21946) on linux with gcc@7.
The issues is also present on macOS.
What happened (include command output)
ENV["CC"], ENV["CXX"], ENV.cc, ENV.cxx is incorrectly set in the install and test block.
The wrong compiler is defined.
depends_on "gcc@x"
in the formula.meson
(but maybe other build tools) will pick up the wrong compiler.Some tests blocks are run with the wrong compiler too, as we use ENV.cc a lot.
What you expected to happen
ENV["CC"], ENV["CXX"], ENV.cc, ENV.cxx should point to the gcc formula defined in the formula.
Note
This issue might not be a bug but a design choice. In that case I would like to change that behaviour.
The text was updated successfully, but these errors were encountered: