Skip to content
This repository has been archived by the owner on Mar 12, 2019. It is now read-only.

development_tools: Make GCC always be the default compiler on Linux #70

Closed
wants to merge 1 commit into from
Closed

development_tools: Make GCC always be the default compiler on Linux #70

wants to merge 1 commit into from

Conversation

rwhogg
Copy link
Contributor

@rwhogg rwhogg commented Jul 1, 2016

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew tests with your changes locally?

For systems like Ubuntu that use hardening-wrapper as the default GCC, DevelopmentTools.default_compiler will assume Clang is the default, causing test failures.

Fix test:
TabTests#test_defaults [$PREFIX/Library/Homebrew/test/test_tab.rb:35]

Closes #69

@rwhogg rwhogg added the bug label Jul 1, 2016
@rwhogg rwhogg self-assigned this Jul 1, 2016
@@ -30,6 +30,8 @@ def default_compiler
# over the system's GCC 4.0
when /^gcc-4.0/ then gcc_42_build_version ? :gcc : :gcc_4_0
when /^gcc/ then :gcc
# /usr/bin/gcc is symlinked to hardened-cc on Ubuntu
when /^hardened-cc/ then :gcc
else :clang
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An alternative to this might be else (OS.mac? ? :clang : :gcc).

Part of me prefers that over special-casing in hardening-wrapper, but I'm hesitant to make such a big change when this fixes it.

@sjackman
Copy link
Member

sjackman commented Jul 1, 2016

I'm thinking that default_compiler should be on Linux:

def default_compiler
  return :gcc unless OS.mac?
  

For historical reasons, :gcc is an alias for :gcc_4_2 and means GCC 4.2 to Homebrew. It should probably be avoided on Linuxbrew. Does :gnu work? I'm not sure that it does. That's what used in compilers.rb find_compiler, but I don't believe it has any meaning outside of that function. :"gcc-5" could work, but it is not correct for the host's compiler, e.g. :"gcc-4.8".

Until we fix it correctly, I'm okay with the above hack, which ignores the value of /usr/bin/cc.

@rwhogg rwhogg changed the title development_tools: Recognize hardened-cc as GCC development_tools: Make GCC always be the default compiler on Linux Jul 4, 2016
For systems like Ubuntu that use hardening-wrapper as the default GCC,
DevelopmentTools.default_compiler will assume Clang is the default,
causing test failures.

Fix test:
TabTests#test_defaults [$PREFIX/Library/Homebrew/test/test_tab.rb:35]

Closes #69
@rwhogg
Copy link
Contributor Author

rwhogg commented Jul 13, 2016

The Circle CI failure is a configuration problem, so merging anyways.

https://circleci.com/gh/Linuxbrew/brew/14

==> brew pull --clean --tap= https://github.com/Linuxbrew/brew/pull/70
==> FAILED
Error: Invalid tap name

@rwhogg rwhogg closed this in 98ce820 Jul 13, 2016
@rwhogg rwhogg deleted the dev-tools-recognize-hardened-cc branch July 13, 2016 11:18
@sjackman
Copy link
Member

I introduced that --tap= bug, and haven't had a chance to fix it. Should be an easy fix.
https://github.com/Linuxbrew/brew/blob/master/Library/Homebrew/dev-cmd/test-bot.rb#L867

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

Successfully merging this pull request may close these issues.

2 participants