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

Header dependent _uuid build failure on Fedora 27 #76808

Closed
ncoghlan opened this issue Jan 23, 2018 · 11 comments
Closed

Header dependent _uuid build failure on Fedora 27 #76808

ncoghlan opened this issue Jan 23, 2018 · 11 comments
Labels
3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes build The build process and cross-build

Comments

@ncoghlan
Copy link
Contributor

BPO 32627
Nosy @ncoghlan, @vstinner, @tiran, @ned-deily, @moubctez, @miss-islington
PRs
  • bpo-32627: Fix compile error when _uuid headers conflicting included #11751
  • bpo-32627: Fix compile error when _uuid headers conflicting included #11751
  • bpo-32627: Fix compile error when _uuid headers conflicting included #11751
  • bpo-32627: Fix compile error when _uuid headers conflicting included #11751
  • [3.7] bpo-32627: Fix compile error when conflicting _uuid headers included (GH-11751) #14347
  • [3.8] bpo-32627: Fix compile error when conflicting _uuid headers included (GH-11751) #14348
  • 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 2019-06-24.18:32:24.591>
    created_at = <Date 2018-01-23.01:54:03.815>
    labels = ['3.8', 'build', '3.7', '3.9']
    title = 'Header dependent _uuid build failure on Fedora 27'
    updated_at = <Date 2019-07-02.22:34:03.719>
    user = 'https://github.com/ncoghlan'

    bugs.python.org fields:

    activity = <Date 2019-07-02.22:34:03.719>
    actor = 'ned.deily'
    assignee = 'none'
    closed = True
    closed_date = <Date 2019-06-24.18:32:24.591>
    closer = 'ned.deily'
    components = []
    creation = <Date 2018-01-23.01:54:03.815>
    creator = 'ncoghlan'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 32627
    keywords = ['patch', 'patch', 'patch', 'patch']
    message_count = 9.0
    messages = ['310459', '310460', '310465', '316255', '346423', '346426', '346428', '346430', '347164']
    nosy_count = 7.0
    nosy_names = ['ncoghlan', 'vstinner', 'christian.heimes', 'ned.deily', 'adam@NetBSD.org', 'miss-islington', 'fthommen']
    pr_nums = ['11751', '11751', '11751', '11751', '14347', '14348']
    priority = 'low'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'compile error'
    url = 'https://bugs.python.org/issue32627'
    versions = ['Python 3.7', 'Python 3.8', 'Python 3.9']

    @ncoghlan
    Copy link
    Contributor Author

    I'm hitting a build failure relating to the new _uuid module on Fedora 27:

    ==============

    building '_uuid' extension
    gcc -pthread -fPIC -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -I./Include -I. -I/usr/local/include -I/home/ncoghlan/devel/cpython/Include -I/home/ncoghlan/devel/cpython -c /home/ncoghlan/devel/cpython/Modules/_uuidmodule.c -o build/temp.linux-x86_64-3.7/home/ncoghlan/devel/cpython/Modules/_uuidmodule.o
    In file included from /home/ncoghlan/devel/cpython/Modules/_uuidmodule.c:8:0:
    /usr/include/uuid.h:94:24: error: conflicting types foruuid_ttypedef struct uuid_st uuid_t;
                            ^~~~~~
    In file included from /home/ncoghlan/devel/cpython/Modules/_uuidmodule.c:5:0:
    /usr/include/uuid/uuid.h:44:23: note: previous declaration ofuuid_twas here
     typedef unsigned char uuid_t[16];
                           ^~~~~~
    In file included from /home/ncoghlan/devel/cpython/Modules/_uuidmodule.c:8:0:
    /usr/include/uuid.h:107:22: error: conflicting types foruuid_compareextern uuid_rc_t     uuid_compare  (const uuid_t  *_uuid, const uuid_t *_uuid2, int *_result);
                          ^~~~~~~~~~~~
    In file included from /home/ncoghlan/devel/cpython/Modules/_uuidmodule.c:5:0:
    /usr/include/uuid/uuid.h:73:12: note: previous declaration ofuuid_comparewas here
     extern int uuid_compare(const uuid_t uu1, const uuid_t uu2);
                ^~~~~~~~~~~~
    /home/ncoghlan/devel/cpython/Modules/_uuidmodule.c: In functionpy_uuid_generate_time_safe’:
    /home/ncoghlan/devel/cpython/Modules/_uuidmodule.c:15:12: error: storage size ofuuidisnt known
         uuid_t uuid;
                ^~~~
    /home/ncoghlan/devel/cpython/Modules/_uuidmodule.c:15:12: warning: unused variableuuid’ [-Wunused-variable]
    /home/ncoghlan/devel/cpython/Modules/_uuidmodule.c:29:1: warning: control reaches end of non-void function [-Wreturn-type]
     }
     ^

    ==============

    From my initial investigation, I think the issue may be related to my previous attempt to fix this in 53efbf3#diff-2eeaed663bd0d25b7e608891384b7298 and the fact that there are *two* "uuid.h" headers available in the Fedora repos:

    • /usr/include/uuid.h (provided by uuid-devel)
    • /usr/include/uuid/uuid.h (provided by libuuid-devel)

    Right now, the build works if you have "libuuid-devel" installed, but do *not* have "uuid-devel" installed.

    With both installed, neither installed, or only uuid-devel installed, the build will fail, but the exact errors reported will vary. (There's also a distinct set of compile errors you can get if you forget to rerun configure after installing the additional headers)

    Reverting my previous commit (and replacing it with a comment saying we're specifically looking for "uuid/uuid.h", not "uuid.h") may be enough to handle the case where both are installed.

    @ncoghlan ncoghlan added 3.7 (EOL) end of life 3.8 only security fixes build The build process and cross-build labels Jan 23, 2018
    @ncoghlan
    Copy link
    Contributor Author

    Reverting my previous commit doesn't fix the problem: if both uuid-devel and libuuid-devel are installed, then it reports that the necessary bits to build _uuid weren't found, without even attempting to compile it at all.

    @ncoghlan
    Copy link
    Contributor Author

    (Reducing priority since "sudo dnf remove uuid-devel" is a straightforward workaround)

    @moubctez
    Copy link
    Mannequin

    moubctez mannequin commented May 7, 2018

    Some systems might have both uuid.h and uuid/uuid.h. For example, NetBSD provides /usr/include/uuid.h, and one might also install libuuid from a package, and the latter has uuid/uuid.h.

    To fix this, do not include both files, when both have been detected.

    Here is a patch:

    --- Modules/_uuidmodule.c.orig
    +++ Modules/_uuidmodule.c
    @@ -3,8 +3,7 @@
     #include "Python.h"
     #ifdef HAVE_UUID_UUID_H
     #include <uuid/uuid.h>
    -#endif
    -#ifdef HAVE_UUID_H
    +#elif defined(HAVE_UUID_H)
     #include <uuid.h>
     #endif

    @ned-deily
    Copy link
    Member

    New changeset 6ffd9b0 by Ned Deily (ziheng) in branch 'master':
    bpo-32627: Fix compile error when conflicting _uuid headers included (GH-11751)
    6ffd9b0

    @miss-islington
    Copy link
    Contributor

    New changeset 742b16e by Miss Islington (bot) in branch '3.7':
    bpo-32627: Fix compile error when conflicting _uuid headers included (GH-11751)
    742b16e

    @miss-islington
    Copy link
    Contributor

    New changeset 76b72f6 by Miss Islington (bot) in branch '3.8':
    bpo-32627: Fix compile error when conflicting _uuid headers included (GH-11751)
    76b72f6

    @ned-deily
    Copy link
    Member

    Thanks, @adam, for the analysis and thanks, zihengCat, for the PR.

    @ned-deily ned-deily added the 3.9 only security fixes label Jun 24, 2019
    @ned-deily
    Copy link
    Member

    New changeset e90815b by Ned Deily (Miss Islington (bot)) in branch '3.7':
    bpo-32627: Fix compile error when conflicting _uuid headers included (GH-11751)
    e90815b

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    @UnitedMarsupials
    Copy link

    Building Python-3.9.16 on RHEL7 today I still get the error:

    /app/tmp/Python-3.9.16/Modules/_uuidmodule.c: У функції 'py_uuid_generate_time_safe':
    /app/tmp/Python-3.9.16/Modules/_uuidmodule.c:25:12: помилка: storage size of 'uuid' isn't known
       25 |     uuid_t uuid;
          |            ^~~~
    /app/tmp/Python-3.9.16/Modules/_uuidmodule.c:33:5: помилка: too many arguments to function 'uuid_create'
       33 |     uuid_create(&uuid, &status);
          |     ^~~~~~~~~~~
    У файлі, який включено у /app/tmp/Python-3.9.16/Modules/_uuidmodule.c:12:
    /usr/include/uuid.h:97:22: зауваження: оголошено тут
       97 | extern uuid_rc_t     uuid_create   (      uuid_t **_uuid);
    

    The /usr/include/uuid.h is installed by the uuid-devel-1.6.2-26.el7.x86_64 RPM.

    Please, advise. Thank you!

    @vstinner
    Copy link
    Member

    vstinner commented May 4, 2023

    Building Python-3.9.16 on RHEL7 today I still get the error:

    This issue is closed, so other people will not see your message. Python 3.9 no longer accepts bugfixes: https://devguide.python.org/versions/ You should try Python 3.11. Open a new issues if you can still reproduce the issue on a recent Python version.

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes build The build process and cross-build
    Projects
    None yet
    Development

    No branches or pull requests

    5 participants