在 AIX 上本地安装 python3

在 AIX 上本地安装 python3

我正在尝试在 AIX 7.1 上本地安装 python3 (3.5.2) 解释器,我使用它进行配置,运行正常

CC=gcc OPT="-O2" ./configure --enable-shared --prefix=$HOME/usr/local

但是在执行 make altinstall 时出现错误

/tmp/python3-src/Python-3.5.2 $ make altinstall prefix=$HOME/usr/local exec-prefix=$HOME/usr/local
        gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -O1  -O  -Werror=declaration-after-statement   -I. -IInclude -I./Include    -DPy_BUILD_CORE  -c ./Modules/posixmodule.c -o Modules/posixmodule.o
./Modules/posixmodule.c: In function 'posix_do_stat':
./Modules/posixmodule.c:2142:48: error: 'AT_SYMLINK_NOFOLLOW' undeclared (first use in this function)
                          follow_symlinks ? 0 : AT_SYMLINK_NOFOLLOW);
                                                ^
./Modules/posixmodule.c:2142:48: note: each undeclared identifier is reported only once for each function it appears in
./Modules/posixmodule.c: In function 'os_access_impl':
./Modules/posixmodule.c:2609:22: error: 'AT_SYMLINK_NOFOLLOW' undeclared (first use in this function)
             flags |= AT_SYMLINK_NOFOLLOW;
                      ^
./Modules/posixmodule.c:2611:22: error: 'AT_EACCESS' undeclared (first use in this function)
             flags |= AT_EACCESS;
                      ^
./Modules/posixmodule.c: In function 'os_chmod_impl':
./Modules/posixmodule.c:2854:49: error: 'AT_SYMLINK_NOFOLLOW' undeclared (first use in this function)
                           follow_symlinks ? 0 : AT_SYMLINK_NOFOLLOW);
                                                 ^
./Modules/posixmodule.c: In function 'os_chown_impl':
./Modules/posixmodule.c:3191:49: error: 'AT_SYMLINK_NOFOLLOW' undeclared (first use in this function)
                           follow_symlinks ? 0 : AT_SYMLINK_NOFOLLOW);
                                                 ^
./Modules/posixmodule.c: In function 'os_link_impl':
./Modules/posixmodule.c:3441:31: error: 'AT_SYMLINK_FOLLOW' undeclared (first use in this function)
             follow_symlinks ? AT_SYMLINK_FOLLOW : 0);
                               ^
./Modules/posixmodule.c: In function 'os_rmdir_impl':
./Modules/posixmodule.c:4240:49: error: 'AT_REMOVEDIR' undeclared (first use in this function)
         result = unlinkat(dir_fd, path->narrow, AT_REMOVEDIR);
                                                 ^
./Modules/posixmodule.c: In function 'utime_dir_fd':
./Modules/posixmodule.c:4571:39: error: 'AT_SYMLINK_NOFOLLOW' undeclared (first use in this function)
     int flags = follow_symlinks ? 0 : AT_SYMLINK_NOFOLLOW;
                                       ^
./Modules/posixmodule.c: In function 'utime_nofollow_symlinks':
./Modules/posixmodule.c:4621:50: error: 'AT_SYMLINK_NOFOLLOW' undeclared (first use in this function)
     return utimensat(DEFAULT_DIR_FD, path, time, AT_SYMLINK_NOFOLLOW);
                                                  ^
make: The error code from the last command is 1.


Stop.

我检查了 /usr/include 中缺少的声明,看起来它们在那里。在进行本地安装时,我是否必须以某种方式手动指定这些包含的路径?

/usr/include $ grep -R "#define AT_EACCESS" .
./fcntl.h:#define AT_EACCESS            1       /* Check access using effective
/usr/include $ grep -R "#define AT_SYMLINK_NOFOLLOW" .
./fcntl.h:#define AT_SYMLINK_NOFOLLOW   1       /* Do not follow symbolic links */

答案1

编译时,

出现以下错误,

/Modules/posixmodule.c:2142:48: error: 'AT_SYMLINK_NOFOLLOW' undeclared (first use in this function)
                              follow_symlinks ? 0 : AT_SYMLINK_NOFOLLOW);

posixmodule.c 2142行如下所示,这里使用了 fstatat 方法;

#ifdef HAVE_FSTATAT
    if ((dir_fd != DEFAULT_DIR_FD) || !follow_symlinks)
        result = fstatat(dir_fd, path->narrow, &st,
                         follow_symlinks ? 0 : AT_SYMLINK_NOFOLLOW);
    else
#endif

所以此修复;应该应用来解决该问题。

相关内容