Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing definition in configure.ac causing autoreconf to create damaged configure script #87783

Closed
congma mannequin opened this issue Mar 24, 2021 · 11 comments
Closed

Missing definition in configure.ac causing autoreconf to create damaged configure script #87783

congma mannequin opened this issue Mar 24, 2021 · 11 comments
Labels
3.8 only security fixes 3.9 only security fixes 3.10 only security fixes build The build process and cross-build

Comments

@congma
Copy link
Mannequin

congma mannequin commented Mar 24, 2021

BPO 43617
Nosy @vstinner, @tiran, @eli-schwartz, @congma
PRs
  • bpo-43617: Check autoconf-archive package in configure.ac (GH-25016) #25016
  • [3.9] bpo-43617: Check autoconf-archive package in configure.ac (GH-25016) (GH-25034) #25034
  • [3.8] bpo-43617: Check autoconf-archive package in configure.ac (GH-25016) (GH-25035) #25035
  • Files
  • 0001-configure-use-m4-forbidden-patterns-to-ensure-autore.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2021-03-27.21:48:36.188>
    created_at = <Date 2021-03-24.14:52:18.322>
    labels = ['build', '3.8', '3.9', '3.10']
    title = 'Missing definition in configure.ac causing autoreconf to create damaged configure script'
    updated_at = <Date 2021-04-11.22:23:03.317>
    user = 'https://github.com/congma'

    bugs.python.org fields:

    activity = <Date 2021-04-11.22:23:03.317>
    actor = 'eschwartz'
    assignee = 'none'
    closed = True
    closed_date = <Date 2021-03-27.21:48:36.188>
    closer = 'christian.heimes'
    components = ['Build']
    creation = <Date 2021-03-24.14:52:18.322>
    creator = 'congma'
    dependencies = []
    files = ['49954']
    hgrepos = []
    issue_num = 43617
    keywords = ['patch']
    message_count = 11.0
    messages = ['389463', '389465', '389466', '389467', '389472', '389481', '389600', '389619', '389620', '389622', '390803']
    nosy_count = 4.0
    nosy_names = ['vstinner', 'christian.heimes', 'eschwartz', 'congma']
    pr_nums = ['25016', '25034', '25035']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'compile error'
    url = 'https://bugs.python.org/issue43617'
    versions = ['Python 3.8', 'Python 3.9', 'Python 3.10']

    @congma
    Copy link
    Mannequin Author

    congma mannequin commented Mar 24, 2021

    The problem
    -----------

    In the repository, the definition for AX_CHECK_COMPILE_FLAG in Python's configure.ac file is missing. If autoreconf is run, an invalid configure script is generated. The following is the behaviour of running autoreconf followed by configure:

    # In cpython repository top-level directory
    $ autoreconf
    $ mkdir build
    $ cd build
    $ ../configure  # <- using newly generated configure script
    [... omitted ...]
    checking for --enable-optimizations... no
    ../configure: line 6498: syntax error near unexpected token `-fno-semantic-interposition,'
    ../configure: line 6498: `      AX_CHECK_COMPILE_FLAG(-fno-semantic-interposition,'
    

    The solution
    ------------

    It appears a file was missing in the m4/ directory. The file matches this one from the Autoconf Archive:

    https://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html

    Simply adding the correct m4 file to m4/ should make autoreconf work.

    @congma congma mannequin added build The build process and cross-build labels Mar 24, 2021
    @vstinner
    Copy link
    Member

    If autoreconf is run, ...

    I never used autoreconf. If you don't run it, ./configure works fine.

    I only use "autoconf" and "autoheader".

    $ ./configure --enable-optimizations --enable-shared
    (...)
    $ grep semantic Makefile
    CONFIGURE_CFLAGS_NODIST= -fno-semantic-interposition -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -fvisibility=hidden
    CONFIGURE_LDFLAGS_NODIST= -fno-semantic-interposition

    @congma
    Copy link
    Mannequin Author

    congma mannequin commented Mar 24, 2021

    From the configure.ac file:

    dnl ***********************************************
    dnl * Please run autoreconf to test your changes! *
    dnl ***********************************************

    I take it to mean "if configure.ac is changed, run autoreconf first", and that's what I did. Could you let me know what is the intended way to modify configure.ac and have it take effect?

    @vstinner
    Copy link
    Member

    Ah, maybe the configure.ac comment should be updated to suggest running "autoconf" instead ;-)

    @tiran
    Copy link
    Member

    tiran commented Mar 24, 2021

    The extra macros are provided by optional packages. On Fedora and Debian/Ubuntu the package is called autoconf-archive.

    @congma
    Copy link
    Mannequin Author

    congma mannequin commented Mar 24, 2021

    The extra macros are provided by optional packages. On Fedora and Debian/Ubuntu the package is called autoconf-archive.

    Thank you very much. This (and the patch) is clearing things up for me a lot. At first I thought I was supposed to copy the m4 files over from the autoconf archive into the m4 directory under the repo.

    @tiran
    Copy link
    Member

    tiran commented Mar 27, 2021

    New changeset 5d6e8c1 by Christian Heimes in branch 'master':
    bpo-43617: Check autoconf-archive package in configure.ac (GH-25016)
    5d6e8c1

    @tiran
    Copy link
    Member

    tiran commented Mar 27, 2021

    New changeset 064bc07 by Christian Heimes in branch '3.9':
    [3.9] bpo-43617: Check autoconf-archive package in configure.ac (GH-25016) (GH-25034)
    064bc07

    @tiran
    Copy link
    Member

    tiran commented Mar 27, 2021

    New changeset e516290 by Christian Heimes in branch '3.8':
    [3.8] bpo-43617: Check autoconf-archive package in configure.ac (GH-25016) (GH-25035)
    e516290

    @tiran
    Copy link
    Member

    tiran commented Mar 27, 2021

    Thanks for the bug report! I ran into the issue a couple of weeks ago on one machine that had autoconf but not the archive package installed.

    @tiran tiran added 3.8 only security fixes 3.9 only security fixes 3.10 only security fixes labels Mar 27, 2021
    @tiran tiran closed this as completed Mar 27, 2021
    @eli-schwartz
    Copy link
    Mannequin

    eli-schwartz mannequin commented Apr 11, 2021

    Hmm, I've seen this accomplished elsewhere using m4_pattern_forbid, which would make autoreconf fail with the following message:

    configure.ac:17: error: possibly undefined macro: AX_C_FLOAT_WORDS_BIGENDIAN
          If this token and others are legitimate, please use m4_pattern_allow.
          See the Autoconf documentation.
    configure.ac:5586: error: possibly undefined macro: AX_CHECK_OPENSSL
    autoreconf: error: /usr/bin/autoconf failed with exit status: 1
    

    Example patch attached.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.8 only security fixes 3.9 only security fixes 3.10 only security fixes build The build process and cross-build
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants