Reputation: 707
I am attempting to install Python 2.7.14 from source inside of a Docker container with the fpectl
module enabled.
Using the official Python jessie Dockerfile as a starting point, I have added the --with-fpectl
configuration option to the ./configure
command.
You can see the full output of my docker build command in this gist; however, here are a few of the interesting bits:
./configure --build=x86_64-linux-gnu --enable-shared --enable-unicode=ucs4 --with-fpectl
...
checking for --with-fpectl... yes
...
x86_64-linux-gnu-gcc -pthread -fPIC -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I. -IInclude -I./Include -I/usr/include/x86_64-linux-gnu -I/usr/local/include -I/usr/src/python/Include -I/usr/src/python -c /usr/src/python/Modules/mathmodule.c -o build/temp.linux-x86_64-2.7/usr/src/python/Modules/mathmodule.o
In file included from Include/Python.h:156:0,
from /usr/src/python/Modules/mathmodule.c:55:
/usr/src/python/Modules/mathmodule.c: In function ‘math_fsum’:
Include/pyfpe.h:164:64: warning: passing argument 1 of ‘PyFPE_dummy’ discards ‘volatile’ qualifier from pointer target type [-Wdiscarded-qualifiers]
#define PyFPE_END_PROTECT(v) PyFPE_counter -= (int)PyFPE_dummy(&(v));
^
/usr/src/python/Modules/mathmodule.c:1072:5: note: in expansion of macro ‘PyFPE_END_PROTECT’
PyFPE_END_PROTECT(hi)
^
Include/pyfpe.h:134:15: note: expected ‘void *’ but argument is of type ‘volatile double *’
extern double PyFPE_dummy(void *);
^
...
Python build finished, but the necessary bits to build these modules were not found:
bsddb185 dl imageop
sunaudiodev
To find the necessary bits, look in setup.py in detect_modules() for the module's name.
(I actually think the error message from mathmodule.c
is benign, but I thought I would include it for context, as it's the only other output that seems to be related to the fpectl
module.)
When I spin up a container with the image created by this build, I have a working Python installation, but no fpectl
module:
docker run -it <IMAGE ID> /bin/bash
root@54895ad345bb:/# python
Python 2.7.14 (default, Nov 16 2017, 02:12:20)
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import fpectl
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named fpectl
>>> import sysconfig
>>> print(sysconfig.get_config_var('CONFIG_ARGS'))
'--build=x86_64-linux-gnu' '--enable-shared' '--enable-unicode=ucs4' '--with-fpectl' 'build_alias=x86_64-linux-gnu'
>>> help("modules")
Please wait a moment while I gather a list of all available modules...
BaseHTTPServer ast imghdr sha
Bastion asynchat imp shelve
CDROM asyncore importlib shlex
CGIHTTPServer atexit imputil shutil
Canvas audiodev inspect signal
ConfigParser audioop io site
Cookie base64 itertools smtpd
DLFCN bdb json smtplib
Dialog binascii keyword sndhdr
DocXMLRPCServer binhex lib2to3 socket
FileDialog bisect linecache spwd
FixTk bsddb linuxaudiodev sqlite3
HTMLParser bz2 locale sre
IN cPickle logging sre_compile
MimeWriter cProfile macpath sre_constants
Queue cStringIO macurl2path sre_parse
ScrolledText calendar mailbox ssl
SimpleDialog cgi mailcap stat
SimpleHTTPServer cgitb markupbase statvfs
SimpleXMLRPCServer chunk marshal string
SocketServer cmath math stringold
StringIO cmd md5 stringprep
TYPES code mhlib strop
Tix codecs mimetools struct
Tkconstants codeop mimetypes subprocess
Tkdnd collections mimify sunau
Tkinter colorsys mmap sunaudio
UserDict commands modulefinder symbol
UserList compileall multifile symtable
UserString compiler multiprocessing sys
_LWPCookieJar contextlib mutex sysconfig
_MozillaCookieJar cookielib netrc syslog
__builtin__ copy new tabnanny
__future__ copy_reg nis tarfile
_abcoll crypt nntplib telnetlib
_ast csv ntpath tempfile
_bisect ctypes nturl2path termios
_bsddb curses numbers textwrap
_codecs datetime opcode this
_codecs_cn dbhash operator thread
_codecs_hk dbm optparse threading
_codecs_iso2022 decimal os time
_codecs_jp difflib os2emxpath timeit
_codecs_kr dircache ossaudiodev tkColorChooser
_codecs_tw dis parser tkCommonDialog
_collections distutils pdb tkFileDialog
_csv doctest pickle tkFont
_ctypes dumbdbm pickletools tkMessageBox
_ctypes_test dummy_thread pip tkSimpleDialog
_curses dummy_threading pipes toaiff
_curses_panel easy_install pkg_resources token
_elementtree email pkgutil tokenize
_functools encodings platform trace
_hashlib ensurepip plistlib traceback
_heapq errno popen2 ttk
_hotshot exceptions poplib tty
_io fcntl posix turtle
_json filecmp posixfile types
_locale fileinput posixpath unicodedata
_lsprof fnmatch pprint unittest
_multibytecodec formatter profile urllib
_multiprocessing fpformat pstats urllib2
_osx_support fractions pty urlparse
_pyio ftplib pwd user
_random functools py_compile uu
_socket future_builtins pyclbr uuid
_sqlite3 gc pydoc virtualenv
_sre gdbm pydoc_data virtualenv_suppor
_ssl genericpath pyexpat warnings
_strptime getopt quopri wave
_struct getpass random weakref
_symtable gettext re webbrowser
_sysconfigdata glob readline wheel
_testcapi grp repr whichdb
_threading_local gzip resource wsgiref
_tkinter hashlib rexec xdrlib
_warnings heapq rfc822 xml
_weakref hmac rlcompleter xmllib
_weakrefset hotshot robotparser xmlrpclib
abc htmlentitydefs runpy xxsubtype
aifc htmllib sched zipfile
antigravity httplib select zipimport
anydbm idlelib sets zlib
argparse ihooks setuptools
array imaplib sgmllib
I am aware that usage of the fpectl
module is discouraged, and that it's not present in Python builds bundled with the official Python Docker images; however, it is a requirement for my use case (specifically, operability with a Cython module compiled against a Python installation using --with-fpectl
, more information here and here).
It looks like the python
package available via aptly does include the fpectl
module (see below). However, in this case I'd prefer to build from source for various reasons (including the ability to use the latest 2.7.x). I've tried to inspect the configuration options used for the Python package installation, but using those options in my own Docker build doesn't seem to install the module either.
Installing via apt:
root@54895ad345bb:/# apt-get install -y python
...
root@54895ad345bb:/# /usr/bin/python
Python 2.7.9 (default, Jun 29 2016, 13:08:31)
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import fpectl
# no import error!
>>> import sysconfig
>>> print(sysconfig.get_config_var('CONFIG_ARGS'))
'--enable-shared' '--prefix=/usr' '--enable-ipv6' '--enable-unicode=ucs4' '--with-dbmliborder=bdb:gdbm' '--with-system-expat' '--with-system-ffi' '--with-fpectl' 'CC=x86_64-linux-gnu-gcc' 'CFLAGS=-D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security ' 'LDFLAGS=-Wl,-z,relro'
With all that said, what am I missing? Is there some additional system package required to enable this module, or some additional flags required during the configuration step?
Upvotes: 2
Views: 1206