Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not enough room for program headers error during do_strip() phase of build #1514

Open
bixu opened this issue Nov 25, 2016 · 6 comments
Open
Labels
Focus :Plan Build Type: Bug Issues that describe broken functionality

Comments

@bixu
Copy link
Contributor

bixu commented Nov 25, 2016

The error in full looks like (as pip install finishes inside the build):

  Running setup.py install for <module> ... done
Successfully installed <module>-<version>
   api: Writing configuration
   api: Writing service management scripts
   api: Using run hook /src/habitat/hooks/run
   api: Stripping unneeded symbols from binaries and libraries
strip: /hab/pkgs/<origin>/<package>/2.0.0/20161125203757/lib/python2.7/site-packages/.libs_cffi_backend/stkCxH1R: Not enough room for program headers, try linking with -N
strip:/hab/pkgs/<origin>/<package>/2.0.0/20161125203757/lib/python2.7/site-packages/.libs_cffi_backend/stkCxH1R[.note.gnu.build-id]: Bad value

I'm seeing this on macOS El Capitan when building a fairly complex Python app inside the Studio. While I can't share the source code, I can share edited requirements.txt and plan.sh content:

$ cat plan.sh

pkg_name=<pkgname>
pkg_version=2.0.0
pkg_maintainer=""
pkg_license=("All Rights Reserved")
pkg_source=""
pkg_origin="<origin>"
pkg_deps=(
  bixu/hdf5
  core/libffi
  core/postgresql
  core/python2
)
pkg_build_deps=(
  core/cacerts
  core/gcc
  core/git
  core/openssl
)
pkg_bin_dirs=(bin)
pkg_lib_dirs=(lib)
pkg_include_dirs=(include)
pkg_expose=(8080)

do_download(){
  return 0
}

do_verify(){
  return 0
}

do_unpack(){
  return 0
}

do_prepare(){
  export LD_LIBRARY_PATH=$(hab pkg path core/gcc)/lib
  export SSL_CERT_FILE=$(hab pkg path core/cacerts)/ssl/cert.pem
  export HOME=/src

  pip install --upgrade pip virtualenv
  virtualenv "$pkg_prefix"
  source "$pkg_prefix/bin/activate"
}

do_build(){
  return 0
}

do_install(){
  # we have to pre-install some modules in a certain order to get around `pip` dep problems
  pip install $(grep numpy /src/requirements.txt)
  pip install $(grep numexpr /src/requirements.txt)
  pip install $(grep Cython /src/requirements.txt)
  pip install -r /src/requirements.dev.txt
  pip install /src  # here we are installing our internal python module
}

$ cat requirements.txt

astroid==1.4.8
cov-core==1.15.0
coverage==4.2
execnet==1.4.1
ipdb==0.10.1
ipython==5.1.0
logilab-common==1.2.2
mock==2.0.0
nose==1.3.7
pdbpp==0.8.3
py==1.4.30
pytest==3.0.3
pytest-catchlog==1.2.2
pytest-mock==1.3.0
pytest-cov==2.4.0
pytest-cache==1.0
pytest-pep8==1.0.6
pytest-random==0.02
pytest-watch==4.1.0
pytest-pylint==0.6.0
pytest-timeout==1.0.0
pep8==1.7.0
pylint==1.6.4
Sphinx==1.5a2
sqlalchemy-schemadisplay==1.2
WTForms==2.1
Babel==2.2.0
backports.ssl-match-hostname==3.5.0.1
Cython==0.25.1
Flask-Autodoc==0.1.2
Flask-SQLALchemy==2.1
Flask==0.11.1
ftputil==3.3.1
Jinja2==2.7.3
Mako==1.0.1
MarkupSafe==0.23
SQLAlchemy==1.1.4
Werkzeug==0.11.11
alembic==0.8.8
ansible==1.8.2
argparse==1.2.1
bcrypt==2.0.0
blinker==1.4
boto3==1.2.2
boto==2.38.0
bugsnag==2.5.2
celery==3.1.23
click==6.2
greenlet==0.4.7
itsdangerous==0.24
newrelic==2.66.0.49
numexpr==2.6.1
numpy==1.11.1
pandas==0.18.1
pdfkit==0.5.0
perfmetrics==2.0
prettytable==0.7.2
psycopg2==2.6.2
python-dateutil==2.4.0
python-redis-lock==3.1.0
pytz==2016.6.1
requests[security]==2.7.0
redis==2.10.5
scikit-learn==0.15.2
scipy==0.18.0
setuptools==17.1
six==1.10.0
structlog==16.1.0
termcolor==1.1.0
uwsgi==2.0.11.2
wsgiref==0.1.2

I have no custom HAB environment variables set.

@fnichol
Copy link
Collaborator

fnichol commented Nov 27, 2016

Hi there!

If the default behavior of stripping ELF binaries isn't working for you, do adding a

do_strip() {
  return 0
}

help you out? Not every Plan works with this default, but we hypothesize that the vast majority benefit from this (similar to most other Linux distribution packaging systems).

@bixu
Copy link
Contributor Author

bixu commented Nov 27, 2016 via email

@eeyun eeyun added this to the Core Engineering milestone Mar 1, 2017
@bdangit
Copy link
Contributor

bdangit commented Mar 20, 2017

Ran into this today. I didn't like the answer of not stripping your binaries.

Pythoners like to include pre-built binaries inside their module. You have the option to ignore these pre-built things and always build from source.

pip install --no-binary :all: <package> or pip install --no-binary :all: -r requirements.txt will force pip to build from source. Be prepared to add more dependencies other than just core/python, as you’ll need core/gcc and any other libraries needed.

ref: http://serverfault.com/questions/774546/linux-binary-strip-error-when-using-pip-install-not-enough-room-for-program-hea
ref: numpy/numpy#7570

now i can use the default do_strip() without any stubs.

@smartb-pair
Copy link

@eeyun, perhaps @bdangit's advice (I think I remember @georgemarshall saying the same thing) should be part of core/scaffolding-python?

@stale
Copy link

stale bot commented Apr 3, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. We value your input and contribution. Please leave a comment if this issue still affects you.

@stale stale bot added the Stale label Apr 3, 2020
@christophermaier christophermaier added Type: Bug Issues that describe broken functionality and removed C-bug labels Jul 31, 2020
@stale stale bot removed the Stale label Jul 31, 2020
@rahulgoel1 rahulgoel1 removed the V-devx label Jul 23, 2021
@stale
Copy link

stale bot commented Oct 16, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. We value your input and contribution. Please leave a comment if this issue still affects you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Focus :Plan Build Type: Bug Issues that describe broken functionality
Projects
None yet
Development

No branches or pull requests

8 participants