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

_struct module compilation error under Cygwin 1.7.17 on Python 3.4 #65323

Closed
dellairjie mannequin opened this issue Apr 1, 2014 · 17 comments
Closed

_struct module compilation error under Cygwin 1.7.17 on Python 3.4 #65323

dellairjie mannequin opened this issue Apr 1, 2014 · 17 comments
Labels
3.7 (EOL) end of life build The build process and cross-build

Comments

@dellairjie
Copy link
Mannequin

dellairjie mannequin commented Apr 1, 2014

BPO 21124
Nosy @zware, @serhiy-storchaka, @ma8ma
PRs
  • [Do Not Merge] Convert Misc/NEWS so that it is managed by towncrier #552
  • Files
  • _struct.c.txt
  • Build.log
  • 3.4-struct.patch: patch of compiling Modules/_struct.c on Cygwin
  • PyType_Ready-unpackiter_type.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 2016-10-04.06:25:05.204>
    created_at = <Date 2014-04-01.14:52:31.941>
    labels = ['build', '3.7']
    title = '_struct module compilation error under Cygwin 1.7.17 on Python 3.4'
    updated_at = <Date 2017-03-31.16:36:22.442>
    user = 'https://bugs.python.org/dellairjie'

    bugs.python.org fields:

    activity = <Date 2017-03-31.16:36:22.442>
    actor = 'dstufft'
    assignee = 'none'
    closed = True
    closed_date = <Date 2016-10-04.06:25:05.204>
    closer = 'python-dev'
    components = ['Build']
    creation = <Date 2014-04-01.14:52:31.941>
    creator = 'dellair.jie'
    dependencies = []
    files = ['34695', '34696', '34701', '44929']
    hgrepos = []
    issue_num = 21124
    keywords = ['patch']
    message_count = 17.0
    messages = ['215321', '215322', '215349', '215359', '215379', '215385', '217517', '217562', '217577', '277852', '277853', '277874', '277887', '277891', '277959', '278012', '278013']
    nosy_count = 5.0
    nosy_names = ['python-dev', 'zach.ware', 'serhiy.storchaka', 'dellair.jie', 'masamoto']
    pr_nums = ['552']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'compile error'
    url = 'https://bugs.python.org/issue21124'
    versions = ['Python 3.7']

    @dellairjie
    Copy link
    Mannequin Author

    dellairjie mannequin commented Apr 1, 2014

    Dear all,

    I am compiling Python 3.4 on Cygwin 1.7.17.

    The following has been done in order to reach the point where _struct module failed.

    A clean Python 3.4
    Applied patches:
    cygwin_si_band.patch in bpo-21085
    0001-CYGWIN-issue13756-Python-make-fail-on-cygwin.patch in bpo-13756
    0019-MINGW-export-_PyNode_SizeOf-as-PyAPI-for-parser-modu.patch in bpo-186373
    configure + make

    The issue happened during make:
    building '_struct' extension
    gcc -Wno-unused-result -Werror=declaration-after-statement -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I./Include -I. -IInclude -I/cygdrive/c/temp/Python-3.4.0/Include -I/cygdrive/c/temp/Python-3.4.0 -c /cygdrive/c/temp/Python-3.4.0/Modules/_struct.c -o build/temp.cygwin-1.7.17-i686-3.4/cygdrive/c/temp/Python-3.4.0/Modules/_struct.o
    /cygdrive/c/temp/Python-3.4.0/Modules/_struct.c:1630:5: error: initializer element is not constant
    /cygdrive/c/temp/Python-3.4.0/Modules/_struct.c:1630:5: error: (near initialization for ‘unpackiter_type.ob_base.ob_base.ob_type’)

    Please feel free to find the build.log and the output of _struct.c.txt (gcc with -dD -E -DPy_BUILD_core) for more information.

    Thanks in advance,
    Br,
    Dellair

    @dellairjie
    Copy link
    Mannequin Author

    dellairjie mannequin commented Apr 1, 2014

    The full build log

    @ned-deily
    Copy link
    Member

    This looks like a duplicate of bpo-6672.

    @ned-deily ned-deily added the build The build process and cross-build label Apr 2, 2014
    @ned-deily ned-deily changed the title Compilation error on _struct module on Python 3.4 _struct module compilation error under Cygwin 1.7.17 on Python 3.4 Apr 2, 2014
    @dellairjie
    Copy link
    Mannequin Author

    dellairjie mannequin commented Apr 2, 2014

    Neil,

    It doesn't look like a duplicate of bpo-6672.
    The one in bpo-6672 was for Mingw, all the patches simply added __MINGW32__ to __CYGWIN__ build structure.
    While my issue is, the build failed with _struct.c on Cygwin. So the module is recognized, just didn't pass the compilation.

    Br,
    Dellair

    @ma8ma
    Copy link
    Mannequin

    ma8ma mannequin commented Apr 2, 2014

    I wrote a patch file.
    In other extention module source codes, global variable PyTypeObject has initialized to using "PyVarObject_HEAD_INIT(NULL, 0)".
    And so, as with other modules, I tried to edit and compiling _struct.c in Cygwin 1.7.28.
    The module compiling was passing, And struct module passed a test "python3.4 -m test test_struct".

    @dellairjie
    Copy link
    Mannequin Author

    dellairjie mannequin commented Apr 2, 2014

    Yamamoto,

    Thanks, the patch you offered did make the _struct error disappeared. I will do a bit more testing.

    Dellair

    @dellairjie
    Copy link
    Mannequin Author

    dellairjie mannequin commented Apr 29, 2014

    Hello masamoto,

    The patch you provided works quite well.
    The build passed and Python calls are successfully.
    Please let me know what else you need me to test in order to have the patch accepted or else feel free to close it with Resolution Fixed.

    Thanks,
    Dellair

    @ma8ma
    Copy link
    Mannequin

    ma8ma mannequin commented Apr 29, 2014

    I have solved about compiling _struct module too.
    I have no authority of this issues, So please close of issues.

    @dellairjie
    Copy link
    Mannequin Author

    dellairjie mannequin commented Apr 30, 2014

    Fixed with the patch.

    @dellairjie dellairjie mannequin closed this as completed Apr 30, 2014
    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Oct 2, 2016

    New changeset 3bde312ae936 by Zachary Ware in branch 'default':
    Issue bpo-21124: Fix building _struct on Cygwin.
    https://hg.python.org/cpython/rev/3bde312ae936

    @zware
    Copy link
    Member

    zware commented Oct 2, 2016

    For future reference, having a patch attached to the issue does not mean the issue is fixed, and it should not be closed.

    @zware zware added 3.7 (EOL) end of life build The build process and cross-build labels Oct 2, 2016
    @serhiy-storchaka
    Copy link
    Member

    PyType_Ready() should be called for unpackiter_type.

    See also bpo-26906.

    @ma8ma
    Copy link
    Mannequin

    ma8ma mannequin commented Oct 2, 2016

    I wrote a patch to add the unpackiter_type initialization into PyInit__struct function. I has confirmed solve bpo-28337 on ubuntu x86 16.04.

    @zware
    Copy link
    Member

    zware commented Oct 2, 2016

    Do we not have a unit test for that?

    @ma8ma
    Copy link
    Mannequin

    ma8ma mannequin commented Oct 3, 2016

    unpack_iterator type has not been registered into _struct module. And all users get only unpack_iterator object from function returning iterator. The object iterating doesn't need reference to type. Therefore, I think issue finish by PyType_Ready fix because this segfault doesn't have big impact.

    However, I think if possible, it is preferable that extension module having un-initialize type objects gets a compile error at build time. And impossible case for compile error is better that wrong extension module always fails import.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Oct 4, 2016

    New changeset c4eb211fb38b by Zachary Ware in branch 'default':
    Closes bpo-21124, bpo-28337: Call PyType_Ready on unpackiter_type.
    https://hg.python.org/cpython/rev/c4eb211fb38b

    @python-dev python-dev mannequin closed this as completed Oct 4, 2016
    @zware
    Copy link
    Member

    zware commented Oct 4, 2016

    Thanks for the patch again :).

    The last idea you mentioned sounds somewhat interesting, please open a new issue for it if you'd like to pursue it.

    @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.7 (EOL) end of life build The build process and cross-build
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants