1. Ronald Oussoren
  2. py2app
  3. Issues


Issue #93 resolved

Mach-O header may be too large to relocate

created an issue

I am trying to create a Face Recognition App named Facel in Mountain Lion. This App uses following libraries: PyVision, OpenCV, libsvm, SciPy, and Python Imaging Library and wxPython. Now when I am trying to create the app using python setup.py py2app then it gives me a following error: ValueError: New Mach-O header is too large to relocate I have attached a txt file(problem.txt) giving the more detailed version of the error. I have tried googling it and I also tried changing the line with configure.ldflags in portconfigure.tcl file of MacPort to: default configure.ldflags {"-L${prefix}/lib -Xlinker -headerpad_max_install_names"} And I rebuilt some of the libraries again but still it kept on giving me the same error. Can you please help me with this? I have also attached all the source files in the zip.

Comments (7)

  1. Ronald Oussoren repo owner

    The only workaround is to ensure that all libraries are either build with -Wl,-headerpad_max_install_names in the linker flags, or by ensuring that the install prefix of libraries is deep enough (e.g. change the macports install root to something like "/Library/BuildSystem/MacPortsTree" (basicly the path to the prefix for macports should be longer than the string "@executablepath/../Frameworks"). This ensures that the replacement string used by py2app is shorter than the one used when building.

    I don't know how to get MacPorts to add the right linker flags, and changing the install prefix might not be a good idea (I wouldn't be surprised if an alternate install prefix is barely tested).

  2. David Smith

    After a few iterations, py2app built the app successfully. I buried macports at /opt/localdepth/localdepth/localdepth/localdepth/local and I built the app with py2app in /opt/build. Thanks for your help.

  3. Ronald Oussoren repo owner

    I've added a faq file to the documentation that mentions this problem.

    That, sadly enough, is the best I can do at the moment (and better documentation is all that can be done in the long run). It is too bad that py2app (or rather macholib) cannot rewrite all headers, but that would basicly require the implementation of a full linker.

  4. Cole Morris

    Ronald Oussoren

    Running into this error. Unfortunately, not experienced enough to fully understand how to approach these suggestions as they're provided.

    How would I go about specifying the linker flags you provided (-Wl,-headerpad_max_install_names)?

  5. Log in to comment