This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Build from hg fails in Modules/getbuildinfo.c when built using ancient hg version (0.9.3)
Type: compile error Stage: resolved
Components: Build Versions: Python 3.2, Python 3.3, Python 2.7
process
Status: closed Resolution: works for me
Dependencies: Superseder:
Assigned To: Nosy List: dmalcolm
Priority: low Keywords:

Created on 2011-03-28 22:41 by dmalcolm, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (2)
msg132440 - (view) Author: Dave Malcolm (dmalcolm) (Python committer) Date: 2011-03-28 22:41
With hg/mercurial 0.9.3, the build of CPython fails with this error:

gcc -pthread -c -fno-strict-aliasing -g -O0 -Wall -Wstrict-prototypes    -I. -IInclude -I./Include    -DPy_BUILD_CORE \
	      -DHGVERSION="\"`LC_ALL=C hg id -i .`\"" \
	      -DHGTAG="\"`LC_ALL=C hg id -t .`\"" \
	      -DHGBRANCH="\"`LC_ALL=C hg id -b .`\"" \
	      -o Modules/getbuildinfo.o ./Modules/getbuildinfo.c
hg identify: option -i not recognized
hg identify: option -t not recognized
hg identify: option -b not recognized
./Modules/getbuildinfo.c: In function ‘Py_GetBuildInfo’:
./Modules/getbuildinfo.c:37: error: missing terminating " character
./Modules/getbuildinfo.c:37: error: expected expression before ‘)’ token
./Modules/getbuildinfo.c:38: error: missing terminating " character
./Modules/getbuildinfo.c:38: error: missing terminating " character
./Modules/getbuildinfo.c:39: error: missing terminating " character
./Modules/getbuildinfo.c:39: error: missing terminating " character
./Modules/getbuildinfo.c:45: error: ‘buildinfo’ undeclared (first use in this function)
./Modules/getbuildinfo.c:45: error: (Each undeclared identifier is reported only once
./Modules/getbuildinfo.c:45: error: for each function it appears in.)
./Modules/getbuildinfo.c:49: warning: control reaches end of non-void function
./Modules/getbuildinfo.c: In function ‘_Py_hgversion’:
./Modules/getbuildinfo.c:54: error: missing terminating " character
./Modules/getbuildinfo.c:54: warning: ‘return’ with no value, in function returning non-void
./Modules/getbuildinfo.c: In function ‘_Py_hgidentifier’:
./Modules/getbuildinfo.c:61: error: missing terminating " character
./Modules/getbuildinfo.c:61: error: expected expression before ‘;’ token
./Modules/getbuildinfo.c:65: error: missing terminating " character
./Modules/getbuildinfo.c:65: error: expected expression before ‘;’ token
make: *** [Modules/getbuildinfo.o] Error 1


What's happening is that "hg id" doesn't recognize the given options, and thus the various HG macros get set to insane multi-line strings containing usage information, but without quote characters, rather than to empty string literals [1].  This means that the post-processed code isn't valid C.

The workaround presumably is to upgrade to a more recent version of mercurial.  I'm reporting this here in the bug tracker in case anyone else runs into this problem.

[1] Adding "-v" to the gcc invocation demonstrates that the values being passed are:

-DHGVERSION="hg identify

print information about the working copy

    Print a short summary of the current state of the repo.

    This summary identifies the repository state using one or two parent
    hash identifiers, followed by a "+" if there are uncommitted changes
    in the working directory, followed by a list of tags for this revision.

aliases: id" -DHGTAG="hg identify

print information about the working copy

    Print a short summary of the current state of the repo.

    This summary identifies the repository state using one or two parent
    hash identifiers, followed by a "+" if there are uncommitted changes
    in the working directory, followed by a list of tags for this revision.

aliases: id" -DHGBRANCH="hg identify

print information about the working copy

    Print a short summary of the current state of the repo.

    This summary identifies the repository state using one or two parent
    hash identifiers, followed by a "+" if there are uncommitted changes
    in the working directory, followed by a list of tags for this revision.

aliases: id"
msg132442 - (view) Author: Dave Malcolm (dmalcolm) (Python committer) Date: 2011-03-28 22:48
Works OK with mercurial 1.3.1
(specifically, this is on a RHEL5 box, using mercurial-1.3.1-3.el5.i386.rpm from EPEL5)

Closing this out, and changing title to help people searching for this.  Not sure of the exact version of mercurial that's required.
History
Date User Action Args
2022-04-11 14:57:15adminsetgithub: 55915
2011-03-28 22:48:52dmalcolmsetstatus: open -> closed
title: Build from hg fails with ancient hg version (0.9.3) -> Build from hg fails in Modules/getbuildinfo.c when built using ancient hg version (0.9.3)
messages: + msg132442

resolution: works for me
stage: resolved
2011-03-28 22:41:34dmalcolmcreate