Brew: Cannot build anything from source.

Created on 16 May 2016  Â·  15Comments  Â·  Source: Linuxbrew/brew

_From @zkanda on May 16, 2016 7:28_

I cannot seem to build anything from source. I'm trying to install zsh from a fresh ubuntu 14.04.

https://gist.github.com/anonymous/e9ee006389eb2f2d14b34e4db5c195f0

_Copied from original issue: Linuxbrew/homebrew-core#307_

bug

All 15 comments

From https://gist.github.com/anonymous/e9ee006389eb2f2d14b34e4db5c195f0#file-01-configure-L15-L19

checking for gcc... /usr/bin/gcc-4.8
checking whether the C compiler works... no
configure: error: in `/tmp/gdbm-20160516-20156-s31fqz/gdbm-1.11':
configure: error: C compiler cannot create executables
See `config.log' for more details

From https://gist.github.com/anonymous/e9ee006389eb2f2d14b34e4db5c195f0#file-config-log-L91-L92

configure:3659: /usr/bin/gcc-4.8 -Os -w -pipe -march=prescott -isystem/home/zkanda/.linuxbrew/include -L/home/zkanda/.linuxbrew/lib -Wl,--dynamic-linker=/home/zkanda/.linuxbrew/lib/ld.so -Wl,-rpath,/home/zkanda/.linuxbrew/lib conftest.c  >&5
conftest.c:1:0: error: CPU you selected does not support x86-64 instruction set

@zkanda, can I ask for some clarification about your computer architecture? The gist says you're running this on an Intel Prescott.

According to Wikipedia, there are both 32-bit and 64-bit versions of the Prescott. Which one are you using? We unfortunately don't support 32-bit architectures at this time (but would welcome assistance if you'd like to help support it).

From GCC's web site:

‘prescott’
    Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and SSE3 instruction set support. 

Is that part of your CFLAGS variable or did Linuxbrew insert it itself?

Thanks a bunch!

By the way, I'll probably move this issue to Linuxbrew/brew if I determine that it's a bug in Linuxbrew itself and not just gdbm in particular.

_From @zkanda on May 16, 2016 11:47_

Yes, this is not just about gdbm, everything that I need to compile is having this issue. This is running in VM in our server which is supposed to be 64-bit.

Here is the output of uname -a

→ uname -a
Linux dev-server 3.19.0-59-generic #65~14.04.1-Ubuntu SMP Tue Apr 19 18:57:09 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

I didn't change any CFLAGS settings as I don't even know how to do that but I would be willing to help on whatever I can.

As a workaround try either deleting this line:
https://github.com/Linuxbrew/brew/blob/master/Library/Homebrew/os/linux/hardware.rb#L5

    :core => "-march=prescott",

Or try changing this line to

    :core => "-march=native",

I tried the first workaround and it now compiles.

Glad to hear that the work around worked for you. Thanks for the bug report, Zakatell.

I'm not sure what the fix should be.

prescott    Improved version of Intel Pentium4 CPU with MMX, SSE, SSE2 and SSE3 instruction set support. 
nocona      Improved version of Intel Pentium4 CPU with 64-bit extensions, MMX, SSE, SSE2 and SSE3 instruction set support.

https://gcc.gnu.org/onlinedocs/gcc-4.5.3/gcc/i386-and-x86_002d64-Options.html

It looks to me like -march=prescott is for 32-bit and it should be -march=nocona for 64-bit.
I'm not sure, but perhaps this line needs to be split up into 32-bit and 64-bit processors:
https://github.com/Linuxbrew/brew/blob/master/Library/Homebrew/os/linux/hardware.rb#L73

      when 0x0f
        case cpu_model
        when 0x06, 0x03, 0x04
          :core # Presler and Prescott
        else

I've added a HOMEBREW_ARCH environment variable. See #42. Try

export HOMEBREW_ARCH=native

If you're able to do some troubleshooting for us, could you try applying the following patch and then report the output of brew config:

