From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 69932 invoked by alias); 22 Jan 2020 02:04:53 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 69922 invoked by uid 89); 22 Jan 2020 02:04:53 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-19.5 required=5.0 tests=AWL,BAYES_00,BODY_8BITS,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,GARBLED_BODY,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_NUMSUBJECT,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mail-ed1-f68.google.com Received: from mail-ed1-f68.google.com (HELO mail-ed1-f68.google.com) (209.85.208.68) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 22 Jan 2020 02:04:50 +0000 Received: by mail-ed1-f68.google.com with SMTP id j17so5156360edp.3 for ; Tue, 21 Jan 2020 18:04:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=zQ3uJejPLlDf2Rv8WqiuQEUNR8Wrkdc20P1AZ9jygFI=; b=EGtkTb5n2ZE4qTvcJDPY19r2F93SDthJ15bpD8bP/LtxaJzl2IDbpKmvckkFEW9nHl eGAI/gIrXEOIt1Mecmln+dj3nFCe1gjdABWxrwXVRuszTAVL8ldJ7+4tmTNnyetZD8U6 vSbNeorMsCVxWTP+aZwAjDRPQI3+MexIC5iDxCO0by9SH1cH3BXW54l7hao/geofQx75 PxdL0x0BNdxdi6GPPNqJqdMCcJ3vXDA/fysMSLwWdkFqlMcU69IWYz71bQNKzz8Eg/OS GSHES5u1/tODz6eENqgISxUdblbkNS5uk6OpKoI3MyrRctsiLFyqeSPoDlCZ/f7tleVq rpTw== MIME-Version: 1.0 References: In-Reply-To: From: =?UTF-8?B?5YKF57un5pmX?= Date: Wed, 22 Jan 2020 02:16:00 -0000 Message-ID: Subject: Re: [PATCH] Modify python-config.py or replace it with official one to support python3 To: gdb-patches Cc: Christian Biesinger Content-Type: multipart/mixed; boundary="000000000000fcab82059cb0f2a1" X-SW-Source: 2020-01/txt/msg00665.txt.bz2 --000000000000fcab82059cb0f2a1 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Content-length: 9968 fix some typo. --- a/gdb/configure.ac +++ b/gdb/configure.ac @@ -834,29 +834,35 @@ else esac esac + python_config=3D if test "${python_prog}" !=3D missing; then + AC_CHECK_FILE([${python_prog}-config],[python_config=3D"${python_prog}= -config"],[python_config=3D"${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=3Dauto (the default). have_python_config=3Dyes - python_includes=3D`${python_prog} ${srcdir}/python/python-config.py --includes` + python_includes=3D`${python_config} --includes` if test $? !=3D 0; then have_python_config=3Dfailed if test "${with_python}" !=3D auto; then - AC_ERROR(failure running python-config --includes) + AC_ERROR(failure running ${python_config} --includes) fi fi - python_libs=3D`${python_prog} ${srcdir}/python/python-config.py --ldfl= ags` +# For python 3.8+ there must be a "--embed" flag to show lib version. + python_libs=3D`${python_config} --ldflags --embed` if test $? !=3D 0; then - have_python_config=3Dfailed - if test "${with_python}" !=3D auto; then - AC_ERROR(failure running python-config --ldflags) + python_libs=3D`${python_config} --ldflags` + if test $? !=3D 0; then + have_python_config=3Dfailed + if test "${with_python}" !=3D auto; then + AC_ERROR(failure running ${python_config} --ldflags) + fi fi fi - python_prefix=3D`${python_prog} ${srcdir}/python/python-config.py --exec-prefix` + python_prefix=3D`${python_config} --exec-prefix` if test $? !=3D 0; then have_python_config=3Dfailed if test "${with_python}" !=3D auto; then - AC_ERROR(failure running python-config --exec-prefix) + AC_ERROR(failure running ${python_config} --exec-prefix) fi fi else =E5=82=85=E7=BB=A7=E6=99=97 =E4=BA=8E2020=E5=B9=B41= =E6=9C=8822=E6=97=A5=E5=91=A8=E4=B8=89 =E4=B8=8A=E5=8D=889:56=E5=86=99=E9= =81=93=EF=BC=9A > > now I improve the patch to be compatible with python2.7 python 3.7 and > python3.8+ > > > index gdb/configure.ac > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > > --- a/gdb/configure.ac > +++ b/gdb/configure.ac > @@ -834,29 +834,35 @@ else > esac > esac > > + python_config=3D > if test "${python_prog}" !=3D missing; then > + AC_CHECK_FILE([${python_prog}-config],[python_config=3D"${python_pro= g}-config"],[python_config=3D"${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=3Dauto (the default). > have_python_config=3Dyes > - python_includes=3D`${python_prog} ${srcdir}/python/python-config.py > --includes` > + python_includes=3D`${python_config} --includes` > if test $? !=3D 0; then > have_python_config=3Dfailed > if test "${with_python}" !=3D auto; then > - AC_ERROR(failure running python-config --includes) > + AC_ERROR(failure running ${python-config} --includes) > fi > fi > - python_libs=3D`${python_prog} ${srcdir}/python/python-config.py --ld= flags` > +# For python 3.8+ there must be a "--embed" flag to show lib version. > + python_libs=3D`${python_config} --ldflags --embed` > if test $? !=3D 0; then > - have_python_config=3Dfailed > - if test "${with_python}" !=3D auto; then > - AC_ERROR(failure running python-config --ldflags) > + python_libs=3D`${python_config} --ldflags` > + if test $? !=3D 0; then > + have_python_config=3Dfailed > + if test "${with_python}" !=3D auto; then > + AC_ERROR(failure running ${python-config} --ldflags) > + fi > fi > fi > - python_prefix=3D`${python_prog} ${srcdir}/python/python-config.py > --exec-prefix` > + python_prefix=3D`${python_config} --exec-prefix` > if test $? !=3D 0; then > have_python_config=3Dfailed > if test "${with_python}" !=3D auto; then > - AC_ERROR(failure running python-config --exec-prefix) > + AC_ERROR(failure running ${python-config} --exec-prefix) > fi > fi > else > > =E5=82=85=E7=BB=A7=E6=99=97 =E4=BA=8E2020=E5=B9=B41= =E6=9C=8821=E6=97=A5=E5=91=A8=E4=BA=8C =E4=B8=8B=E5=8D=887:41=E5=86=99=E9= =81=93=EF=BC=9A > > > > ok.that is,and here is my patch. > > Tested with autoconf 2.69 and python3.8. > > > > > > index:gdb/configure.ac > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > > --- a/gdb/configure.ac > > +++ b/gdb/configure.ac > > @@ -834,29 +834,31 @@ > > esac > > esac > > > > + python_config=3D > > if test "${python_prog}" !=3D missing; then > > + AC_CHECK_FILE([${python_prog}-config],[python_config=3D"${python_p= rog}-config > > --embed"],[python_config=3D"${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=3Dauto (the default). > > have_python_config=3Dyes > > - python_includes=3D`${python_prog} ${srcdir}/python/python-config.py > > --includes` > > + python_includes=3D`${python_config} --includes` > > if test $? !=3D 0; then > > have_python_config=3Dfailed > > if test "${with_python}" !=3D auto; then > > - AC_ERROR(failure running python-config --includes) > > + AC_ERROR(failure running ${python_config} --includes) > > fi > > fi > > - python_libs=3D`${python_prog} ${srcdir}/python/python-config.py --= ldflags` > > + python_libs=3D`${python_config} --ldflags` > > if test $? !=3D 0; then > > have_python_config=3Dfailed > > if test "${with_python}" !=3D auto; then > > - AC_ERROR(failure running python-config --ldflags) > > + AC_ERROR(failure running ${python_config} --ldflags) > > fi > > fi > > - python_prefix=3D`${python_prog} ${srcdir}/python/python-config.py > > --exec-prefix` > > + python_prefix=3D`${python_config} --exec-prefix` > > if test $? !=3D 0; then > > have_python_config=3Dfailed > > if test "${with_python}" !=3D auto; then > > - AC_ERROR(failure running python-config --exec-prefix) > > + AC_ERROR(failure running ${python_config} --exec-prefix) > > fi > > fi > > else > > > > Christian Biesinger =E4=BA=8E2020=E5=B9=B41=E6= =9C=8821=E6=97=A5=E5=91=A8=E4=BA=8C =E4=B8=8A=E5=8D=888:30=E5=86=99=E9=81= =93=EF=BC=9A > > > > > > On Mon, Jan 20, 2020 at 8:05 AM =E5=82=85=E7=BB=A7=E6=99=97 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=3Dauto (the default). > > > > have_python_config=3Dyes > > > > - python_includes=3D`${python_prog} ${srcdir}/python/python-config.= py --includes` > > > > + python_includes=3D`${python_prog}-config --includes` > > > > if test $? !=3D 0; then > > > > have_python_config=3Dfailed > > > > if test "${with_python}" !=3D auto; then > > > > as_fn_error "failure running python-config --includes" "$LINENO" 5 > > > > fi > > > > fi > > > > - python_libs=3D`${python_prog} ${srcdir}/python/python-config.py -= -ldflags` > > > > + python_libs=3D`${python_prog}-config --ldflags` > > > > if test $? !=3D 0; then > > > > have_python_config=3Dfailed > > > > if test "${with_python}" !=3D auto; then > > > > as_fn_error "failure running python-config --ldflags" "$LINENO" 5 > > > > fi > > > > fi > > > > - python_prefix=3D`${python_prog} ${srcdir}/python/python-config.py= --exec-prefix` > > > > + python_prefix=3D`${python_prog}-config --exec-prefix` > > > > if test $? !=3D 0; then > > > > have_python_config=3Dfailed > > > > if test "${with_python}" !=3D auto; then > > > > > > > > > > > > =E5=82=85=E7=BB=A7=E6=99=97 =E4=BA=8E2020=E5= =B9=B41=E6=9C=8820=E6=97=A5=E5=91=A8=E4=B8=80 =E4=B8=8B=E5=8D=888:02=E5=86= =99=E9=81=93=EF=BC=9A > > > > > > > > > > By default,gdb is compiled with python2 script support on OSX. Ho= wever,when compiled with arg "--with-python=3D/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 of= ficial one.BTW,this issue was once referred at 20 Dec 2012 mail :https://so= urceware.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 > > > > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > > > > --- 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 =3D=3D 'nt': > > > > > libs.insert(0, '-L' + sysconfig.PREFIX + '/l= ibs') > > > > > - if getvar('LINKFORSHARED') is not None: > > > > > + if not getvar('PYTHONFRAMEWORK'): > > > > > libs.extend(getvar('LINKFORSHARED').split()) > > > > > print (to_unix_path(' '.join(libs))) --000000000000fcab82059cb0f2a1 Content-Type: application/octet-stream; name="python-config.patch" Content-Disposition: attachment; filename="python-config.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_k5onzl0m0 Content-length: 2526 LS0tIGEvZ2RiL2NvbmZpZ3VyZS5hYworKysgYi9nZGIvY29uZmlndXJlLmFj CkBAIC04MzQsMjkgKzgzNCwzNSBAQCBlbHNlCiAgICAgZXNhYwogICBlc2Fj CiAKKyAgcHl0aG9uX2NvbmZpZz0KICAgaWYgdGVzdCAiJHtweXRob25fcHJv Z30iICE9IG1pc3Npbmc7IHRoZW4KKyAgICBBQ19DSEVDS19GSUxFKFske3B5 dGhvbl9wcm9nfS1jb25maWddLFtweXRob25fY29uZmlnPSIke3B5dGhvbl9w cm9nfS1jb25maW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N0ICQ/ICE9IDA7IHRoZW4KLSAgICAg IGhhdmVfcHl0aG9uX2NvbmZpZz1mYWlsZWQKLSAgICAgIGlmIHRlc3QgIiR7 d2l0aF9weXRob259IiAhPSBhdXRvOyB0aGVuCi0gICAgICAgIEFDX0VSUk9S KGZhaWx1cmUgcnVubmluZyBweXRob24tY29uZmlnIC0tbGRmbGFncykKKyAg ICAgIHB5dGhvbl9saWJzPWAke3B5dGhvbl9jb25maWd9IC0tbGRmbGFnc2AK KyAgICAgIGlmIHRlc3QgJD8gIT0gMDsgdGhlbgorICAgICAgICBoYXZlX3B5 dGhvbl9jb25maWc9ZmFpbGVkCisgICAgICAgIGlmIHRlc3QgIiR7d2l0aF9w eXRob259IiAhPSBhdXRvOyB0aGVuCisgICAgICAgICAgQUNfRVJST1IoZmFp bHVyZSBydW5uaW5nICR7cHl0aG9uX2NvbmZpZ30gLS1sZGZsYWdzKQorICAg ICAgICBmaQogICAgICAgZmkKICAgICBmaQotICAgIHB5dGhvbl9wcmVmaXg9 YCR7cHl0aG9uX3Byb2d9ICR7c3JjZGlyfS9weXRob24vcHl0aG9uLWNvbmZp Zy5weSAtLWV4ZWMtcHJlZml4YAorICAgIHB5dGhvbl9wcmVmaXg9YCR7cHl0 aG9uX2NvbmZpZ30gLS1leGVjLXByZWZpeGAKICAgICBpZiB0ZXN0ICQ/ICE9 IDA7IHRoZW4KICAgICAgIGhhdmVfcHl0aG9uX2NvbmZpZz1mYWlsZWQKICAg ICAgIGlmIHRlc3QgIiR7d2l0aF9weXRob259IiAhPSBhdXRvOyB0aGVuCi0g ICAgICAgIEFDX0VSUk9SKGZhaWx1cmUgcnVubmluZyBweXRob24tY29uZmln IC0tZXhlYy1wcmVmaXgpCisgICAgICAgIEFDX0VSUk9SKGZhaWx1cmUgcnVu bmluZyAke3B5dGhvbl9jb25maWd9IC0tZXhlYy1wcmVmaXgpCiAgICAgICBm aQogICAgIGZpCiAgIGVsc2UK --000000000000fcab82059cb0f2a1--