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

Introduce a HOMEBREW_ARCH environment variable to specify target microarchitecture #42

Closed
sjackman opened this issue May 17, 2016 · 6 comments
Assignees
Labels

Comments

@sjackman
Copy link
Member

From @eiennohito on April 22, 2016 5:16

It is useful in scenarios when you have heterogenous grid of computers with different microarchitectures and want to build binaries that can be used everywhere.

Discussion is started in #1094.

Copied from original issue: Linuxbrew/legacy-linuxbrew#1095

@sjackman
Copy link
Member Author

From @eiennohito on May 16, 2016 4:13

-march=native started to make shared installation unusable in our environment :(

@sjackman
Copy link
Member Author

Sorry for the breakage, Arseny. Try the following workaround:

diff --git a/Library/Homebrew/extend/ENV/std.rb b/Library/Homebrew/extend/ENV/std.rb
index 3d1b2a8..df84dcf 100644
--- a/Library/Homebrew/extend/ENV/std.rb
+++ b/Library/Homebrew/extend/ENV/std.rb
@@ -8,7 +8,7 @@ module Stdenv

   # @private
   SAFE_CFLAGS_FLAGS = "-w -pipe"
-  DEFAULT_FLAGS = OS.mac? ? "-march=core2 -msse4" : "-march=native"
+  DEFAULT_FLAGS = "-march=core2 -msse4"

   def self.extended(base)
     unless ORIGINAL_PATHS.include? HOMEBREW_PREFIX/"bin"

@sjackman
Copy link
Member Author

I've added the requested HOMEBREW_ARCH environment variable. Just for my curiosity, what value are you planning to use? Linuxbrew bottles use -march=core2, so I'd suggest HOMEBREW_ARCH=core2 if that works for you.

@eiennohito
Copy link

Thank you very much, this is great.

As a workaround I have temporarily made the brew upgrade job to execute on the oldest machine, but this should fix it.

Regarding the value, it will be either core2 or nehalem, I need to do a better hardware survey before deciding that.

@staticfloat
Copy link
Contributor

Thanks for this Shaun.

To anyone frustrated with trying to compile software using linuxbrew on a Raspberry Pi, note that because Linuxbrew sends -mcpu=native to GCC, and GCC 4.9.2 suffers from this bug in the current version of Raspbian, no software can be installed using Linuxbrew without setting HOMEBREW_ARCH to something other than native. In the case of the Raspberry Pi 3, I have found HOMEBREW_ARCH=armv8-a+crc to work well.

@sjackman
Copy link
Member Author

Thanks for the heads up, Elliot. How frustrating!

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

No branches or pull requests

3 participants