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

SVNVERSION redefined during compilation #45020

Closed
brettcannon opened this issue Jun 1, 2007 · 10 comments
Closed

SVNVERSION redefined during compilation #45020

brettcannon opened this issue Jun 1, 2007 · 10 comments
Assignees
Labels
build The build process and cross-build

Comments

@brettcannon
Copy link
Member

BPO 1729277
Nosy @loewis, @brettcannon, @kristjanvalur
Files
  • woo.patch: Suggested patch for getbuildinfo.c
  • 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 = 'https://github.com/kristjanvalur'
    closed_at = <Date 2007-06-07.23:58:36.000>
    created_at = <Date 2007-06-01.02:28:24.000>
    labels = ['build']
    title = 'SVNVERSION redefined during compilation'
    updated_at = <Date 2007-06-07.23:58:36.000>
    user = 'https://github.com/brettcannon'

    bugs.python.org fields:

    activity = <Date 2007-06-07.23:58:36.000>
    actor = 'kristjan.jonsson'
    assignee = 'kristjan.jonsson'
    closed = True
    closed_date = None
    closer = None
    components = ['Build']
    creation = <Date 2007-06-01.02:28:24.000>
    creator = 'brett.cannon'
    dependencies = []
    files = ['2385']
    hgrepos = []
    issue_num = 1729277
    keywords = []
    message_count = 10.0
    messages = ['32162', '32163', '32164', '32165', '32166', '32167', '32168', '32169', '32170', '32171']
    nosy_count = 3.0
    nosy_names = ['loewis', 'brett.cannon', 'kristjan.jonsson']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = None
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue1729277'
    versions = ['Python 2.6']

    @brettcannon
    Copy link
    Member Author

    I sometimes get the following warning during a build:

    ./Modules/getbuildinfo.c:23:1: warning: "SVNVERSION" redefined
    <command line>:1:1: warning: this is the location of the previous definition

    It looks like SVNVERSION is defined in getbuildinfo.c, but a value is also passed in on the command-line in the Makefile when the module is built (line 460). I have no clue why this is being done.

    @brettcannon brettcannon added the build The build process and cross-build label Jun 1, 2007
    @brettcannon brettcannon added the build The build process and cross-build label Jun 1, 2007
    @loewis
    Copy link
    Mannequin

    loewis mannequin commented Jun 1, 2007

    This was broken in

    ------------------------------------------------------------------------
    r55024 | kristjan.jonsson | 2007-04-30 17:17:46 +0200 (Mo, 30 Apr 2007) | 1 line

    Complete revamp of PCBuild8 directory. Use subdirectories for each project under the main pcbuild solution. Now make extensive use of property sheets to simplify project configuration. x64 build fully supported, and the process for building PGO version (Profiler Guided Optimization) simplified. All projects are now present, except _ssl, which needs to be reimplemented. Also, some of the projects that require external libraries need extra work to fully compile on x64.
    ------------------------------------------------------------------------

    Kristjan, what was the rationale for making that specific change to getbuildinfo?

    @kristjanvalur
    Copy link
    Mannequin

    kristjanvalur mannequin commented Jun 4, 2007

    The intent was to remove the reliance on the define SUBWCREV so to simplify the actions of make_buildinfo.c. It then only needs to either copy it or run it through subwcrev.exe. Now the code autodetects whether it was passed through subwcrev.exe or not by examining if the string was interpolated. What is the purpose of the SVNVERSION macro passed on the command line? If it has the same value, then maybe a conditional #define will fix this back?

    Otherwise, rolling back the change will mean that make_buildinfo.c will have to create some other info for the subsequent compilation of getbuildinfo.c to define or undefin SVNWCREV

    @brettcannon
    Copy link
    Member Author

    Well, when I remove the command-line def (the entire -D argument when building getbuildinfo.c) I get no subversion number out of sys.subversion. But when I comment out the SVNVERSION definition instead in getbuildinfo.c I do have the subversion number show up.

    And I just noticed that when both are defined I have no subversion number (as is the case in the trunk at the moment).

    I just wrapped the SVNVERSION definition in getbuildinfo.c in a #ifndef and that fixed the problem. but I don't know if doing that will just mask an issue where SVNVERSION should not be defined in getbuildinfo.c at all if it is being passed in during compilation.

    @loewis
    Copy link
    Mannequin

    loewis mannequin commented Jun 4, 2007

    SVNVERSION is passed on Unix. On Unix, there is no subwcrev program. Instead, there is an svnversion program which computes the same string as subwcrev, but prints it on stdout (rather than substituting it in some template file).

    Therefore, SVNVERSION needs to be passed on the command line.

    @brettcannon
    Copy link
    Member Author

    I figure that much from my experiment. What I am wondering is if the #define in getbuildinfo.c is needed. Does the Windows build need it? Or is it that just to guarantee that the file is self-supported and won't fail to compile if the compile-time define is not passed in?

    If the #define in the file is required then I vote for the #ifndef solution with an explanation.

    @loewis
    Copy link
    Mannequin

    loewis mannequin commented Jun 5, 2007

    The define is indeed needed on Windows. On a Windows installation, there is typically no svnversion binary. However, TortoiseSVN ships with a similar tool, calls subwcrev.exe, which does string interpolation on a template file. So the define in getbuildinfo is the template, and the link process creates a second C file (getbuildinfo1.c) which is then compiled and linked into the interpreter. As subwcrev.exe might not be installed, the build process used to pass a define SUBWCREV on the command line, which was a condition to the definition of SVNVERSION. As Kristjan removed the condition, the Unix build broke.

    @kristjanvalur
    Copy link
    Mannequin

    kristjanvalur mannequin commented Jun 5, 2007

    Here is a suggested patch. I don't have a linux setup to test with this, what do you think?
    Oh, and sorry for messing this up, I thought subwcrev was used on all platforms :(
    File Added: woo.patch

    @loewis
    Copy link
    Mannequin

    loewis mannequin commented Jun 5, 2007

    Looks fine to me, please apply.

    @kristjanvalur
    Copy link
    Mannequin

    kristjanvalur mannequin commented Jun 7, 2007

    Applied the patch in change 55821, and backported to 25-maint in 55822

    @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

    1 participant