diff --git a/Library/Homebrew/os/linux/hardware.rb b/Library/Homebrew/os/linux/hardware.rb
index 8e44693..e1ae500 100644
--- a/Library/Homebrew/os/linux/hardware.rb
+++ b/Library/Homebrew/os/linux/hardware.rb
@@ -71,7 +71,7 @@ module LinuxCPUs
       when 0x0f
         case cpu_model
         when 0x06, 0x03, 0x04
-          :core # Presler and Prescott
+          cpu_family_model
         else
           cpu_family_model
         end

Incidentally, this patch should also work around your issue.

Tested the patch and it seems to be working as well, here's my brew config

○ → brew config
HOMEBREW_VERSION: 0.9.9
ORIGIN: https://github.com/Linuxbrew/brew
HEAD: b5ed40ce119e6bee0846e8f0a33531151b49cc76
Last commit: 13 hours ago
Core tap ORIGIN: https://github.com/Linuxbrew/homebrew-core
Core tap HEAD: 4d7312aa37084141dce5d52a0963186e809fa302
Core tap last commit: 6 hours ago
HOMEBREW_PREFIX: /home/zkanda/.linuxbrew
HOMEBREW_REPOSITORY: /home/zkanda/.linuxbrew
HOMEBREW_CELLAR: /home/zkanda/.linuxbrew/Cellar
HOMEBREW_BOTTLE_DOMAIN: https://linuxbrew.bintray.com
CPU: quad-core 64-bit 0xf06
Kernel: Linux 3.19.0-59-generic x86_64 GNU/Linux
OS: Ubuntu 14.04.4 LTS
Codename: trusty
OS glibc: 2.19
OS gcc: 4.8.4
Linuxbrew glibc: N/A
Linuxbrew gcc: N/A
Clang: N/A
X11: 2.7.8 => /usr
System Ruby: 1.9.3-p484 => /usr/bin/ruby1.9.1
Perl: /usr/bin/perl
Python: /usr/bin/python => /usr/bin/python2.7
Ruby: /usr/bin/ruby => /usr/bin/ruby1.9.1
Java: N/A

CPU: quad-core 64-bit 0xf06
Looks like Prescott (Intel Core Duo) and Presler need to be separated.

I've committed a fix for this issue. Can you test it out and after brew update report the output of brew config?

Updated, here's the new brew-config

○ → brew config
HOMEBREW_VERSION: 0.9.9
ORIGIN: https://github.com/Linuxbrew/brew
HEAD: b21be51aaef7a4d4a328c3182002c217f55a80c1
Last commit: 3 hours ago
Core tap ORIGIN: https://github.com/Linuxbrew/homebrew-core
Core tap HEAD: 788c967783c39a359122d4a64ac4572971ac77be
Core tap last commit: 28 hours ago
HOMEBREW_PREFIX: /home/zkanda/.linuxbrew
HOMEBREW_REPOSITORY: /home/zkanda/.linuxbrew
HOMEBREW_CELLAR: /home/zkanda/.linuxbrew/Cellar
HOMEBREW_BOTTLE_DOMAIN: https://linuxbrew.bintray.com
CPU: quad-core 64-bit presler
Kernel: Linux 3.19.0-59-generic x86_64 GNU/Linux
OS: Ubuntu 14.04.4 LTS
Codename: trusty
OS glibc: 2.19
OS gcc: 4.8.4
Linuxbrew glibc: N/A
Linuxbrew gcc: N/A
Clang: N/A
X11: N/A
System Ruby: 1.9.3-p484 => /usr/bin/ruby1.9.1
Perl: /usr/bin/perl
Python: /usr/bin/python => /usr/bin/python2.7
Ruby: /usr/bin/ruby => /usr/bin/ruby1.9.1
Java: N/A

CPU: quad-core 64-bit presler
Looks good to me. And you can compile software now without setting HOMEBREW_ARCH?

Yes, definitely, thank you so much for looking into these.

Was this page helpful?
0 / 5 - 0 ratings