【问题标题】:python compile fail on centos6.9 (32bit)在centos6.9(32位)上python编译失败
【发布时间】:2017-08-17 06:13:26
【问题描述】:

您好,我按照网上的步骤进行操作:

 # 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

它给了我以下编译错误:

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

我尝试在线搜索但找不到任何解决方案... 任何帮助表示赞赏

谢谢!

查看下面的 cmets 后,我将函数更改为(标有 //

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

}

我的问题是它是否可以保存?因为代码似乎可以编译,我可以毫无问题地安装它。

【问题讨论】:

标签: python gcc makefile


【解决方案1】:

您可能想尝试以下方法 - 1)将所有mercurial软件包升级到最新版本,然后尝试构建python 2.7,如果仍然无法编译,则 2)先删除mercurial包,然后构建python 2.7,然后重新安装mercurial。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-01-09
    • 2020-12-07
    • 2016-07-11
    • 2017-03-08
    • 2017-01-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多