3.6: python3 incompatibility crashes the build on linux

[email protected]
Newsgroups gmane.comp.gnu.mailutils.bugs
Message-ID <[email protected]>
Hello

build of latest 3.6 fails for me when python3 is enabled with:

    ----8<----
    /usr/bin/ld: ../python/3/libmu_py/.libs/libmu_py.so: undefined reference to `PyString_FromString'
    /usr/bin/ld: ../python/3/libmu_py/.libs/libmu_py.so: undefined reference to `PyInt_FromLong'
    collect2: error: ld returned 1 exit status
    make[4]: *** [Makefile:1152: maidag] Error 1
    make[4]: Leaving directory '/home/balducci/tmp/install-us-d/mailutils-3.5.90.d/mailutils-3.6/maidag'
    ---->8----

It turns out that PyString_FromString and PyInt_FromLong aren't in
python3's API (at least 3.5.5<=python3<=3.8.0a1, the
versions I could try) and should be replaced by PyUnicode_FromString
and PyLong_FromLong, resp. The following crude workaround fixes the
build for me

    ----8<----
    diff -c python/3/libmu_py/mailcap.c.FIX_MAILCAP_C python/3/libmu_py/mailcap.c
    *** python/3/libmu_py/mailcap.c.FIX_MAILCAP_C	Sun Feb 24 10:53:17 2019
    --- python/3/libmu_py/mailcap.c	Sun Feb 24 10:53:17 2019
    ***************
    *** 1,3 ****
    --- 1,6 ----
    + #define  PyString_FromString  PyUnicode_FromString
    + #define  PyInt_FromLong       PyLong_FromLong
    + 
      /* GNU Mailutils -- a suite of utilities for electronic mail
         Copyright (C) 2009-2019 Free Software Foundation, Inc.
    ---->8----

My specs:

install:156> uname -ar
Linux  4.20.10 #1 SMP Sun Feb 17 14:34:36 CET 2019 x86_64 GNU/Linux

install:157> gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/opt/stow.d/versions/gcc-8.2.0/usr/lib64/gcc/x86_64-pc-linux-gnu/8.2.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /home/balducci/tmp/install-us-d/gcc-8.2.0.d/gcc-8.2.0/configure --prefix=/opt/stow.d/versions/gcc-8.2.0/usr --libdir=/opt/stow.d/versions/gcc-8.2.0/usr/lib64 --libexecdir=/opt/stow.d/versions/gcc-8.2.0/usr/lib64 --enable-shared --disable-bootstrap --enable-languages=c,c++,objc,fortran --enable-multilib
Thread model: posix
gcc version 8.2.0 (GCC) 

install:158> python --version
Python 3.8.0a1

ciao
-g
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.