[英]python compile fail on centos6.9 (32bit)
Hi I follow the step online which is: 嗨,我遵循以下在线步骤:
# wget https://www.python.org/ftp/python/2.7.13/Python-2.7.13.tgz
# tar xzf Python-2.7.13.tgz
# cd Python-2.7.13
# ./configure
# make
# make altinstall
and it gave me the following compile error: 它给了我以下编译错误:
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I. -IInclude -I./Include -DPy_BUILD_CORE -c ./Modules/symtablemodule.c -o Modules/symtablemodule.o
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I. -IInclude -I./Include -DPy_BUILD_CORE -c ./Modules/xxsubtype.c -o Modules/xxsubtype.o
gcc -pthread -c -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I. -IInclude -I./Include -DPy_BUILD_CORE \
-DSVNVERSION="\"`LC_ALL=C svnversion .`\"" \
-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
./Modules/getbuildinfo.c: In function 'Py_GetBuildInfo':
./Modules/getbuildinfo.c:45: error: expected ')' before 'default'
./Modules/getbuildinfo.c:46: error: expected ')' before 'default'
./Modules/getbuildinfo.c:46: error: expected ')' before 'default'
./Modules/getbuildinfo.c:47: error: expected ')' before 'default'
./Modules/getbuildinfo.c:47: error: expected ')' before 'default'
./Modules/getbuildinfo.c: In function '_Py_hgversion':
./Modules/getbuildinfo.c:72: error: expected ';' before 'default'
./Modules/getbuildinfo.c: In function '_Py_hgidentifier':
./Modules/getbuildinfo.c:79: error: expected ';' before 'default'
./Modules/getbuildinfo.c:83: error: expected ';' before 'default'
make: *** [Modules/getbuildinfo.o] Error 1
I try searching online but cant find any solution... any help is appreciated 我尝试在线搜索,但找不到任何解决方案。
Thanks! 谢谢!
After looking at the comments below I changed the function to (marked with //<-added by me): 看完下面的注释后,我将函数更改为(标记为// <-由我添加):
const char *
Py_GetBuildInfo(void)
{
// static char buildinfo[50 + sizeof(HGVERSION) +
// ((sizeof(HGTAG) > sizeof(HGBRANCH)) ?
// sizeof(HGTAG) : sizeof(HGBRANCH))];
static char buildinfo[500]; //<-added by me
const char *revision = _Py_hgversion();
const char *sep = *revision ? ":" : "";
const char *hgid = _Py_hgidentifier();
if (!(*hgid))
hgid = "default";
PyOS_snprintf(buildinfo, sizeof(buildinfo),
"%s%s%s, %.20s, %.9s", hgid, sep, revision,
DATE, TIME);
return buildinfo;
}
const char *
_Py_svnversion(void)
{
/* the following string can be modified by subwcrev.exe */
static const char svnversion[] = SVNVERSION;
if (svnversion[0] != '$')
return svnversion; /* it was interpolated, or passed on command line */
return "Unversioned directory";
}
const char *
_Py_hgversion(void)
{
//return HGVERSION;
return "Unversioned version"; //<-added by me
}
const char *
_Py_hgidentifier(void)
{
// const char *hgtag, *hgid;
// hgtag = HGTAG;
// if ((*hgtag) && strcmp(hgtag, "tip") != 0)
// hgid = hgtag;
// else
// hgid = HGBRANCH;
// return hgid;
return "Unversioned id"; //<-added by me
}
my question is if its save to do that ? 我的问题是这样做是否可以节省? because the code seems to compile and I can install it without a problem. 因为代码似乎可以编译,所以我可以毫无问题地安装它。
您可能要尝试以下操作-1)将所有Mercurial软件包升级到最新版本,然后尝试构建python 2.7,如果仍然无法编译,则2)首先删除Mercurial软件包,然后构建python 2.7,然后重新-之后安装水银。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.