Linuxbrew-core: gdb: error: no usable python found

Created on 6 Nov 2017  路  7Comments  路  Source: Homebrew/linuxbrew-core

I am trying to install gdb by using brew, after running brew install gdb, i got the error message as follow:

[lday@MyCentOS7VM ~]$ brew install gdb
==> Downloading https://ftp.gnu.org/gnu/gdb/gdb-8.0.1.tar.xz
Already downloaded: /home/lday/.cache/Homebrew/gdb-8.0.1.tar.xz
==> ./configure --prefix=/home/linuxbrew/.linuxbrew/Cellar/gdb/8.0.1 --with-python=/home/linuxbrew/.linuxbrew
==> make
Last 15 lines from /home/lday/.cache/Homebrew/Logs/gdb/02.make:
checking size of unsigned __int128... 16
checking for library containing dlopen... (cached) -ldl
checking whether to use expat... auto
checking for libexpat... yes
checking how to link with libexpat... -lexpat
checking for XML_StopParser... yes
checking whether to use python... /home/linuxbrew/.linuxbrew
checking for python2.7... no
checking for python2.6... no
checking for python2.5... no
checking for python2.4... no
configure: error: no usable python found at /home/linuxbrew/.linuxbrew
make[1]: *** [configure-gdb] Error 1
make[1]: Leaving directory `/tmp/gdb-20171106-33198-e964ey/gdb-8.0.1'
make: *** [all] 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.

i have install python27 by brew install python, and the python header file has been instatlled at:

[lday@MyCentOS7VM python2.7]$ pwd
/home/linuxbrew/.linuxbrew/include/python2.7
[lday@MyCentOS7VM python2.7]$ ll
total 680
-rw-r--r--. 1 lday lday 45225 Sep 17 01:49 abstract.h
-rw-r--r--. 1 lday lday  1099 Sep 17 01:49 asdl.h
-rw-r--r--. 1 lday lday   230 Sep 17 01:49 ast.h
-rw-r--r--. 1 lday lday   792 Sep 17 01:49 bitset.h
-rw-r--r--. 1 lday lday   912 Sep 17 01:49 boolobject.h
-rw-r--r--. 1 lday lday   922 Sep 17 01:49 bufferobject.h
-rw-r--r--. 1 lday lday  1941 Sep 17 01:49 bytearrayobject.h
-rw-r--r--. 1 lday lday  2804 Sep 17 01:49 bytes_methods.h
-rw-r--r--. 1 lday lday  1152 Sep 17 01:49 bytesobject.h
-rw-r--r--. 1 lday lday   651 Sep 17 01:49 cellobject.h
...

the gist-logs has been updated: https://gist.github.com/927c7000f3b6fb84d48e053ba265b4f6

[lday@MyCentOS7VM python2.7]$ brew gist-logs gdb
https://gist.github.com/927c7000f3b6fb84d48e053ba265b4f6

thanks for help

bug build failure outdated stale

Most helpful comment

I've got the same issue. I managed to fix my case by:

diff --git a/Formula/gdb.rb b/Formula/gdb.rb
index d903cea484..86b6cda5f5 100644
--- a/Formula/gdb.rb
+++ b/Formula/gdb.rb
@@ -44,7 +44,7 @@ class Gdb < Formula
     args << "--enable-targets=all" if build.with? "all-targets"

     if build.with? "python"
-      args << "--with-python=#{HOMEBREW_PREFIX}"
+      args << "--with-python=#{HOMEBREW_PREFIX}/bin/python2"
     elsif OS.mac?
       args << "--with-python=/usr"
     end

The problem appears to be related to configure trying to look for python in the wrong path:

{HOMEBREW_PREFIX} instead of #{HOMEBREW_PREFIX}/bin/python2

All 7 comments

The problem should be with guile. I fixed it editing the gdb.rb formula file locally and adding "--with-guile" option to configure.

I don't know how this can be fixed upstream as it seems to be a problem between gdb and guile 2.2.

even if i change the gdb.rb locally and use "--with-guile", i still got the sam error msg:

[lday@MyCentOS7VM ~]$ brew install gdb
==> Downloading https://ftp.gnu.org/gnu/gdb/gdb-8.0.1.tar.xz
Already downloaded: /home/lday/.cache/Homebrew/gdb-8.0.1.tar.xz
==> ./configure --prefix=/home/linuxbrew/.linuxbrew/Cellar/gdb/8.0.1 --with-guile --with-python=/home/linuxbrew/.linuxbrew
==> make
Last 15 lines from /home/lday/.cache/Homebrew/Logs/gdb/02.make:
checking size of unsigned __int128... 16
checking for library containing dlopen... (cached) -ldl
checking whether to use expat... auto
checking for libexpat... yes
checking how to link with libexpat... -lexpat
checking for XML_StopParser... yes
checking whether to use python... /home/linuxbrew/.linuxbrew
checking for python2.7... no
checking for python2.6... no
checking for python2.5... no
checking for python2.4... no
configure: error: no usable python found at /home/linuxbrew/.linuxbrew
make[1]: *** [configure-gdb] Error 1
make[1]: Leaving directory `/tmp/gdb-20171108-32757-v9sd5p/gdb-8.0.1'
make: *** [all] 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:
no usable python found when install gdb https://github.com/Linuxbrew/homebrew-core/issues/4885
gdb: fix add --without-python parameter on linux platform as needed https://github.com/Linuxbrew/homebrew-core/pull/4896

