[Bug 1768644] [NEW] PY_CFLAGS contains reference to -specs=/usr/share/dpkg/no-pie-compile.specs

Anthony Sottile 1768644 at bugs.launchpad.net
Wed May 2 19:47:44 UTC 2018


Public bug reported:

Minimal reproduction (docker):

FROM ubuntu:bionic
RUN apt-get update && \
    apt-get install -y --no-install-recommends gcc python-dev virtualenv && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*
RUN virtualenv /venv -ppython3 && \
    /venv/bin/pip install ujson


Fails with:

Collecting ujson
  Downloading https://files.pythonhosted.org/packages/16/c4/79f3409bc710559015464e5f49b9879430d8f87498ecdc335899732e5377/ujson-1.35.tar.gz (192kB)
Building wheels for collected packages: ujson
  Running setup.py bdist_wheel for ujson: started
  Running setup.py bdist_wheel for ujson: finished with status 'error'
  Complete output from command /venv/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-x7e5igby/ujson/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-de4xsrzr --python-tag cp36:
  running bdist_wheel
  running build
  running build_ext
  building 'ujson' extension
  creating build
  creating build/temp.linux-x86_64-3.6
  creating build/temp.linux-x86_64-3.6/python
  creating build/temp.linux-x86_64-3.6/lib
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.6-EKG1lX/python3.6-3.6.5=. -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I./python -I./lib -I/usr/include/python3.6m -I/venv/include/python3.6m -c ./python/ujson.c -o build/temp.linux-x86_64-3.6/./python/ujson.o -D_GNU_SOURCE
  x86_64-linux-gnu-gcc: error: /usr/share/dpkg/no-pie-compile.specs: No such file or directory
  error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
  
  ----------------------------------------
  Failed building wheel for ujson
  Running setup.py clean for ujson
Failed to build ujson
Installing collected packages: ujson
  Running setup.py install for ujson: started
    Running setup.py install for ujson: finished with status 'error'
    Complete output from command /venv/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-x7e5igby/ujson/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-d0l7cnq5/install-record.txt --single-version-externally-managed --compile --install-headers /venv/include/site/python3.6/ujson:
    running install
    running build
    running build_ext
    building 'ujson' extension
    creating build
    creating build/temp.linux-x86_64-3.6
    creating build/temp.linux-x86_64-3.6/python
    creating build/temp.linux-x86_64-3.6/lib
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.6-EKG1lX/python3.6-3.6.5=. -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I./python -I./lib -I/usr/include/python3.6m -I/venv/include/python3.6m -c ./python/ujson.c -o build/temp.linux-x86_64-3.6/./python/ujson.o -D_GNU_SOURCE
    x86_64-linux-gnu-gcc: error: /usr/share/dpkg/no-pie-compile.specs: No such file or directory
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
    
    ----------------------------------------
Command "/venv/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-x7e5igby/ujson/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-d0l7cnq5/install-record.txt --single-version-externally-managed --compile --install-headers /venv/include/site/python3.6/ujson" failed with error code 1 in /tmp/pip-install-x7e5igby/ujson/
The command '/bin/sh -c virtualenv /venv -ppython3 &&     /venv/bin/pip install ujson' returned a non-zero code: 1


The root cause of this seems to be the PY_CFLAGS sysconfig setting which contains flags that were used to build python itself, including a reference to a file which doesn't exist:


root at 71b2faa3da66:/# python3 -m sysconfig | grep no-pie-compile
	CFLAGS = "-Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.6-EKG1lX/python3.6-3.6.5=. -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector-strong -Wformat -Werror=format-security"
	CONFIGURE_CFLAGS = "-g -fdebug-prefix-map=/build/python3.6-EKG1lX/python3.6-3.6.5=. -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector-strong -Wformat -Werror=format-security"
	CONFIG_ARGS = "'--enable-shared' '--prefix=/usr' '--enable-ipv6' '--enable-loadable-sqlite-extensions' '--with-dbmliborder=bdb:gdbm' '--with-computed-gotos' '--without-ensurepip' '--with-system-expat' '--with-system-libmpdec' '--with-system-ffi' 'CC=x86_64-linux-gnu-gcc' 'CFLAGS=-g -fdebug-prefix-map=/build/python3.6-EKG1lX/python3.6-3.6.5=. -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector-strong -Wformat -Werror=format-security ' 'LDFLAGS=-Wl,-Bsymbolic-functions -specs=/usr/share/dpkg/no-pie-link.specs -Wl,-z,relro' 'CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2'"
	PY_CFLAGS = "-Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.6-EKG1lX/python3.6-3.6.5=. -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector-strong -Wformat -Werror=format-security"
	PY_CORE_CFLAGS = "-Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.6-EKG1lX/python3.6-3.6.5=. -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector-strong -Wformat -Werror=format-security -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -IObjects -IInclude -IPython -I. -I../Include -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DPy_BUILD_CORE"

** Affects: python3-defaults (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to python3-defaults in Ubuntu.
https://bugs.launchpad.net/bugs/1768644

Title:
  PY_CFLAGS contains reference to -specs=/usr/share/dpkg/no-pie-
  compile.specs

Status in python3-defaults package in Ubuntu:
  New

Bug description:
  Minimal reproduction (docker):

  FROM ubuntu:bionic
  RUN apt-get update && \
      apt-get install -y --no-install-recommends gcc python-dev virtualenv && \
      apt-get clean && \
      rm -rf /var/lib/apt/lists/*
  RUN virtualenv /venv -ppython3 && \
      /venv/bin/pip install ujson

  
  Fails with:

  Collecting ujson
    Downloading https://files.pythonhosted.org/packages/16/c4/79f3409bc710559015464e5f49b9879430d8f87498ecdc335899732e5377/ujson-1.35.tar.gz (192kB)
  Building wheels for collected packages: ujson
    Running setup.py bdist_wheel for ujson: started
    Running setup.py bdist_wheel for ujson: finished with status 'error'
    Complete output from command /venv/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-x7e5igby/ujson/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-de4xsrzr --python-tag cp36:
    running bdist_wheel
    running build
    running build_ext
    building 'ujson' extension
    creating build
    creating build/temp.linux-x86_64-3.6
    creating build/temp.linux-x86_64-3.6/python
    creating build/temp.linux-x86_64-3.6/lib
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.6-EKG1lX/python3.6-3.6.5=. -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I./python -I./lib -I/usr/include/python3.6m -I/venv/include/python3.6m -c ./python/ujson.c -o build/temp.linux-x86_64-3.6/./python/ujson.o -D_GNU_SOURCE
    x86_64-linux-gnu-gcc: error: /usr/share/dpkg/no-pie-compile.specs: No such file or directory
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
    
    ----------------------------------------
    Failed building wheel for ujson
    Running setup.py clean for ujson
  Failed to build ujson
  Installing collected packages: ujson
    Running setup.py install for ujson: started
      Running setup.py install for ujson: finished with status 'error'
      Complete output from command /venv/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-x7e5igby/ujson/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-d0l7cnq5/install-record.txt --single-version-externally-managed --compile --install-headers /venv/include/site/python3.6/ujson:
      running install
      running build
      running build_ext
      building 'ujson' extension
      creating build
      creating build/temp.linux-x86_64-3.6
      creating build/temp.linux-x86_64-3.6/python
      creating build/temp.linux-x86_64-3.6/lib
      x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.6-EKG1lX/python3.6-3.6.5=. -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I./python -I./lib -I/usr/include/python3.6m -I/venv/include/python3.6m -c ./python/ujson.c -o build/temp.linux-x86_64-3.6/./python/ujson.o -D_GNU_SOURCE
      x86_64-linux-gnu-gcc: error: /usr/share/dpkg/no-pie-compile.specs: No such file or directory
      error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
      
      ----------------------------------------
  Command "/venv/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-x7e5igby/ujson/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-d0l7cnq5/install-record.txt --single-version-externally-managed --compile --install-headers /venv/include/site/python3.6/ujson" failed with error code 1 in /tmp/pip-install-x7e5igby/ujson/
  The command '/bin/sh -c virtualenv /venv -ppython3 &&     /venv/bin/pip install ujson' returned a non-zero code: 1

  
  The root cause of this seems to be the PY_CFLAGS sysconfig setting which contains flags that were used to build python itself, including a reference to a file which doesn't exist:

  
  root at 71b2faa3da66:/# python3 -m sysconfig | grep no-pie-compile
  	CFLAGS = "-Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.6-EKG1lX/python3.6-3.6.5=. -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector-strong -Wformat -Werror=format-security"
  	CONFIGURE_CFLAGS = "-g -fdebug-prefix-map=/build/python3.6-EKG1lX/python3.6-3.6.5=. -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector-strong -Wformat -Werror=format-security"
  	CONFIG_ARGS = "'--enable-shared' '--prefix=/usr' '--enable-ipv6' '--enable-loadable-sqlite-extensions' '--with-dbmliborder=bdb:gdbm' '--with-computed-gotos' '--without-ensurepip' '--with-system-expat' '--with-system-libmpdec' '--with-system-ffi' 'CC=x86_64-linux-gnu-gcc' 'CFLAGS=-g -fdebug-prefix-map=/build/python3.6-EKG1lX/python3.6-3.6.5=. -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector-strong -Wformat -Werror=format-security ' 'LDFLAGS=-Wl,-Bsymbolic-functions -specs=/usr/share/dpkg/no-pie-link.specs -Wl,-z,relro' 'CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2'"
  	PY_CFLAGS = "-Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.6-EKG1lX/python3.6-3.6.5=. -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector-strong -Wformat -Werror=format-security"
  	PY_CORE_CFLAGS = "-Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.6-EKG1lX/python3.6-3.6.5=. -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector-strong -Wformat -Werror=format-security -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -IObjects -IInclude -IPython -I. -I../Include -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DPy_BUILD_CORE"

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/python3-defaults/+bug/1768644/+subscriptions



More information about the foundations-bugs mailing list