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

In tree cross-build fails copying Include/graminit.h to itself #71416

Closed
moreati mannequin opened this issue Jun 5, 2016 · 7 comments
Closed

In tree cross-build fails copying Include/graminit.h to itself #71416

moreati mannequin opened this issue Jun 5, 2016 · 7 comments
Labels
build The build process and cross-build

Comments

@moreati
Copy link
Mannequin

moreati mannequin commented Jun 5, 2016

BPO 27229
Nosy @doko42, @ned-deily, @xdegaye, @vadmium, @moreati
Files
  • graminit-same-file.patch
  • vpath.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-06-07.06:41:23.773>
    created_at = <Date 2016-06-05.13:05:40.936>
    labels = ['build']
    title = 'In tree cross-build fails copying  Include/graminit.h to itself'
    updated_at = <Date 2016-06-07.06:41:23.771>
    user = 'https://github.com/moreati'

    bugs.python.org fields:

    activity = <Date 2016-06-07.06:41:23.771>
    actor = 'martin.panter'
    assignee = 'none'
    closed = True
    closed_date = <Date 2016-06-07.06:41:23.773>
    closer = 'martin.panter'
    components = ['Cross-Build']
    creation = <Date 2016-06-05.13:05:40.936>
    creator = 'Alex.Willmer'
    dependencies = []
    files = ['43235', '43249']
    hgrepos = []
    issue_num = 27229
    keywords = ['patch']
    message_count = 7.0
    messages = ['267417', '267431', '267480', '267497', '267576', '267579', '267599']
    nosy_count = 6.0
    nosy_names = ['doko', 'ned.deily', 'xdegaye', 'python-dev', 'martin.panter', 'Alex.Willmer']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'compile error'
    url = 'https://bugs.python.org/issue27229'
    versions = ['Python 2.7', 'Python 3.5', 'Python 3.6']

    @moreati
    Copy link
    Mannequin Author

    moreati mannequin commented Jun 5, 2016

    While trying a cross compile of Python 3.6 I encountered the following

    alex@martha:~/src/cpython default☿ hg summary
    parent: 101753:31ad7885e2e5
    Issue bpo-27225: Fixed a reference leak in type_new when setting __new__ fails.
    branch: default
    commit: (clean)
    update: (current)

    alex@martha:/src/cpython default☿ ./configure --build=x86_64-linux --host=arm-linux-gnueabihf --disable-ipv6 ac_cv_file__dev_ptc=no ac_cv_file__dev_ptmx=no
    checking for hg... found
    ...
    creating Makefile
    alex@martha:
    /src/cpython default☿ make
    ...
    arm-linux-gnueabihf-gcc -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes Parser/acceler.o Parser/grammar1.o Parser/listnode.o Parser/node.o Parser/parser.o Parser/bitset.o Parser/metagrammar.o Parser/firstsets.o Parser/grammar.o Parser/pgen.o Objects/obmalloc.o Python/dynamic_annotations.o Python/mysnprintf.o Python/pyctype.o Parser/tokenizer_pgen.o Parser/printgrammar.o Parser/parsetok_pgen.o Parser/pgenmain.o -lpthread -ldl -lpthread -lutil -o Parser/pgen
    if test "yes" != "yes"; then \
    Parser/pgen ./Grammar/Grammar Include/graminit.h Python/graminit.c; \
    else \
    cp ./Include/graminit.h Include/graminit.h; \
    fi
    cp: './Include/graminit.h' and 'Include/graminit.h' are the same file
    Makefile:806: recipe for target 'Include/graminit.h' failed
    make: *** [Include/graminit.h] Error 1

    The attached patch allows me to get past this error. I'm unsure if it's an appropriate fix or just a workaround.

    @moreati moreati mannequin added build The build process and cross-build labels Jun 5, 2016
    @ned-deily
    Copy link
    Member

    The culprit appears to be the changes introduced for bpo-22359 (c36b9ef8ff39 and friends).

    @xdegaye
    Copy link
    Mannequin

    xdegaye mannequin commented Jun 5, 2016

    Yes, those changes incorrectly assume that the source directory and the build directory are always different (using VPATH). Alex patch LGTM, this other patch overwrites the graminit.[ch] files, not sure if this is better.

    @vadmium
    Copy link
    Member

    vadmium commented Jun 6, 2016

    I was a little concerned that Alex’s patch used “test A -ef B”, which is not specified by Posix. But it is apparently widely supported (and consider we would only need it for cross compilation). Anyway, I was going to suggest test "$(srcdir)" == "." instead, but maybe Xavier’s solution is slightly better again.

    I say go with vpath.patch, perhaps with a brief comment explaining that the cp + mv dance avoids copying the file onto itself when doing an in-tree build.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Jun 7, 2016

    New changeset 619f7a2aa40a by Martin Panter in branch '3.5':
    Issue bpo-27229: Fix in-tree cross-build rule, by Xavier de Gaye
    https://hg.python.org/cpython/rev/619f7a2aa40a

    New changeset 9902230b101f by Martin Panter in branch 'default':
    Issue bpo-27229: Merge cross-compiling fix from 3.5
    https://hg.python.org/cpython/rev/9902230b101f

    New changeset ffed402528c7 by Martin Panter in branch '2.7':
    Issue bpo-27229: Fix in-tree cross-build rule, by Xavier de Gaye
    https://hg.python.org/cpython/rev/ffed402528c7

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Jun 7, 2016

    New changeset ec214654708f by Martin Panter in branch '2.7':
    Issue bpo-27229: Comment in middle of shell command fails on BSD and OS X
    https://hg.python.org/cpython/rev/ec214654708f

    New changeset de5b85f96266 by Martin Panter in branch '3.5':
    Issue bpo-27229: Comment in middle of shell command fails on BSD and OS X
    https://hg.python.org/cpython/rev/de5b85f96266

    New changeset b7a4c076ba40 by Martin Panter in branch 'default':
    Issue bpo-27229: Merge makefile fix from 3.5
    https://hg.python.org/cpython/rev/b7a4c076ba40

    @vadmium
    Copy link
    Member

    vadmium commented Jun 7, 2016

    Thanks Alex & Xavier.

    @vadmium vadmium closed this as completed Jun 7, 2016
    @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
    build The build process and cross-build
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants