编译python3.6.5环境出错

来源:3-3 Ansible配合virtualenv安装配置

troylc

2018-11-06

[root@ansible Python-3.6.5]# ./configure --prefix=/usr/local --with-ensurepip=install --enable-shared LDFLAGS="-wl,-rpath /usr/local/lib"
checking build system type… x86_64-pc-linux-gnu
checking host system type… x86_64-pc-linux-gnu
checking for python3.6… no
checking for python3… no
checking for python… python
checking for --enable-universalsdk… no
checking for --with-universal-archs… no
checking MACHDEP… linux
checking for --without-gcc… no
checking for --with-icc… no
checking for gcc… gcc
checking whether the C compiler works… no
configure: error: in /root/Python-3.6.5': configure: error: C compiler cannot create executables Seeconfig.log’ for more details

写回答

4回答

一路向北

2018-11-07

感谢这位同学的关注,编译这部分"-wl,-rpath /usr/local/lib"如果你仔细看视频的话,里面的w为大写,建议修改这部分代码为"-Wl,-rpath /usr/local/lib"再尝试重新编译。

0
0

troylc

提问者

2018-11-06

./configure --prefix=/usr/local --with-ensurepip=install --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib"

LDFLAGS="-Wl,-rpath /usr/local/lib" 这里的参数是大写W

0
0

troylc

提问者

2018-11-06

[root@ansible Python-3.6.5]# which gcc

/usr/bin/gcc

[root@ansible Python-3.6.5]# gcc --versio

gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-28)

Copyright (C) 2015 Free Software Foundation, Inc.

This is free software; see the source for copying conditions.  There is NO

warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE

[root@ansible Python-3.6.5]# cat config.log

This file contains any messages produced by compilers while

running configure, to aid debugging if configure makes a mistake.


It was created by python configure 3.6, which was

generated by GNU Autoconf 2.69.  Invocation command line was


  $ ./configure --prefix=/usr/local --with-ensurepip=install --enable-shared LDFLAGS=-wl,-rpath /usr/local/lib


## --------- ##

## Platform. ##

## --------- ##


hostname = ansible

uname -m = x86_64

uname -r = 3.10.0-862.14.4.el7.x86_64

uname -s = Linux

uname -v = #1 SMP Wed Sep 26 15:12:11 UTC 2018


/usr/bin/uname -p = x86_64

/bin/uname -X     = unknown


/bin/arch              = x86_64

/usr/bin/arch -k       = unknown

/usr/convex/getsysinfo = unknown

/usr/bin/hostinfo      = unknown

/bin/machine           = unknown

/usr/bin/oslevel       = unknown

/bin/universe          = unknown


PATH: /usr/local/sbin

PATH: /usr/local/bin

PATH: /usr/sbin

PATH: /usr/bin

PATH: /root/bin



## ----------- ##

## Core tests. ##

## ----------- ##


configure:2795: checking build system type

configure:2809: result: x86_64-pc-linux-gnu

configure:2829: checking host system type

configure:2842: result: x86_64-pc-linux-gnu

configure:2872: checking for python3.6

configure:2902: result: no

configure:2872: checking for python3

configure:2902: result: no

configure:2872: checking for python

configure:2888: found /usr/bin/python

configure:2899: result: python

configure:2999: checking for --enable-universalsdk

configure:3046: result: no

configure:3069: checking for --with-universal-archs

configure:3084: result: no

configure:3234: checking MACHDEP

configure:3443: result: linux

configure:3464: checking for --without-gcc

configure:3487: result: no

configure:3490: checking for --with-icc

configure:3510: result: no

configure:3634: checking for gcc

configure:3650: found /usr/bin/gcc

configure:3661: result: gcc

configure:3890: checking for C compiler version

configure:3899: gcc --version >&5

gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-28)

Copyright (C) 2015 Free Software Foundation, Inc.

This is free software; see the source for copying conditions.  There is NO

warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


configure:3910: $? = 0

configure:3899: gcc -v >&5

Using built-in specs.

COLLECT_GCC=gcc

COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/lto-wrapper

Target: x86_64-redhat-linux

Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/cloog-install --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux

Thread model: posix

gcc version 4.8.5 20150623 (Red Hat 4.8.5-28) (GCC)

configure:3910: $? = 0

configure:3899: gcc -V >&5

gcc: error: unrecognized command line option '-V'

gcc: fatal error: no input files

compilation terminated.

configure:3910: $? = 4

configure:3899: gcc -qversion >&5

gcc: error: unrecognized command line option '-qversion'

gcc: fatal error: no input files

compilation terminated.

configure:3910: $? = 4

configure:3930: checking whether the C compiler works

configure:3952: gcc   -wl,-rpath /usr/local/lib conftest.c  >&5

gcc: error: unrecognized command line option '-wl,-rpath'

configure:3956: $? = 1

configure:3994: result: no

configure: failed program was:

| /* confdefs.h */

| #define _GNU_SOURCE 1

| #define _NETBSD_SOURCE 1

| #define __BSD_VISIBLE 1

