Linuxbrew / brew

:beer::penguin: The Homebrew package manager for Linux
https://linuxbrew.sh
BSD 2-Clause "Simplified" License
2.65k stars 235 forks source link

gcc: Build error on Raspberry Pi #576

Closed pawan-saxena closed 6 years ago

pawan-saxena commented 6 years ago

i am trying to build gcc on arm but as it hits the build for gmp 6.1.2 it fails right away. brew update && brew install gmp Error: Empty archive

I guess that since my gcc is 4.x so you don't support gmp version for arm. if not can you point me in rigth direction as to how to make gmp and hence gcc on raspberry pi3.

gist : brew gist-logs gcc and/or brew gist-logs gmp results in : Error : No logs

screenshot from 2018-01-24 01-49-33

alyssais commented 6 years ago

Can you brew install -v gcc and post the output?

pawan-saxena commented 6 years ago

screenshot from 2018-01-24 01-52-20 signature turns out to be okay :(

sjackman commented 6 years ago

The problem may be that the source tarball is xzipped rather than gzipped and you don't have xz available. Please report…

ls -l /home/pi/.cache/Homebrew/gmp-6.1.2.tar.xz
sha256sum /home/pi/.cache/Homebrew/gmp-6.1.2.tar.xz
sjackman commented 6 years ago

Try…

sudo apt-get install xz
pawan-saxena commented 6 years ago

screenshot from 2018-01-24 01-57-43

pawan-saxena commented 6 years ago

screenshot from 2018-01-24 02-01-09

I can't find xz but a lot of other similar packages, any suggestions which to use ?

sjackman commented 6 years ago
sudo apt-get install xz-utils
sjackman commented 6 years ago

Please avoid pasting screenshots, and instead copy-and-paste the text.

pawan-saxena commented 6 years ago

After installing xz-utils :

pi@raspberrypi:~$ ls -l /home/pi/.cache/Homebrew/gmp-6.1.2.tar.xz
-rw-r--r-- 1 pi pi 1946336 Dec 16  2016 /home/pi/.cache/Homebrew/gmp-6.1.2.tar.xz
pi@raspberrypi:~$ sha256sum /home/pi/.cache/Homebrew/gmp-6.1.2.tar.xz
87b565e89a9a684fe4ebeeddb8399dce2599f9c9049854ca8c0dfbdea0e21912  /home/pi/.cache/Homebrew/gmp-6.1.2.tar.xz
pi@raspberrypi:~$ source ~/.profile 
pi@raspberrypi:~$ brew update && brew install gmp
Updated 1 tap (homebrew/core).
No changes to formulae.
Updating Homebrew...
==> Downloading https://gmplib.org/download/gmp/gmp-6.1.2.tar.xz
Already downloaded: /home/pi/.cache/Homebrew/gmp-6.1.2.tar.xz
Error: Empty archive
pi@raspberrypi:~$ 
sjackman commented 6 years ago

Please enclose copy-and-paste blocks in triple back ticks. See https://help.github.com/articles/basic-writing-and-formatting-syntax/#quoting-code

sjackman commented 6 years ago

Please report…

tar tf /home/pi/.cache/Homebrew/gmp-6.1.2.tar.xz | head
pawan-saxena commented 6 years ago
pi@raspberrypi:~$ tar tf /home/pi/.cache/Homebrew/gmp-6.1.2.tar.xz | head
gmp-6.1.2/
gmp-6.1.2/cxx/
gmp-6.1.2/mini-gmp/
gmp-6.1.2/Makefile.am
gmp-6.1.2/configure
gmp-6.1.2/acinclude.m4
gmp-6.1.2/configure.ac
gmp-6.1.2/aclocal.m4
gmp-6.1.2/gmpxx.h
gmp-6.1.2/Makefile.in
pi@raspberrypi:~$ 
pawan-saxena commented 6 years ago

is it something here :

  def chdir
    entries = Dir["*"]
    case entries.length
    when 0 then raise "Empty archive"
    when 1 then begin
        Dir.chdir entries.first
      rescue
        nil
      end
    end
  end

in download_strategy.rb

sjackman commented 6 years ago

Try…

HOMEBREW_STDERR=1 brew install -v gmp
pawan-saxena commented 6 years ago
pi@raspberrypi:~$ HOMEBREW_STDERR=1 brew install -v gmp
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
No changes to formulae.

==> Downloading https://gmplib.org/download/gmp/gmp-6.1.2.tar.xz
Already downloaded: /home/pi/.cache/Homebrew/gmp-6.1.2.tar.xz
==> Verifying gmp-6.1.2.tar.xz checksum
brew: command not found: /home/linuxbrew/.linuxbrew/opt/xz/bin/xz
tar: This does not look like a tar archive
tar: Exiting with failure status due to previous errors
Error: Empty archive
pi@raspberrypi:~$ 

okay so i had same problem with curl it was reading it as /opt/curl/ (searching in user's root directory); i resolved that by creating a symlink

 ln -s /usr/bin/curl curl

here also i get this /opt/xz I guess that this issue may happen for other packages as well. Can you please suggest how to resolve it.

pawan-saxena commented 6 years ago

I made another symlink as :

pi@raspberrypi:~$ ln -s /usr/bin/xz /home/linuxbrew/.linuxbrew/opt/xz/bin/xz

and then tried to make build again It now stopped with same issue (this time python as /opt/python)

checking compiler gcc-4.9 -O2 -pedantic -fomit-frame-pointer ... no
configure: error: could not find a working compiler, see config.log for details
brew: command not found: /home/linuxbrew/.linuxbrew/opt/python/libexec/bin/python

==> Formula
Path: /home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/gmp.rb
==> Configuration
HOMEBREW_VERSION: 1.4.3-1-g851177a
ORIGIN: https://github.com/Linuxbrew/brew
HEAD: 851177a2928f65dedadad052347fbd7201282e38
Last commit: 8 days ago
Core tap ORIGIN: https://github.com/Linuxbrew/homebrew-core
Core tap HEAD: 59c3681e71cd21ca833196d30c3b8c02ebc88437
Core tap last commit: 25 minutes ago
HOMEBREW_PREFIX: /home/linuxbrew/.linuxbrew
HOMEBREW_REPOSITORY: /home/linuxbrew/.linuxbrew/Homebrew
HOMEBREW_CELLAR: /home/linuxbrew/.linuxbrew/Cellar
HOMEBREW_CACHE: /home/pi/.cache/Homebrew
HOMEBREW_CELLAR: /home/linuxbrew/.linuxbrew/Cellar
HOMEBREW_DEV_CMD_RUN: 1
HOMEBREW_ENABLE_AUTO_UPDATE_MIGRATION: 1
HOMEBREW_PREFIX: /home/linuxbrew/.linuxbrew
HOMEBREW_REPOSITORY: /home/linuxbrew/.linuxbrew/Homebrew
HOMEBREW_STDERR: 1
CPU: quad-core 32-bit arm
Homebrew Ruby: 2.3.3 => /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/bin/ruby
Clang: N/A
Git: 2.1.4 => /usr/bin/git
Curl: 7.38.0 => /home/linuxbrew/.linuxbrew/opt/curl/bin/curl
Perl: /usr/bin/perl
brew: command not found: /home/linuxbrew/.linuxbrew/opt/python/libexec/bin/python
Python: /home/linuxbrew/.linuxbrew/opt/python/libexec/bin/python => /home/pi
Ruby: /usr/bin/ruby => /usr/bin/ruby2.1
Java: 1.8.0_65
Kernel: Linux 4.4.50-v7+ armv7l GNU/Linux
OS: Raspbian GNU/Linux 8.0 (jessie) (jessie)
Host glibc: 2.19
/usr/bin/gcc: 4.9.2
glibc: 2.23
gcc: N/A
xorg: N/A
==> ENV
HOMEBREW_CC: gcc-4.9
HOMEBREW_CXX: g++-4.9
MAKEFLAGS: -j4
CMAKE_PREFIX_PATH: /home/linuxbrew/.linuxbrew
PKG_CONFIG_PATH: /home/linuxbrew/.linuxbrew/opt/xz/lib/pkgconfig
ACLOCAL_PATH: /home/linuxbrew/.linuxbrew/share/aclocal
PATH: /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/shims/linux/super:/home/linuxbrew/.linuxbrew/opt/xz/bin:/home/linuxbrew/.linuxbrew/opt/m4/bin:/home/linuxbrew/.linuxbrew/opt/binutils/bin:/home/linuxbrew/.linuxbrew/opt/python/libexec/bin:/usr/bin:/bin:/usr/sbin:/sbin

Error: gmp 6.1.2 did not build
Logs:
     /home/pi/.cache/Homebrew/Logs/gmp/00.options.out
     /home/pi/.cache/Homebrew/Logs/gmp/01.configure
     /home/pi/.cache/Homebrew/Logs/gmp/01.configure.cc
     /home/pi/.cache/Homebrew/Logs/gmp/config.log
READ THIS: https://github.com/Linuxbrew/brew/blob/master/docs/Troubleshooting.md#troubleshooting
Please do not report this issue to Homebrew/brew or Homebrew/core, which support macOS only.

git: 'credential-osxkeychain' is not a git command. See 'git --help'.
pi@raspberrypi:~$ which python
/usr/bin/python
pi@raspberrypi:~$
pawan-saxena commented 6 years ago

@sjackman i did a fresh install of brew and set the PATH as pointed out in docs.Now when i do

brew install -v gmp

the latest error that comes out is :

pi@raspberrypi:~$ brew install -v gmp
Updating Homebrew...
==> Downloading https://gmplib.org/download/gmp/gmp-6.1.2.tar.xz
Already downloaded: /home/pi/.cache/Homebrew/gmp-6.1.2.tar.xz
==> Verifying gmp-6.1.2.tar.xz checksum
==> ./configure --disable-static --prefix=/home/linuxbrew/.linuxbrew/Cellar/gmp/6.1.2_1 --enable-cxx
checking build system type... armcortexa53neon-unknown-linux-gnueabihf
checking host system type... armcortexa53neon-unknown-linux-gnueabihf
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking ABI=64
checking whether gcc-4.9 is gcc... yes
checking compiler gcc-4.9 -O2 -pedantic ... no
checking ABI=32
checking whether gcc-4.9 is gcc... yes
checking compiler gcc-4.9 -O2 -pedantic -fomit-frame-pointer ... no
configure: error: could not find a working compiler, see config.log for details

==> Formula
Path: /home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/gmp.rb
==> Configuration
HOMEBREW_VERSION: 1.4.3-1-g851177a
ORIGIN: https://github.com/Linuxbrew/brew
HEAD: 851177a2928f65dedadad052347fbd7201282e38
Last commit: 8 days ago
Core tap ORIGIN: https://github.com/Linuxbrew/homebrew-core
Core tap HEAD: 59c3681e71cd21ca833196d30c3b8c02ebc88437
Core tap last commit: 56 minutes ago
HOMEBREW_PREFIX: /home/linuxbrew/.linuxbrew
HOMEBREW_REPOSITORY: /home/linuxbrew/.linuxbrew/Homebrew
HOMEBREW_CELLAR: /home/linuxbrew/.linuxbrew/Cellar
HOMEBREW_CACHE: /home/pi/.cache/Homebrew
HOMEBREW_CELLAR: /home/linuxbrew/.linuxbrew/Cellar
HOMEBREW_DEV_CMD_RUN: 1
HOMEBREW_ENABLE_AUTO_UPDATE_MIGRATION: 1
HOMEBREW_PREFIX: /home/linuxbrew/.linuxbrew
HOMEBREW_REPOSITORY: /home/linuxbrew/.linuxbrew/Homebrew
CPU: quad-core 32-bit arm
Homebrew Ruby: 2.3.3 => /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/bin/ruby
Clang: N/A
Git: 2.1.4 => /usr/bin/git
Curl: 7.38.0 => /home/linuxbrew/.linuxbrew/opt/curl/bin/curl
Perl: /usr/bin/perl
Python: /home/linuxbrew/.linuxbrew/opt/python/libexec/bin/python => /usr/bin/python2.7
Ruby: /usr/bin/ruby => /usr/bin/ruby2.1
Java: 1.8.0_65
Kernel: Linux 4.4.50-v7+ armv7l GNU/Linux
OS: Raspbian GNU/Linux 8.0 (jessie) (jessie)
Host glibc: 2.19
/usr/bin/gcc: 4.9.2
glibc: 2.23
gcc: N/A
xorg: N/A
==> ENV
HOMEBREW_CC: gcc-4.9
HOMEBREW_CXX: g++-4.9
MAKEFLAGS: -j4
CMAKE_PREFIX_PATH: /home/linuxbrew/.linuxbrew
PKG_CONFIG_PATH: /home/linuxbrew/.linuxbrew/opt/xz/lib/pkgconfig
ACLOCAL_PATH: /home/linuxbrew/.linuxbrew/share/aclocal
PATH: /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/shims/linux/super:/home/linuxbrew/.linuxbrew/opt/xz/bin:/home/linuxbrew/.linuxbrew/opt/m4/bin:/home/linuxbrew/.linuxbrew/opt/binutils/bin:/home/linuxbrew/.linuxbrew/opt/python/libexec/bin:/usr/bin:/bin:/usr/sbin:/sbin

Error: gmp 6.1.2 did not build
Logs:
     /home/pi/.cache/Homebrew/Logs/gmp/00.options.out
     /home/pi/.cache/Homebrew/Logs/gmp/01.configure
     /home/pi/.cache/Homebrew/Logs/gmp/01.configure.cc
     /home/pi/.cache/Homebrew/Logs/gmp/config.log
READ THIS: https://github.com/Linuxbrew/brew/blob/master/docs/Troubleshooting.md#troubleshooting
Please do not report this issue to Homebrew/brew or Homebrew/core, which support macOS only.

pi@raspberrypi:~$ 
sjackman commented 6 years ago
checking compiler gcc-4.9 -O2 -pedantic -fomit-frame-pointer ... no
configure: error: could not find a working compiler, see config.log for details

Please report brew gist-logs gmp

pawan-saxena commented 6 years ago

@sjackman Gist gmp : https://gist.github.com/fea1762620e5678a5bb6288d2e4d8256

sjackman commented 6 years ago
error trying to exec '/home/linuxbrew/.linuxbrew/bin/ld': execvp: No such file or directory

https://gist.github.com/anonymous/fea1762620e5678a5bb6288d2e4d8256#file-config-log-L98

Try either sudo apt-get install binutils or brew install binutils

sjackman commented 6 years ago

Have you installed these dependencies of Linuxbrew? http://linuxbrew.sh/#dependencies

sudo apt-get install build-essential curl file git python-setuptools
pawan-saxena commented 6 years ago

i have installed these dependencies

sudo apt-get install build-essential curl file git python-setuptools

and then issues started to happen when gcc started building. I read all threads and adopted one approach where someone said that maybe i should delete linuxbrew altogether and start from fresh. I will seek your help if some issue happen again. But it think that would be only after 7-8 hours cause gcc build took 11 hours previously :)

pawan-saxena commented 6 years ago

@sjackman i have made the gcc build again and i failed at :

pi@raspberrypi:~ $ brew install gcc
Updating Homebrew...
==> Installing dependencies for gcc: m4, gmp, mpfr, libmpc, isl
==> Installing gcc dependency: m4
==> Downloading https://ftp.gnu.org/gnu/m4/m4-1.4.18.tar.xz
Already downloaded: /home/pi/.cache/Homebrew/m4-1.4.18.tar.xz
Error: Empty archive
pi@raspberrypi:~ $ brew update
Already up-to-date.
pi@raspberrypi:~ $ brew update
Already up-to-date.
pi@raspberrypi:~ $ brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!

Warning: Broken symlinks were found. Remove them with `brew prune`:
  /home/linuxbrew/.linuxbrew/lib/ld.so
pi@raspberrypi:~ $ brew gist-logs m4
Error: No logs.
pi@raspberrypi:~ $ brew gist-logs gcc
Error: No logs.
pi@raspberrypi:~ $ 
sjackman commented 6 years ago

Please report…

ls /home/linuxbrew/.linuxbrew/opt/glibc/lib
pawan-saxena commented 6 years ago
pi@raspberrypi:~ $ ls /home/linuxbrew/.linuxbrew/opt/glibc/lib
audit                    libcrypt.a             libnss_compat.so.2      libpthread.so
crt1.o                   libcrypt.so            libnss_db-2.23.so       libpthread.so.0
crti.o                   libcrypt.so.1          libnss_db.so            libresolv-2.23.so
crtn.o                   libc.so                libnss_db.so.2          libresolv.a
gconv                    libc.so.6              libnss_dns-2.23.so      libresolv.so
gcrt1.o                  libdl-2.23.so          libnss_dns.so           libresolv.so.2
ld-2.23.so               libdl.a                libnss_dns.so.2         librpcsvc.a
ld-linux-armhf.so.3      libdl.so               libnss_files-2.23.so    librt-2.23.so
libanl-2.23.so           libdl.so.2             libnss_files.so         librt.a
libanl.a                 libg.a                 libnss_files.so.2       librt.so
libanl.so                libieee.a              libnss_hesiod-2.23.so   librt.so.1
libanl.so.1              libm-2.23.so           libnss_hesiod.so        libSegFault.so
libBrokenLocale-2.23.so  libm.a                 libnss_hesiod.so.2      libthread_db-1.0.so
libBrokenLocale.a        libmcheck.a            libnss_nis-2.23.so      libthread_db.so
libBrokenLocale.so       libmemusage.so         libnss_nisplus-2.23.so  libthread_db.so.1
libBrokenLocale.so.1     libm.so                libnss_nisplus.so       libutil-2.23.so
libc-2.23.so             libm.so.6              libnss_nisplus.so.2     libutil.a
libc.a                   libnsl-2.23.so         libnss_nis.so           libutil.so
libcidn-2.23.so          libnsl.a               libnss_nis.so.2         libutil.so.1
libcidn.so               libnsl.so              libpcprofile.so         locale
libcidn.so.1             libnsl.so.1            libpthread-2.23.so      Mcrt1.o
libc_nonshared.a         libnss_compat-2.23.so  libpthread.a            Scrt1.o
libcrypt-2.23.so         libnss_compat.so       libpthread_nonshared.a
pi@raspberrypi:~ $ 
sjackman commented 6 years ago
Warning: Broken symlinks were found. Remove them with `brew prune`:
  /home/linuxbrew/.linuxbrew/lib/ld.so

Try…

ln -sf /home/linuxbrew/.linuxbrew/opt/glibc/lib/ld-linux-armhf.so.3 /home/linuxbrew/.linuxbrew/lib/ld.so
brew instal m4 || brew gist-logs m4
sjackman commented 6 years ago

This line needs to be fixed for ARM and 32-bit Intel. https://github.com/Linuxbrew/homebrew-core/blob/09c0eb3885089fb315aa66cd8d9c1e1ff413c384/Formula/glibc.rb#L143

    # Install ld.so symlink.
    ln_sf lib/"ld-linux-x86-64.so.2", HOMEBREW_PREFIX/"lib/ld.so"
pawan-saxena commented 6 years ago

@sjackman i followed your ins. set and m4 built successfully but gmp still have some issue :

pi@raspberrypi:~ $ brew install gcc
Updating Homebrew...
==> Installing dependencies for gcc: gmp, mpfr, libmpc, isl
==> Installing gcc dependency: gmp
==> Downloading https://gmplib.org/download/gmp/gmp-6.1.2.tar.xz
######################################################################## 100.0%
==> ./configure --disable-static --prefix=/home/linuxbrew/.linuxbrew/Cellar/gmp/6.1.2_1 --enable-cxx
Last 15 lines from /home/pi/.cache/Homebrew/Logs/gmp/01.configure:
checking for gcc-4.9 option to accept ISO C89... none needed
checking whether gcc-4.9 understands -c and -o together... yes
checking for gcc-4.9 option to accept ISO C99... -std=gnu99
checking for gcc-4.9 -std=gnu99 option to accept ISO Standard C... (cached) -std=gnu99
checking how to run the C preprocessor... gcc-4.9 -std=gnu99 -E
checking build system compiler gcc-4.9 -std=gnu99... yes
checking for build system preprocessor... gcc-4.9 -std=gnu99 -E
checking for build system executable suffix... 
checking whether build system compiler is ANSI... yes
checking for build system compiler math library... -lm
checking whether we are using the GNU C++ compiler... yes
checking whether g++-4.9 accepts -g... yes
checking C++ compiler g++-4.9  -O2 -pedantic -fomit-frame-pointer -march=armv8-a -mfloat-abi=hard -mfpu=neon -mtune=cortex-a53... no, program does not run
checking C++ compiler g++-4.9  -g -O2... no, program does not run
configure: error: C++ compiler not available, see config.log for details

READ THIS: https://github.com/Linuxbrew/brew/blob/master/docs/Troubleshooting.md#troubleshooting
Please do not report this issue to Homebrew/brew or Homebrew/core, which support macOS only.

pi@raspberrypi:~ $ 

gist : https://gist.github.com/cd7a11214115e7e1b8d6085f0d3a099d

sjackman commented 6 years ago
./a.out: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory

https://gist.github.com/anonymous/cd7a11214115e7e1b8d6085f0d3a099d#file-config-log-L1061 Looks like compiling gmp requires a C++ compiler, but we haven't yet installed the brewed C++ compiler in gcc. Try…

ls -l /usr/lib/libstdc++.so.6 && ln -s /usr/lib/libstdc++.so.6 /home/linuxbrew/.linuxbrew/lib/
brew install gmp || brew gist-logs gmp
pawan-saxena commented 6 years ago
pi@raspberrypi:/usr/lib $ ls -l /usr/lib/libstdc++.so.6 && ln -s /usr/lib/libstdc++.so.6 /home/linuxbrew/.linuxbrew/lib/
ls: cannot access /usr/lib/libstdc++.so.6: No such file or directory

So i did :

curl -o libstdc++6_4.9.2-10_armhf.deb http://archive.raspbian.org/raspbian/pool/main/g/gcc-4.9/libstdc++6_4.9.2-10_armhf.deb
sudo dpkg -i libstdc++6_4.9.2-10_armhf.deb

and modified your command to :

ls -l /usr/lib/libstdc++6_4.9.2-10_armhf.deb && ln -s /usr/lib/libstdc++6_4.9.2-10_armhf.deb /home/linuxbrew/.linuxbrew/lib/
brew install gmp || brew gist-logs gmp

and i got :

pi@raspberrypi:/usr/lib $ brew install gmp || brew gist-logs gmp

Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> Updated Formulae
awscli                     etcd                       mariadb-connector-c        tomcat

==> Downloading https://gmplib.org/download/gmp/gmp-6.1.2.tar.xz
Already downloaded: /home/pi/.cache/Homebrew/gmp-6.1.2.tar.xz
==> ./configure --disable-static --prefix=/home/linuxbrew/.linuxbrew/Cellar/gmp/6.1.2_1 --enable-cxx
Last 15 lines from /home/pi/.cache/Homebrew/Logs/gmp/01.configure:
checking for gcc-4.9 option to accept ISO C89... none needed
checking whether gcc-4.9 understands -c and -o together... yes
checking for gcc-4.9 option to accept ISO C99... -std=gnu99
checking for gcc-4.9 -std=gnu99 option to accept ISO Standard C... (cached) -std=gnu99
checking how to run the C preprocessor... gcc-4.9 -std=gnu99 -E
checking build system compiler gcc-4.9 -std=gnu99... yes
checking for build system preprocessor... gcc-4.9 -std=gnu99 -E
checking for build system executable suffix... 
checking whether build system compiler is ANSI... yes
checking for build system compiler math library... -lm
checking whether we are using the GNU C++ compiler... yes
checking whether g++-4.9 accepts -g... yes
checking C++ compiler g++-4.9  -O2 -pedantic -fomit-frame-pointer -march=armv8-a -mfloat-abi=hard -mfpu=neon -mtune=cortex-a53... no, program does not run
checking C++ compiler g++-4.9  -g -O2... no, program does not run
configure: error: C++ compiler not available, see config.log for details

READ THIS: https://github.com/Linuxbrew/brew/blob/master/docs/Troubleshooting.md#troubleshooting
Please do not report this issue to Homebrew/brew or Homebrew/core, which support macOS only.

gist : https://gist.github.com/1fefcaa9f4adb8e7cb77cfa827c13957

sjackman commented 6 years ago
./a.out: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory

https://gist.github.com/anonymous/1fefcaa9f4adb8e7cb77cfa827c13957#file-config-log-L1061 This error persists. Try…

sudo apt-get install libstdc++6
ls -l /usr/lib/arm-linux-gnueabihf/libstdc++.so.6 && ln -sf /usr/lib/arm-linux-gnueabihf/libstdc++.so.6 /home/linuxbrew/.linuxbrew/lib/
brew install gmp || brew gist-logs gmp
pawan-saxena commented 6 years ago
pi@raspberrypi:~ $ brew install gmp || brew gist-logs gmp
Updating Homebrew...
==> Downloading https://gmplib.org/download/gmp/gmp-6.1.2.tar.xz
Already downloaded: /home/pi/.cache/Homebrew/gmp-6.1.2.tar.xz
==> ./configure --disable-static --prefix=/home/linuxbrew/.linuxbrew/Cellar/gmp/6.1.2_1 --enable-cxx
Last 15 lines from /home/pi/.cache/Homebrew/Logs/gmp/01.configure:
checking for gcc-4.9 option to accept ISO C89... none needed
checking whether gcc-4.9 understands -c and -o together... yes
checking for gcc-4.9 option to accept ISO C99... -std=gnu99
checking for gcc-4.9 -std=gnu99 option to accept ISO Standard C... (cached) -std=gnu99
checking how to run the C preprocessor... gcc-4.9 -std=gnu99 -E
checking build system compiler gcc-4.9 -std=gnu99... yes
checking for build system preprocessor... gcc-4.9 -std=gnu99 -E
checking for build system executable suffix... 
checking whether build system compiler is ANSI... yes
checking for build system compiler math library... -lm
checking whether we are using the GNU C++ compiler... yes
checking whether g++-4.9 accepts -g... yes
checking C++ compiler g++-4.9  -O2 -pedantic -fomit-frame-pointer -march=armv8-a -mfloat-abi=hard -mfpu=neon -mtune=cortex-a53... no, program does not run
checking C++ compiler g++-4.9  -g -O2... no, program does not run
configure: error: C++ compiler not available, see config.log for details

READ THIS: https://github.com/Linuxbrew/brew/blob/master/docs/Troubleshooting.md#troubleshooting
Please do not report this issue to Homebrew/brew or Homebrew/core, which support macOS only.

gist : https://gist.github.com/41d3b6090038e912934b93af67cbb654 https://gist.github.com/anonymous/41d3b6090038e912934b93af67cbb654#file-config-log-L972

sjackman commented 6 years ago
./a.out: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory

https://gist.github.com/anonymous/41d3b6090038e912934b93af67cbb654#file-config-log-L1061 Please report…

ls -l /usr/lib/arm-linux-gnueabihf/libstdc++.so.6
ls -l /home/linuxbrew/.linuxbrew/lib/libstdc++.so.6
pawan-saxena commented 6 years ago
pi@raspberrypi:~ $ ls -l /usr/lib/arm-linux-gnueabihf/libstdc++.so.6
lrwxrwxrwx 1 root root 19 Mar  7  2015 /usr/lib/arm-linux-gnueabihf/libstdc++.so.6 -> libstdc++.so.6.0.20
pi@raspberrypi:~ $ ls -l /home/linuxbrew/.linuxbrew/lib/libstdc++.so.6
lrwxrwxrwx 1 pi pi 43 Jan 25 02:57 /home/linuxbrew/.linuxbrew/lib/libstdc++.so.6 -> /usr/lib/arm-linux-gnueabihf/libstdc++.so.6
pi@raspberrypi:~ $ 

symlink to a symlink

sjackman commented 6 years ago

Please report…

printf '#include <iostream>\nint main() { std::cout << "Hello, world"; return 0; }\n' >hello.cc
g++-4.9 -pipe -Os -g -O2 -o hello hello.cc -isystem/home/linuxbrew/.linuxbrew/include -Wl,--dynamic-linker=/home/linuxbrew/.linuxbrew/lib/ld.so -B/home/linuxbrew/.linuxbrew/opt/glibc/lib -L/home/linuxbrew/.linuxbrew/lib -Wl,-rpath=/home/linuxbrew/.linuxbrew/Cellar/gmp/6.1.2_1/lib -Wl,-rpath=/home/linuxbrew/.linuxbrew/lib
./hello
ldd ./hello
pawan-saxena commented 6 years ago

sorry for late reply but in the process of building gcc i literally burnt it , i had set the overclock too much and swap to 3 Gib and now i can smell it burning...i will try to arrange a new one by tomorrow.Kindly don't close this ticket for now.

sjackman commented 6 years ago

Wow! 🔥 Since you're starting over anyway… this time around try not installing glibc.

brew install gcc --without-glibc
pawan-saxena commented 6 years ago

@sjackman first of all thank you for taking some time out to help me. I got it and ran the below command :

printf '#include <iostream>\nint main() { std::cout << "Hello, world"; return 0; }\n' >hello.cc
g++-4.9 -pipe -Os -g -O2 -o hello hello.cc -isystem/home/linuxbrew/.linuxbrew/include -Wl,--dynamic-linker=/home/linuxbrew/.linuxbrew/lib/ld.so -B/home/linuxbrew/.linuxbrew/opt/glibc/lib -L/home/linuxbrew/.linuxbrew/lib -Wl,-rpath=/home/linuxbrew/.linuxbrew/Cellar/gmp/6.1.2_1/lib -Wl,-rpath=/home/linuxbrew/.linuxbrew/lib
./hello
ldd ./hello

and i got :

pi@raspberrypi:~ $ printf '#include <iostream>\nint main() { std::cout << "Hello, world"; return 0; }\n' >hello.cc
pi@raspberrypi:~ $ g++-4.9 -pipe -Os -g -O2 -o hello hello.cc -isystem/home/linuxbrew/.linuxbrew/include -Wl,--dynamic-linker=/home/linuxbrew/.linuxbrew/lib/ld.so -B/home/linuxbrew/.linuxbrew/opt/glibc/lib -L/home/linuxbrew/.linuxbrew/lib -Wl,-rpath=/home/linuxbrew/.linuxbrew/Cellar/gmp/6.1.2_1/lib -Wl,-rpath=/home/linuxbrew/.linuxbrew/lib
pi@raspberrypi:~ $ ./hello
./hello: error while loading shared libraries: libgcc_s.so.1: cannot open shared object file: No such file or directory
pi@raspberrypi:~ $ printf '#include <iostream>\nint main() { std::cout << "Hello, world"; return 0; }\n' >hello.cc
pi@raspberrypi:~ $ g++-4.9 -pipe -Os -g -O2 -o hello hello.cc -isystem/home/linuxbrew/.linuxbrew/include -Wl,--dynamic-linker=/home/linuxbrew/.linuxbrew/lib/ld.so -B/home/linuxbrew/.linuxbrew/opt/glibc/lib -L/home/linuxbrew/.linuxbrew/lib -Wl,-rpath=/home/linuxbrew/.linuxbrew/Cellar/gmp/6.1.2_1/lib -Wl,-rpath=/home/linuxbrew/.linuxbrew/lib
pi@raspberrypi:~ $ ./hello
./hello: error while loading shared libraries: libgcc_s.so.1: cannot open shared object file: No such file or directory
pi@raspberrypi:~ $ 
sjackman commented 6 years ago

Sorry that it's been trick to get it up and running. Try…

ls -l /usr/lib/arm-linux-gnueabihf/libgcc_s.so.1 && ln -sf /usr/lib/arm-linux-gnueabihf/libgcc_s.so.1 /home/linuxbrew/.linuxbrew/lib/
pawan-saxena commented 6 years ago

okay i got :

pi@raspberrypi:~ $ printf '#include <iostream>\nint main() { std::cout << "Hello, world"; return 0; }\n' >hello.cc
pi@raspberrypi:~ $ g++-4.9 -pipe -Os -g -O2 -o hello hello.cc -isystem/home/linuxbrew/.linuxbrew/include -Wl,--dynamic-linker=/home/linuxbrew/.linuxbrew/lib/ld.so -B/home/linuxbrew/.linuxbrew/opt/glibc/lib -L/home/linuxbrew/.linuxbrew/lib -Wl,-rpath=/home/linuxbrew/.linuxbrew/Cellar/gmp/6.1.2_1/lib -Wl,-rpath=/home/linuxbrew/.linuxbrew/lib
pi@raspberrypi:~ $ ./hello
Hello, worldpi@raspberrypi:~ $ ldd ./hello
    linux-vdso.so.1 (0x7edb1000)
    libstdc++.so.6 => /home/linuxbrew/.linuxbrew/lib/libstdc++.so.6 (0x76e5d000)
    libm.so.6 => /home/linuxbrew/.linuxbrew/lib/libm.so.6 (0x76dde000)
    libgcc_s.so.1 => /home/linuxbrew/.linuxbrew/lib/libgcc_s.so.1 (0x76db1000)
    libc.so.6 => /home/linuxbrew/.linuxbrew/lib/libc.so.6 (0x76c75000)
    /home/linuxbrew/.linuxbrew/lib/ld.so (0x76f39000)
pi@raspberrypi:~ $ 
sjackman commented 6 years ago

Try…

brew install gcc
pawan-saxena commented 6 years ago

This time every dependency got installed except gcc itself :

pi@raspberrypi:~ $ brew install gcc
Updating Homebrew...
==> Installing dependencies for gcc: mpfr, libmpc, isl
==> Installing gcc dependency: mpfr
==> Downloading https://ftp.gnu.org/gnu/mpfr/mpfr-4.0.0.tar.xz
######################################################################## 100.0%
==> ./configure --prefix=/home/linuxbrew/.linuxbrew/Cellar/mpfr/4.0.0 --disable-silent-rules
==> make
==> make check
==> make install
🍺  /home/linuxbrew/.linuxbrew/Cellar/mpfr/4.0.0: 29 files, 8MB, built in 15 minutes 17 seconds
==> Installing gcc dependency: libmpc
==> Downloading https://ftp.gnu.org/gnu/mpc/mpc-1.1.0.tar.gz
######################################################################## 100.0%
==> ./configure --prefix=/home/linuxbrew/.linuxbrew/Cellar/libmpc/1.1.0 --with-gmp=/home/linuxbrew/.linuxbrew/opt/gmp --with-mpfr=/home/linuxbrew/.linuxbrew/opt/mpfr
==> make
==> make check
==> make install
🍺  /home/linuxbrew/.linuxbrew/Cellar/libmpc/1.1.0: 13 files, 1MB, built in 5 minutes 1 second
==> Installing gcc dependency: isl
==> Downloading http://isl.gforge.inria.fr/isl-0.18.tar.xz
######################################################################## 100.0%
==> ./configure --disable-silent-rules --prefix=/home/linuxbrew/.linuxbrew/Cellar/isl/0.18 --with-gmp=system --with-gmp-prefix=/home/linuxbrew/.linuxbrew/opt/gmp
==> make check
==> make install
🍺  /home/linuxbrew/.linuxbrew/Cellar/isl/0.18: 81 files, 4.5MB, built in 12 minutes 20 seconds
==> Installing gcc
==> Downloading https://ftp.gnu.org/gnu/gcc/gcc-5.5.0/gcc-5.5.0.tar.xz
######################################################################## 100.0%

==> ../configure --with-native-system-header-dir=/home/linuxbrew/.linuxbrew/include --with-local-prefix=/home/linuxbrew/.linuxbrew/local --with-build-time-tools=/home/l
==> make bootstrap

Last 15 lines from /home/pi/.cache/Homebrew/Logs/gcc/02.make:
/home/linuxbrew/.linuxbrew/include/gnu/stubs.h:7:29: fatal error: gnu/stubs-soft.h: No such file or directory
compilation terminated.
Makefile:466: recipe for target '_cmpdi2.o' failed
make[3]: *** [_cmpdi2.o] Error 1
Makefile:466: recipe for target '_ucmpdi2.o' failed
make[3]: *** [_ucmpdi2.o] Error 1
make[3]: Leaving directory '/tmp/gcc-20180125-8077-167xzl7/gcc-5.5.0/build/armv7l-unknown-linux-gnueabihf/libgcc'
Makefile:15812: recipe for target 'all-stage1-target-libgcc' failed
make[2]: *** [all-stage1-target-libgcc] Error 2
make[2]: Leaving directory '/tmp/gcc-20180125-8077-167xzl7/gcc-5.5.0/build'
Makefile:20382: recipe for target 'stage1-bubble' failed
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory '/tmp/gcc-20180125-8077-167xzl7/gcc-5.5.0/build'
Makefile:20718: recipe for target 'bootstrap' failed
make: *** [bootstrap] Error 2

READ THIS: https://github.com/Linuxbrew/brew/blob/master/docs/Troubleshooting.md#troubleshooting
Please do not report this issue to Homebrew/brew or Homebrew/core, which support macOS only.

These open issues may also help:
gcc@4.9: Build a bottle for Linuxbrew https://github.com/Linuxbrew/homebrew-core/pull/5276
brew install glibc fails looking for gcc 5.5.0_1 specs file https://github.com/Linuxbrew/homebrew-core/issues

gist : https://gist.github.com/cbf56e11bac767f4bc7f334c2677a9c3

sjackman commented 6 years ago

The file gnu/stubs-soft.h is provided by the package libc6-dev-armel-cross on a hard-float ARM system (armhf): https://packages.debian.org/search?searchon=contents&keywords=gnu%2Fstubs-soft.h&mode=path&suite=stable&arch=armhf Try…

sudo apt-get install libc6-dev-armel-cross
brew install gcc
sjackman commented 6 years ago

Please also report…

brew list glibc | grep stubs
pawan-saxena commented 6 years ago
pi@raspberrypi:~ $ brew list glibc | grep stubs
/home/linuxbrew/.linuxbrew/Cellar/glibc/2.23/include/gnu/stubs-hard.h
/home/linuxbrew/.linuxbrew/Cellar/glibc/2.23/include/gnu/stubs.h
/home/linuxbrew/.linuxbrew/Cellar/glibc/2.23/include/bits/libm-simd-decl-stubs.h
pi@raspberrypi:~ $ 
sjackman commented 6 years ago

gcc is configured with --disable-multilib. https://github.com/Linuxbrew/homebrew-core/blob/master/Formula/gcc.rb#L184 which should prevent it from needing gnu/stubs-soft.h. It looks like a bug in gcc to me that it still needs soft float. That doesn't help you though. As a super hack, you could try symlinking

/usr/arm-linux-gnueabi/include/gnu/stubs-soft.h

to

/home/linuxbrew/.linuxbrew/Cellar/glibc/2.23/include/gnu/stubs-soft.h

That likely get you past this particular error message. You're definitely in sketchy territory here though.

If you want to start over from scratch, I'd suggest removing everything and trying

brew install gcc --without-glibc

and avoid ever installing the brewed glibc. Alternatively, you need to configure and compile glibc with multilib support for soft floats.

pawan-saxena commented 6 years ago

i will try symlinking first cause gcc building took 22 hrs. so i guess i should give your first instruction a shot and see how things work out :)

sjackman commented 6 years ago

If you can read C code, you may want to read through gnu/stubs-soft.h and see whether there are any other header files that stubs-soft.h includes that you may need to symlink as well. Or perhaps symlink every file in the Debian gnu directory that doesn't already exist in the brewed glibc directory.

pawan-saxena commented 6 years ago

On it

pawan-saxena commented 6 years ago

Hello @sjackman i tried to find as many header files as i can and there are about 13 of them but still i failed to make them work. So now i am starting again on a new board and this time using :

brew install gcc --without-glibc