diff mbox

Modify python-config.py or replace it with official one to support python3

Message ID CAPwS6qMKW+PzjHQiLM19aDy-8=rFO8aF9WMiRS=nOjK=iJaSzQ@mail.gmail.com
State New
Headers show

Commit Message

傅继晗 Jan. 20, 2020, 2:05 p.m. UTC
The formal patch only works on OSX.And here is the patch to make the
crossbuild available.




傅继晗 <fjhhz1997@gmail.com> 于2020年1月20日周一 下午8:02写道:
>
> By default,gdb is compiled with python2 script support on OSX. However,when compiled with arg "--with-python=/path/to/python3 " to support python3 ,some error occurred that seems python3 is not recognized.
> The reason is that the python-config.py is not the same as the official one.BTW,this issue was once referred at 20 Dec 2012 mail :https://sourceware.org/ml/gdb-patches/2012-12/msg00751.html.
> Somehow,It is not committed(maybe the maintainer forgot it due to the happy chrismas holiday).
> And here is my patch:
>
> index: b/gdb/python/python-config.py
> ===============================
> --- a/gdb/python/python-config.py
> +++ b/gdb/python/python-config.py
> @@ -72,7 +72,7 @@ for opt in opt_flags:
>                      libs.insert(0, '-L' + getvar('LIBPL'))
>                  elif os.name == 'nt':
>                      libs.insert(0, '-L' + sysconfig.PREFIX + '/libs')
> -            if getvar('LINKFORSHARED') is not None:
> +            if not getvar('PYTHONFRAMEWORK'):
>                  libs.extend(getvar('LINKFORSHARED').split())
>          print (to_unix_path(' '.join(libs)))

Comments

Doug Evans via gdb-patches Jan. 21, 2020, 12:29 a.m. UTC | #1
On Mon, Jan 20, 2020 at 8:05 AM 傅继晗 <fjhhz1997@gmail.com> wrote:
>
> The formal patch only works on OSX.And here is the patch to make the
> crossbuild available.

configure is a generated file. Please edit configure.ac instead, and
run autoconf to regenerate configure. Make sure to use autoconf
version 2.69.

Christian

> diff --git a/gdb/configure-origin b/gdb/configure
> --- a/gdb/configure-origin
> +++ b/gdb/configure
> @@ -9858,21 +9858,21 @@ fi
> # We have a python program to use, but it may be too old.
> # Don't flag an error for --with-python=auto (the default).
> have_python_config=yes
> - python_includes=`${python_prog} ${srcdir}/python/python-config.py --includes`
> + python_includes=`${python_prog}-config --includes`
> if test $? != 0; then
> have_python_config=failed
> if test "${with_python}" != auto; then
> as_fn_error "failure running python-config --includes" "$LINENO" 5
> fi
> fi
> - python_libs=`${python_prog} ${srcdir}/python/python-config.py --ldflags`
> + python_libs=`${python_prog}-config --ldflags`
> if test $? != 0; then
> have_python_config=failed
> if test "${with_python}" != auto; then
> as_fn_error "failure running python-config --ldflags" "$LINENO" 5
> fi
> fi
> - python_prefix=`${python_prog} ${srcdir}/python/python-config.py --exec-prefix`
> + python_prefix=`${python_prog}-config --exec-prefix`
> if test $? != 0; then
> have_python_config=failed
> if test "${with_python}" != auto; then
>
>
> 傅继晗 <fjhhz1997@gmail.com> 于2020年1月20日周一 下午8:02写道:
> >
> > By default,gdb is compiled with python2 script support on OSX. However,when compiled with arg "--with-python=/path/to/python3 " to support python3 ,some error occurred that seems python3 is not recognized.
> > The reason is that the python-config.py is not the same as the official one.BTW,this issue was once referred at 20 Dec 2012 mail :https://sourceware.org/ml/gdb-patches/2012-12/msg00751.html.
> > Somehow,It is not committed(maybe the maintainer forgot it due to the happy chrismas holiday).
> > And here is my patch:
> >
> > index: b/gdb/python/python-config.py
> > ===============================
> > --- a/gdb/python/python-config.py
> > +++ b/gdb/python/python-config.py
> > @@ -72,7 +72,7 @@ for opt in opt_flags:
> >                      libs.insert(0, '-L' + getvar('LIBPL'))
> >                  elif os.name == 'nt':
> >                      libs.insert(0, '-L' + sysconfig.PREFIX + '/libs')
> > -            if getvar('LINKFORSHARED') is not None:
> > +            if not getvar('PYTHONFRAMEWORK'):
> >                  libs.extend(getvar('LINKFORSHARED').split())
> >          print (to_unix_path(' '.join(libs)))
diff mbox

Patch

diff --git a/gdb/configure-origin b/gdb/configure
--- a/gdb/configure-origin
+++ b/gdb/configure
@@ -9858,21 +9858,21 @@  fi
# We have a python program to use, but it may be too old.
# Don't flag an error for --with-python=auto (the default).
have_python_config=yes
- python_includes=`${python_prog} ${srcdir}/python/python-config.py --includes`
+ python_includes=`${python_prog}-config --includes`
if test $? != 0; then
have_python_config=failed
if test "${with_python}" != auto; then
as_fn_error "failure running python-config --includes" "$LINENO" 5
fi
fi
- python_libs=`${python_prog} ${srcdir}/python/python-config.py --ldflags`
+ python_libs=`${python_prog}-config --ldflags`
if test $? != 0; then
have_python_config=failed
if test "${with_python}" != auto; then
as_fn_error "failure running python-config --ldflags" "$LINENO" 5
fi
fi
- python_prefix=`${python_prog} ${srcdir}/python/python-config.py --exec-prefix`
+ python_prefix=`${python_prog}-config --exec-prefix`
if test $? != 0; then
have_python_config=failed
if test "${with_python}" != auto; then