| #define _BSD_TYPES 1

| #define _DARWIN_C_SOURCE 1

| #define _XOPEN_SOURCE 700

| #define _XOPEN_SOURCE_EXTENDED 1

| #define _POSIX_C_SOURCE 200809L

| /* end confdefs.h.  */

|

| int

| main ()

| {

|

|   ;

|   return 0;

| }

configure:3999: error: in `/root/Python-3.6.5':

configure:4001: error: C compiler cannot create executables

See `config.log' for more details


## ---------------- ##

## Cache variables. ##

## ---------------- ##


ac_cv_build=x86_64-pc-linux-gnu

ac_cv_env_CC_set=

ac_cv_env_CC_value=

ac_cv_env_CFLAGS_set=

ac_cv_env_CFLAGS_value=

ac_cv_env_CPPFLAGS_set=

ac_cv_env_CPPFLAGS_value=

ac_cv_env_CPP_set=

ac_cv_env_CPP_value=

ac_cv_env_LDFLAGS_set=set

ac_cv_env_LDFLAGS_value='-wl,-rpath /usr/local/lib'

ac_cv_env_LIBS_set=

ac_cv_env_LIBS_value=

ac_cv_env_MACHDEP_set=

ac_cv_env_MACHDEP_value=

ac_cv_env_PKG_CONFIG_LIBDIR_set=

ac_cv_env_PKG_CONFIG_LIBDIR_value=

ac_cv_env_PKG_CONFIG_PATH_set=

ac_cv_env_PKG_CONFIG_PATH_value=

ac_cv_env_PKG_CONFIG_set=

ac_cv_env_PKG_CONFIG_value=

ac_cv_env_build_alias_set=

ac_cv_env_build_alias_value=

ac_cv_env_host_alias_set=

ac_cv_env_host_alias_value=

ac_cv_env_target_alias_set=

ac_cv_env_target_alias_value=

ac_cv_host=x86_64-pc-linux-gnu

ac_cv_prog_PYTHON_FOR_REGEN=python

ac_cv_prog_ac_ct_CC=gcc


## ----------------- ##

## Output variables. ##

## ----------------- ##


ABIFLAGS=''

AR=''

ARCH_RUN_32BIT=''

ARFLAGS=''

BASECFLAGS=''

BASECPPFLAGS=''

BLDLIBRARY=''

BLDSHARED=''

BUILDEXEEXT=''

CC='gcc'

CCSHARED=''

CFLAGS=''

CFLAGSFORSHARED=''

CFLAGS_ALIASING=''

CFLAGS_NODIST=''

CONFIGURE_MACOSX_DEPLOYMENT_TARGET=''

CONFIG_ARGS=' '\''--prefix=/usr/local'\'' '\''--with-ensurepip=install'\'' '\''--enable-shared'\'' '\''LDFLAGS=-wl,-rpath /usr/local/lib'\'''

CPP=''

CPPFLAGS=''

CXX=''

DEFS=''

DEF_MAKE_ALL_RULE=''

DEF_MAKE_RULE=''

DFLAGS=''

DLINCLDIR=''

DLLLIBRARY=''

DTRACE=''

DTRACE_HEADERS=''

DTRACE_OBJS=''

DYNLOADFILE=''

ECHO_C=''

ECHO_N='-n'

ECHO_T=''

EGREP=''

ENSUREPIP=''

EXEEXT=''

EXPORT_MACOSX_DEPLOYMENT_TARGET='#'

EXT_SUFFIX=''

FRAMEWORKALTINSTALLFIRST=''

FRAMEWORKALTINSTALLLAST=''

FRAMEWORKINSTALLAPPSPREFIX=''

FRAMEWORKINSTALLFIRST=''

FRAMEWORKINSTALLLAST=''

FRAMEWORKPYTHONW=''

FRAMEWORKUNIXTOOLSPREFIX='/usr/local'

GITBRANCH=''

GITTAG=''

GITVERSION=''

GNULD=''

GREP=''

HAS_GIT='no-repository'

HAVE_GETHOSTBYNAME=''

HAVE_GETHOSTBYNAME_R=''

HAVE_GETHOSTBYNAME_R_3_ARG=''

HAVE_GETHOSTBYNAME_R_5_ARG=''

HAVE_GETHOSTBYNAME_R_6_ARG=''

INSTALL_DATA=''

INSTALL_PROGRAM=''

INSTALL_SCRIPT=''

INSTSONAME=''

LDCXXSHARED=''

LDFLAGS='-wl,-rpath /usr/local/lib'

LDLAST=''

LDLIBRARY=''

LDLIBRARYDIR=''

LDSHARED=''

LDVERSION=''

LIBC=''

LIBFFI_INCLUDEDIR=''

LIBM=''

LIBOBJS=''

LIBPL=''

LIBRARY=''

LIBS=''

LIBTOOL_CRUFT=''

LINKCC=''

LINKFORSHARED=''

LIPO_32BIT_FLAGS=''

LLVM_PROFDATA=''

LLVM_PROF_ERR=''

LLVM_PROF_FILE=''

LLVM_PROF_FOUND=''

LLVM_PROF_MERGER=''

LN=''

LTLIBOBJS=''

LTOFLAGS=''

MACHDEP='linux'

MACHDEP_OBJS=''

MAINCC=''

MKDIR_P=''

MULTIARCH=''

MULTIARCH_CPPFLAGS=''

NO_AS_NEEDED=''

OBJEXT=''

OPT=''

OTHER_LIBTOOL_OPT=''

PACKAGE_BUGREPORT='https://bugs.python.org/'

PACKAGE_NAME='python'

PACKAGE_STRING='python 3.6'

PACKAGE_TARNAME='python'

PACKAGE_URL=''

PACKAGE_VERSION='3.6'

PATH_SEPARATOR=':'

PGO_PROF_GEN_FLAG=''

PGO_PROF_USE_FLAG=''

PKG_CONFIG=''

PKG_CONFIG_LIBDIR=''

PKG_CONFIG_PATH=''

PLATFORM_TRIPLET=''

PY3LIBRARY=''

PYTHONFRAMEWORK=''

PYTHONFRAMEWORKDIR='no-framework'

PYTHONFRAMEWORKIDENTIFIER='org.python.python'

PYTHONFRAMEWORKINSTALLDIR=''

PYTHONFRAMEWORKPREFIX=''

PYTHON_FOR_BUILD='./$(BUILDPYTHON) -E'

PYTHON_FOR_REGEN='python'

PY_ENABLE_SHARED=''

RANLIB=''

READELF=''

RUNSHARED=''

SED=''

SGI_ABI=''

SHELL='/bin/sh'

SHLIBS=''

SHLIB_SUFFIX=''

SOABI=''

SOVERSION='1.0'

SRCDIRS=''

TCLTK_INCLUDES=''

TCLTK_LIBS=''

THREADHEADERS=''

THREADOBJ=''

TRUE=''

UNIVERSALSDK=''

UNIVERSAL_ARCH_FLAGS=''

USE_INLINE=''

USE_THREAD_MODULE=''

VERSION='3.6'

_PYTHON_HOST_PLATFORM=''

ac_ct_AR=''

ac_ct_CC='gcc'

ac_ct_CXX=''

ac_ct_READELF=''

bindir='${exec_prefix}/bin'

build='x86_64-pc-linux-gnu'

build_alias=''

build_cpu='x86_64'

build_os='linux-gnu'

build_vendor='pc'

datadir='${datarootdir}'

datarootdir='${prefix}/share'

docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'

dvidir='${docdir}'

exec_prefix='NONE'

host='x86_64-pc-linux-gnu'

host_alias=''

host_cpu='x86_64'

host_os='linux-gnu'

host_vendor='pc'

htmldir='${docdir}'

includedir='${prefix}/include'

infodir='${datarootdir}/info'

libdir='${exec_prefix}/lib'

libexecdir='${exec_prefix}/libexec'

localedir='${datarootdir}/locale'

localstatedir='${prefix}/var'

mandir='${datarootdir}/man'

oldincludedir='/usr/include'

pdfdir='${docdir}'

prefix='/usr/local'

program_transform_name='s,x,x,'

psdir='${docdir}'

sbindir='${exec_prefix}/sbin'

sharedstatedir='${prefix}/com'

sysconfdir='${prefix}/etc'

target=''

target_alias=''

target_cpu=''

target_os=''

target_vendor=''


## ----------- ##

## confdefs.h. ##

## ----------- ##


/* confdefs.h */

#define _GNU_SOURCE 1

#define _NETBSD_SOURCE 1

#define __BSD_VISIBLE 1

#define _BSD_TYPES 1

#define _DARWIN_C_SOURCE 1

#define _XOPEN_SOURCE 700

#define _XOPEN_SOURCE_EXTENDED 1

#define _POSIX_C_SOURCE 200809L


configure: exit 77


0
0

troylc

提问者

2018-11-06

我安装了gcc,还是报错,我的操作系统是CentOS-7-x86_64-Minimal-1804

[root@ansible Python-3.6.5]# yum install  gc gcc *gcc-c++* -y

[root@ansible Python-3.6.5]# ./configure --prefix=/usr/local --with-ensurepip=install --enable-shared LDFLAGS="-wl,-rpath /usr/local/lib"

checking build system type... x86_64-pc-linux-gnu

checking host system type... x86_64-pc-linux-gnu

checking for python3.6... no

checking for python3... no

checking for python... python

checking for --enable-universalsdk... no

checking for --with-universal-archs... no

checking MACHDEP... linux

checking for --without-gcc... no

checking for --with-icc... no

checking for gcc... gcc

checking whether the C compiler works... no

configure: error: in `/root/Python-3.6.5':

configure: error: C compiler cannot create executables

See `config.log' for more details


0
0

Jenkins+Ansible+Gitlab-三剑合璧掌握自动化部署

整合三大工具解决自动化部署&持续交付问题

1290 学习 · 319 问题

查看课程