[issue31744] Python 2.7.14 Fails to compile on CentOS/RHEL7

2017-10-10 Thread Brian Sidebotham

New submission from Brian Sidebotham :

I am getting the following error when trying to compile Python 2.7.14 (and 
previous 2.7 versions) on CentOS and RHEL7.

The main problem is that CONFIG_ARGS does not exist. I've included the build. 
This RPATH is correct - it has to go through the RPM SPEC file so needs 
escaping like this to work.

Python 3.6.2 builds find like this, but Python 2.7 is failing to build. Have I 
missed something?

LDFLAGS='-Wl,-rpath=$\\$$ORIGIN/../lib' \
./configure --prefix=/opt/wsl \
--enable-shared \
--with-system-ffi \
--with-ensurepip=yes \
--enable-optimizations

...

ranlib libpython2.7.a
Modules/posixmodule.o: In function `posix_tmpnam':
/opt/jenkins/workspace/Build_WSL_Python2_on_RHEL7/BUILD/Python-2.7.14/./Modules/posixmodule.c:7642:
 warning: the use of `tmpnam_r' is dangerous, better use `mkstemp'
Modules/posixmodule.o: In function `posix_tempnam':
/opt/jenkins/workspace/Build_WSL_Python2_on_RHEL7/BUILD/Python-2.7.14/./Modules/posixmodule.c:7589:
 warning: the use of `tempnam' is dangerous, better use `mkstemp'
gcc -pthread -Wl,-rpath=RIGIN/../lib -fprofile-generate  -Xlinker 
-export-dynamic -o python \
Modules/python.o \
-L. -lpython2.7 -lpthread -ldl  -lutil   -lm  
LD_LIBRARY_PATH=/opt/jenkins/workspace/Build_WSL_Python2_on_RHEL7/BUILD/Python-2.7.14
 ./python -E -S -m sysconfig --generate-posix-vars ;\
if test $? -ne 0 ; then \
echo "generate-posix-vars failed" ; \
rm -f ./pybuilddir.txt ; \
exit 1 ; \
fi
Traceback (most recent call last):
  File "./setup.py", line 33, in 
COMPILED_WITH_PYDEBUG = ('--with-pydebug' in 
sysconfig.get_config_var("CONFIG_ARGS"))
TypeError: argument of type 'NoneType' is not iterable
make[2]: *** [sharedmods] Error 1
make[2]: Leaving directory 
`/opt/jenkins/workspace/Build_WSL_Python2_on_RHEL7/BUILD/Python-2.7.14'
make[1]: *** [build_all_generate_profile] Error 2
make[1]: Leaving directory 
`/opt/jenkins/workspace/Build_WSL_Python2_on_RHEL7/BUILD/Python-2.7.14'
make: *** [profile-opt] Error 2
error: Bad exit status from /var/tmp/rpm-tmp.sFvDid (%build)





-bash-4.2# cd build/lib.linux-x86_64-2.7/
-bash-4.2# ls
_sysconfigdata.py  _sysconfigdata.pyc
-bash-4.2# cat _sysconfigdata.py
# system configuration generated and used by the sysconfig module
build_time_vars = {'AC_APPLE_UNIVERSAL_BUILD': 0,
 'AIX_GENUINE_CPLUSPLUS': 0,
 'AR': 'ar',
 'ARFLAGS': 'rc',
 'ATHEOS_THREADS': 0,
 'BASECFLAGS': '-fno-strict-aliasing',
 'BASEMODLIBS': '',
 'BEOS_THREADS': 0,
 'BINDIR': '/opt/wsl/bin',
 'BINLIBDEST': '/opt/wsl/lib/python2.7',
 'BLDLIBRARY': '-L. -lpython2.7',
 'BLDSHARED': 'gcc -pthread -shared -Wl,-rpath=RIGIN/../lib -fprofile-generate',
 'BUILDEXE': '',
 'BUILDPYTHON': 'python',
 'CC': 'gcc -pthread',
 'CCSHARED': '-fPIC',
 'CFLAGS': '-fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall 
-Wstrict-prototypes',
 'CFLAGSFORSHARED': '-fPIC',
 'CONFIGFILES': 'configure configure.ac acconfig.h pyconfig.h.in 
Makefile.pre.in',
 'CONFINCLUDEDIR': '/opt/wsl/include',
 'CONFINCLUDEPY': '/opt/wsl/include/python2.7',
 'COREPYTHONPATH': ':plat-linux2:lib-tk:lib-old',
 'COVERAGE_INFO': 
'/opt/jenkins/workspace/Build_WSL_Python2_on_RHEL7/BUILD/Python-2.7.14/coverage.info',
 'COVERAGE_REPORT': 
'/opt/jenkins/workspace/Build_WSL_Python2_on_RHEL7/BUILD/Python-2.7.14/lcov-report',
 'COVERAGE_REPORT_OPTIONS': '--no-branch-coverage --title "CPython lcov 
report"',
 'CPPFLAGS': '-I. -IInclude -I./Include',
 'CXX': 'g++ -pthread',
 'C_THREADS': 0,
 'DESTDIRS': '/opt/wsl /opt/wsl/lib /opt/wsl/lib/python2.7 
/opt/wsl/lib/python2.7/lib-dynload',
 'DESTLIB': '/opt/wsl/lib/python2.7',
 'DESTPATH': '',
 'DESTSHARED': '/opt/wsl/lib/python2.7/lib-dynload',
 'DIRMODE': 755,
 'DIST': 'README ChangeLog configure configure.ac acconfig.h pyconfig.h.in 
Makefile.pre.in Include Lib Misc Demo Ext-dummy',
 'DISTDIRS': 'Include Lib Misc Demo Ext-dummy',
 'DISTFILES': 'README ChangeLog configure configure.ac acconfig.h pyconfig.h.in 
Makefile.pre.in',
 'DLINCLDIR': '.',
 'DLLLIBRARY': '',
 'DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754': 0,
 'D

[issue31744] Python 2.7.14 Fails to compile on CentOS/RHEL7

2017-10-11 Thread Brian Sidebotham

Brian Sidebotham  added the comment:

I'm not sure any of my emails came through to this ticket from my mail client. 
I think this can be closed and filed under "not a bug".

Here are the mails I sent.:

Hi Marc-Andre,

Thanks for engaging.

I fixed RPATH and now things are building successfully:

LDFLAGS='-Wl,-rpath=\\$$\$$ORIGIN/../lib' \
./configure --prefix=/opt/wsl \
--enable-shared \
--with-system-ffi \
--with-ensurepip=yes \
--enable-optimizations

Thank-you for your help.

Best Regards,

Brian.


-

Hi Charalampos,

We're building for RHEL7 on the latest version.

-bash-4.2$ cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 7.4 (Maipo)

Best Regards,

Brian.





Hi Ned,

Thank-you for your advice. There was no python2 installed on the build box in 
/opt/wsl. Fixing the RPATH reference appears to have fixed the problem. Perhaps 
something in the makefile was getting eaten by the crazy escaping to get ORIGIN 
in the python executable. Now it looks correct:
-bash-4.2$ readelf -d ./python 

Dynamic section at offset 0x3cd0 contains 31 entries:
  TagType Name/Value
 0x0001 (NEEDED) Shared library: [libpython2.7.so.1.0]
...
 0x0001 (NEEDED) Shared library: [ld-linux-x86-64.so.2]
 0x000f (RPATH)  Library rpath: [$ORIGIN/../lib]

Best Regards,

Brian.

--
resolution:  -> not a bug

___
Python tracker 
<https://bugs.python.org/issue31744>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com