I've got the same issue. I managed to fix my case by:

diff --git a/Formula/gdb.rb b/Formula/gdb.rb
index d903cea484..86b6cda5f5 100644
--- a/Formula/gdb.rb
+++ b/Formula/gdb.rb
@@ -44,7 +44,7 @@ class Gdb < Formula
     args << "--enable-targets=all" if build.with? "all-targets"

     if build.with? "python"
-      args << "--with-python=#{HOMEBREW_PREFIX}"
+      args << "--with-python=#{HOMEBREW_PREFIX}/bin/python2"
     elsif OS.mac?
       args << "--with-python=/usr"
     end

The problem appears to be related to configure trying to look for python in the wrong path:

{HOMEBREW_PREFIX} instead of #{HOMEBREW_PREFIX}/bin/python2

@lday0321 i was with my phone and I made a typo. The configure option is "--without-guile".. sorry about that.

@Char-Aznable , thanks, it works for me!

    if build.with? "python"
      # args << "--with-python=#{HOMEBREW_PREFIX}"
      args << "--with-python=#{HOMEBREW_PREFIX}/bin/python2"
    elsif OS.mac?
      args << "--with-python=/usr"
    end
[lday@MyCentOS7VM ~]$ brew install gdb
Updating Homebrew...
==> Auto-updated Homebrew!
Updated Homebrew from  to .
Updated 1 tap (homebrew/core).
No changes to formulae.

==> Downloading https://ftp.gnu.org/gnu/gdb/gdb-8.0.1.tar.xz
Already downloaded: /home/lday/.cache/Homebrew/gdb-8.0.1.tar.xz
==> ./configure --prefix=/home/linuxbrew/.linuxbrew/Cellar/gdb/8.0.1 --with-python=/home/linuxbrew/.linuxbrew/bin/python2
==> make
==> make install
==> Caveats
gdb requires special privileges to access Mach ports.
You will need to codesign the binary. For instructions, see:

  https://sourceware.org/gdb/wiki/BuildingOnDarwin

On 10.12 (Sierra) or later with SIP, you need to run this:

  echo "set startup-with-shell off" >> ~/.gdbinit
==> Summary
馃嵑  /home/linuxbrew/.linuxbrew/Cellar/gdb/8.0.1: 64 files, 55MB, built in 5 minutes 26 seconds

A PR to make this change would be quite welcome.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

Was this page helpful?
0 / 5 - 0 ratings