* [PATCH] Modify python-config.py or replace it with official one to support python3
@ 2020-01-20 14:05 傅继晗
2020-01-20 15:05 ` 傅继晗
0 siblings, 1 reply; 6+ messages in thread
From: 傅继晗 @ 2020-01-20 14:05 UTC (permalink / raw)
To: gdb-patches; +Cc: dje
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)))
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Modify python-config.py or replace it with official one to support python3
2020-01-20 14:05 [PATCH] Modify python-config.py or replace it with official one to support python3 傅继晗
@ 2020-01-20 15:05 ` 傅继晗
2020-01-21 1:31 ` Christian Biesinger via gdb-patches
0 siblings, 1 reply; 6+ messages in thread
From: 傅继晗 @ 2020-01-20 15:05 UTC (permalink / raw)
To: gdb-patches
The formal patch only works on OSX.And here is the patch to make the
crossbuild available.
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)))
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Modify python-config.py or replace it with official one to support python3
2020-01-20 15:05 ` 傅继晗
@ 2020-01-21 1:31 ` Christian Biesinger via gdb-patches
[not found] ` <CAPwS6qOtjH-g88iy7DmUoMyUO1F7O+vZQWoWNZfzZoVkSJ=qtQ@mail.gmail.com>
0 siblings, 1 reply; 6+ messages in thread
From: Christian Biesinger via gdb-patches @ 2020-01-21 1:31 UTC (permalink / raw)
To: 傅继晗; +Cc: gdb-patches
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)))
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Modify python-config.py or replace it with official one to support python3
[not found] ` <CAPwS6qOtjH-g88iy7DmUoMyUO1F7O+vZQWoWNZfzZoVkSJ=qtQ@mail.gmail.com>
@ 2020-01-22 2:04 ` 傅继晗
2020-01-22 2:16 ` 傅继晗
0 siblings, 1 reply; 6+ messages in thread
From: 傅继晗 @ 2020-01-22 2:04 UTC (permalink / raw)
To: gdb-patches; +Cc: Christian Biesinger
[-- Attachment #1: Type: text/plain, Size: 7095 bytes --]
now I improve the patch to be compatible with python2.7 python 3.7 and
python3.8+
index gdb/configure.ac
============================
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -834,29 +834,35 @@ else
esac
esac
+ python_config=
if test "${python_prog}" != missing; then
+ AC_CHECK_FILE([${python_prog}-config],[python_config="${python_prog}-config"],[python_config="${python_prog}
${srcdir}/python/python-config.py"])
# 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_config} --includes`
if test $? != 0; then
have_python_config=failed
if test "${with_python}" != auto; then
- AC_ERROR(failure running python-config --includes)
+ AC_ERROR(failure running ${python-config} --includes)
fi
fi
- python_libs=`${python_prog} ${srcdir}/python/python-config.py --ldflags`
+# For python 3.8+ there must be a "--embed" flag to show lib version.
+ python_libs=`${python_config} --ldflags --embed`
if test $? != 0; then
- have_python_config=failed
- if test "${with_python}" != auto; then
- AC_ERROR(failure running python-config --ldflags)
+ python_libs=`${python_config} --ldflags`
+ if test $? != 0; then
+ have_python_config=failed
+ if test "${with_python}" != auto; then
+ AC_ERROR(failure running ${python-config} --ldflags)
+ fi
fi
fi
- python_prefix=`${python_prog} ${srcdir}/python/python-config.py
--exec-prefix`
+ python_prefix=`${python_config} --exec-prefix`
if test $? != 0; then
have_python_config=failed
if test "${with_python}" != auto; then
- AC_ERROR(failure running python-config --exec-prefix)
+ AC_ERROR(failure running ${python-config} --exec-prefix)
fi
fi
else
傅继晗 <fjhhz1997@gmail.com> 于2020年1月21日周二 下午7:41写道:
>
> ok.that is,and here is my patch.
> Tested with autoconf 2.69 and python3.8.
>
>
> index:gdb/configure.ac
> ============================
> --- a/gdb/configure.ac
> +++ b/gdb/configure.ac
> @@ -834,29 +834,31 @@
> esac
> esac
>
> + python_config=
> if test "${python_prog}" != missing; then
> + AC_CHECK_FILE([${python_prog}-config],[python_config="${python_prog}-config
> --embed"],[python_config="${python_prog}
> ${srcdir}/python/python-config.py"])
> # 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_config} --includes`
> if test $? != 0; then
> have_python_config=failed
> if test "${with_python}" != auto; then
> - AC_ERROR(failure running python-config --includes)
> + AC_ERROR(failure running ${python_config} --includes)
> fi
> fi
> - python_libs=`${python_prog} ${srcdir}/python/python-config.py --ldflags`
> + python_libs=`${python_config} --ldflags`
> if test $? != 0; then
> have_python_config=failed
> if test "${with_python}" != auto; then
> - AC_ERROR(failure running python-config --ldflags)
> + AC_ERROR(failure running ${python_config} --ldflags)
> fi
> fi
> - python_prefix=`${python_prog} ${srcdir}/python/python-config.py
> --exec-prefix`
> + python_prefix=`${python_config} --exec-prefix`
> if test $? != 0; then
> have_python_config=failed
> if test "${with_python}" != auto; then
> - AC_ERROR(failure running python-config --exec-prefix)
> + AC_ERROR(failure running ${python_config} --exec-prefix)
> fi
> fi
> else
>
> Christian Biesinger <cbiesinger@google.com> 于2020年1月21日周二 上午8:30写道:
> >
> > 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)))
[-- Attachment #2: python-config.patch --]
[-- Type: application/octet-stream, Size: 1956 bytes --]
diff --git a/gdb/configure-origin.ac b/gdb/configure.ac
index 0805827..9f07e23 100644
--- a/gdb/configure-origin.ac
+++ b/gdb/configure.ac
@@ -834,29 +834,35 @@ else
esac
esac
+ python_config=
if test "${python_prog}" != missing; then
+ AC_CHECK_FILE([${python_prog}-config],[python_config="${python_prog}-config"],[python_config="${python_prog} ${srcdir}/python/python-config.py"])
# 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_config} --includes`
if test $? != 0; then
have_python_config=failed
if test "${with_python}" != auto; then
- AC_ERROR(failure running python-config --includes)
+ AC_ERROR(failure running ${python-config} --includes)
fi
fi
- python_libs=`${python_prog} ${srcdir}/python/python-config.py --ldflags`
+# For python 3.8+ there must be a "--embed" flag to show lib version.
+ python_libs=`${python_config} --ldflags --embed`
if test $? != 0; then
- have_python_config=failed
- if test "${with_python}" != auto; then
- AC_ERROR(failure running python-config --ldflags)
+ python_libs=`${python_config} --ldflags`
+ if test $? != 0; then
+ have_python_config=failed
+ if test "${with_python}" != auto; then
+ AC_ERROR(failure running ${python-config} --ldflags)
+ fi
fi
fi
- python_prefix=`${python_prog} ${srcdir}/python/python-config.py --exec-prefix`
+ python_prefix=`${python_config} --exec-prefix`
if test $? != 0; then
have_python_config=failed
if test "${with_python}" != auto; then
- AC_ERROR(failure running python-config --exec-prefix)
+ AC_ERROR(failure running ${python-config} --exec-prefix)
fi
fi
else
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Modify python-config.py or replace it with official one to support python3
2020-01-22 2:04 ` 傅继晗
@ 2020-01-22 2:16 ` 傅继晗
2020-01-22 6:12 ` 傅继晗
0 siblings, 1 reply; 6+ messages in thread
From: 傅继晗 @ 2020-01-22 2:16 UTC (permalink / raw)
To: gdb-patches; +Cc: Christian Biesinger
[-- Attachment #1: Type: text/plain, Size: 9449 bytes --]
fix some typo.
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -834,29 +834,35 @@ else
esac
esac
+ python_config=
if test "${python_prog}" != missing; then
+ AC_CHECK_FILE([${python_prog}-config],[python_config="${python_prog}-config"],[python_config="${python_prog}
${srcdir}/python/python-config.py"])
# 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_config} --includes`
if test $? != 0; then
have_python_config=failed
if test "${with_python}" != auto; then
- AC_ERROR(failure running python-config --includes)
+ AC_ERROR(failure running ${python_config} --includes)
fi
fi
- python_libs=`${python_prog} ${srcdir}/python/python-config.py --ldflags`
+# For python 3.8+ there must be a "--embed" flag to show lib version.
+ python_libs=`${python_config} --ldflags --embed`
if test $? != 0; then
- have_python_config=failed
- if test "${with_python}" != auto; then
- AC_ERROR(failure running python-config --ldflags)
+ python_libs=`${python_config} --ldflags`
+ if test $? != 0; then
+ have_python_config=failed
+ if test "${with_python}" != auto; then
+ AC_ERROR(failure running ${python_config} --ldflags)
+ fi
fi
fi
- python_prefix=`${python_prog} ${srcdir}/python/python-config.py
--exec-prefix`
+ python_prefix=`${python_config} --exec-prefix`
if test $? != 0; then
have_python_config=failed
if test "${with_python}" != auto; then
- AC_ERROR(failure running python-config --exec-prefix)
+ AC_ERROR(failure running ${python_config} --exec-prefix)
fi
fi
else
傅继晗 <fjhhz1997@gmail.com> 于2020年1月22日周三 上午9:56写道:
>
> now I improve the patch to be compatible with python2.7 python 3.7 and
> python3.8+
>
>
> index gdb/configure.ac
> ============================
>
> --- a/gdb/configure.ac
> +++ b/gdb/configure.ac
> @@ -834,29 +834,35 @@ else
> esac
> esac
>
> + python_config=
> if test "${python_prog}" != missing; then
> + AC_CHECK_FILE([${python_prog}-config],[python_config="${python_prog}-config"],[python_config="${python_prog}
> ${srcdir}/python/python-config.py"])
> # 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_config} --includes`
> if test $? != 0; then
> have_python_config=failed
> if test "${with_python}" != auto; then
> - AC_ERROR(failure running python-config --includes)
> + AC_ERROR(failure running ${python-config} --includes)
> fi
> fi
> - python_libs=`${python_prog} ${srcdir}/python/python-config.py --ldflags`
> +# For python 3.8+ there must be a "--embed" flag to show lib version.
> + python_libs=`${python_config} --ldflags --embed`
> if test $? != 0; then
> - have_python_config=failed
> - if test "${with_python}" != auto; then
> - AC_ERROR(failure running python-config --ldflags)
> + python_libs=`${python_config} --ldflags`
> + if test $? != 0; then
> + have_python_config=failed
> + if test "${with_python}" != auto; then
> + AC_ERROR(failure running ${python-config} --ldflags)
> + fi
> fi
> fi
> - python_prefix=`${python_prog} ${srcdir}/python/python-config.py
> --exec-prefix`
> + python_prefix=`${python_config} --exec-prefix`
> if test $? != 0; then
> have_python_config=failed
> if test "${with_python}" != auto; then
> - AC_ERROR(failure running python-config --exec-prefix)
> + AC_ERROR(failure running ${python-config} --exec-prefix)
> fi
> fi
> else
>
> 傅继晗 <fjhhz1997@gmail.com> 于2020年1月21日周二 下午7:41写道:
> >
> > ok.that is,and here is my patch.
> > Tested with autoconf 2.69 and python3.8.
> >
> >
> > index:gdb/configure.ac
> > ============================
> > --- a/gdb/configure.ac
> > +++ b/gdb/configure.ac
> > @@ -834,29 +834,31 @@
> > esac
> > esac
> >
> > + python_config=
> > if test "${python_prog}" != missing; then
> > + AC_CHECK_FILE([${python_prog}-config],[python_config="${python_prog}-config
> > --embed"],[python_config="${python_prog}
> > ${srcdir}/python/python-config.py"])
> > # 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_config} --includes`
> > if test $? != 0; then
> > have_python_config=failed
> > if test "${with_python}" != auto; then
> > - AC_ERROR(failure running python-config --includes)
> > + AC_ERROR(failure running ${python_config} --includes)
> > fi
> > fi
> > - python_libs=`${python_prog} ${srcdir}/python/python-config.py --ldflags`
> > + python_libs=`${python_config} --ldflags`
> > if test $? != 0; then
> > have_python_config=failed
> > if test "${with_python}" != auto; then
> > - AC_ERROR(failure running python-config --ldflags)
> > + AC_ERROR(failure running ${python_config} --ldflags)
> > fi
> > fi
> > - python_prefix=`${python_prog} ${srcdir}/python/python-config.py
> > --exec-prefix`
> > + python_prefix=`${python_config} --exec-prefix`
> > if test $? != 0; then
> > have_python_config=failed
> > if test "${with_python}" != auto; then
> > - AC_ERROR(failure running python-config --exec-prefix)
> > + AC_ERROR(failure running ${python_config} --exec-prefix)
> > fi
> > fi
> > else
> >
> > Christian Biesinger <cbiesinger@google.com> 于2020年1月21日周二 上午8:30写道:
> > >
> > > 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)))
[-- Attachment #2: python-config.patch --]
[-- Type: application/octet-stream, Size: 1863 bytes --]
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -834,29 +834,35 @@ else
esac
esac
+ python_config=
if test "${python_prog}" != missing; then
+ AC_CHECK_FILE([${python_prog}-config],[python_config="${python_prog}-config"],[python_config="${python_prog} ${srcdir}/python/python-config.py"])
# 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_config} --includes`
if test $? != 0; then
have_python_config=failed
if test "${with_python}" != auto; then
- AC_ERROR(failure running python-config --includes)
+ AC_ERROR(failure running ${python_config} --includes)
fi
fi
- python_libs=`${python_prog} ${srcdir}/python/python-config.py --ldflags`
+# For python 3.8+ there must be a "--embed" flag to show lib version.
+ python_libs=`${python_config} --ldflags --embed`
if test $? != 0; then
- have_python_config=failed
- if test "${with_python}" != auto; then
- AC_ERROR(failure running python-config --ldflags)
+ python_libs=`${python_config} --ldflags`
+ if test $? != 0; then
+ have_python_config=failed
+ if test "${with_python}" != auto; then
+ AC_ERROR(failure running ${python_config} --ldflags)
+ fi
fi
fi
- python_prefix=`${python_prog} ${srcdir}/python/python-config.py --exec-prefix`
+ python_prefix=`${python_config} --exec-prefix`
if test $? != 0; then
have_python_config=failed
if test "${with_python}" != auto; then
- AC_ERROR(failure running python-config --exec-prefix)
+ AC_ERROR(failure running ${python_config} --exec-prefix)
fi
fi
else
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Modify python-config.py or replace it with official one to support python3
2020-01-22 2:16 ` 傅继晗
@ 2020-01-22 6:12 ` 傅继晗
0 siblings, 0 replies; 6+ messages in thread
From: 傅继晗 @ 2020-01-22 6:12 UTC (permalink / raw)
To: gdb-patches; +Cc: Christian Biesinger
[-- Attachment #1: Type: text/plain, Size: 2042 bytes --]
add warning to explain that if no python-config found,fall back to
internal copy "gdb/python/python-config.py"
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -834,29 +834,36 @@ else
esac
esac
+ python_config=
if test "${python_prog}" != missing; then
+ AC_CHECK_FILE([${python_prog}-config],[python_config="${python_prog}-config"],[python_config="${python_prog}
${srcdir}/python/python-config.py"
+AC_MSG_WARN(python-config not found! Fall back to internal copy.)])
# 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_config} --includes`
if test $? != 0; then
have_python_config=failed
if test "${with_python}" != auto; then
- AC_ERROR(failure running python-config --includes)
+ AC_ERROR(failure running ${python_config} --includes)
fi
fi
- python_libs=`${python_prog} ${srcdir}/python/python-config.py --ldflags`
+# For python 3.8+ there must be a "--embed" flag to show lib version.
+ python_libs=`${python_config} --ldflags --embed`
if test $? != 0; then
- have_python_config=failed
- if test "${with_python}" != auto; then
- AC_ERROR(failure running python-config --ldflags)
+ python_libs=`${python_config} --ldflags`
+ if test $? != 0; then
+ have_python_config=failed
+ if test "${with_python}" != auto; then
+ AC_ERROR(failure running ${python_config} --ldflags)
+ fi
fi
fi
- python_prefix=`${python_prog} ${srcdir}/python/python-config.py
--exec-prefix`
+ python_prefix=`${python_config} --exec-prefix`
if test $? != 0; then
have_python_config=failed
if test "${with_python}" != auto; then
- AC_ERROR(failure running python-config --exec-prefix)
+ AC_ERROR(failure running ${python_config} --exec-prefix)
fi
fi
else
[-- Attachment #2: python-config.patch --]
[-- Type: application/octet-stream, Size: 1930 bytes --]
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -834,29 +834,36 @@ else
esac
esac
+ python_config=
if test "${python_prog}" != missing; then
+ AC_CHECK_FILE([${python_prog}-config],[python_config="${python_prog}-config"],[python_config="${python_prog} ${srcdir}/python/python-config.py"
+AC_MSG_WARN(python-config not found! Fall back to internal copy.)])
# 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_config} --includes`
if test $? != 0; then
have_python_config=failed
if test "${with_python}" != auto; then
- AC_ERROR(failure running python-config --includes)
+ AC_ERROR(failure running ${python_config} --includes)
fi
fi
- python_libs=`${python_prog} ${srcdir}/python/python-config.py --ldflags`
+# For python 3.8+ there must be a "--embed" flag to show lib version.
+ python_libs=`${python_config} --ldflags --embed`
if test $? != 0; then
- have_python_config=failed
- if test "${with_python}" != auto; then
- AC_ERROR(failure running python-config --ldflags)
+ python_libs=`${python_config} --ldflags`
+ if test $? != 0; then
+ have_python_config=failed
+ if test "${with_python}" != auto; then
+ AC_ERROR(failure running ${python_config} --ldflags)
+ fi
fi
fi
- python_prefix=`${python_prog} ${srcdir}/python/python-config.py --exec-prefix`
+ python_prefix=`${python_config} --exec-prefix`
if test $? != 0; then
have_python_config=failed
if test "${with_python}" != auto; then
- AC_ERROR(failure running python-config --exec-prefix)
+ AC_ERROR(failure running ${python_config} --exec-prefix)
fi
fi
else
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-01-22 5:26 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-20 14:05 [PATCH] Modify python-config.py or replace it with official one to support python3 傅继晗
2020-01-20 15:05 ` 傅继晗
2020-01-21 1:31 ` Christian Biesinger via gdb-patches
[not found] ` <CAPwS6qOtjH-g88iy7DmUoMyUO1F7O+vZQWoWNZfzZoVkSJ=qtQ@mail.gmail.com>
2020-01-22 2:04 ` 傅继晗
2020-01-22 2:16 ` 傅继晗
2020-01-22 6:12 ` 傅继晗
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox