Search code examples
pythondynamic-linkingstatic-linkingpypyrpython

Specifying installed native library paths during pypy translate


I am trying to build the latest pypy repo on a Mac machine. One of the needed libraries, libintl, is installed in $HOME/opt/local/lib. I run (using a previously built pypy-c),

pypy-c translate.py -Ojit --ldflags=-L~/opt/local/lib --cflags=-L~/opt/local/lib

However, after about half an hour, it stalls with

[translation:ERROR]     ld: library not found for -lintl
[translation:ERROR]     collect2: ld returned 1 exit status
[translation:ERROR]     make: *** [pypy-c] Error 1
[translation:ERROR]     """)

So how am I supposed to specify the path for this library? I would assume the same would happen for compiling and executing custom rpython programs.


Solution

  • New Environment Variable

    Talk about timing — I just added support for this! You can now set a PYPY_LOCALBASE environment variable when you translate, e.g.

    PYPY_LOCALBASE=/Users/tav/local pypy-c translate.py -Ojit
    

    It will then add the lib and include directories inside PYPY_LOCALBASE to the library/include paths, i.e. /Users/tav/local/lib and /Users/tav/local/include.

    Issues with Fink & Macports

    It's been a while since I've used either, but the gettext package provided by the package mgmt. systems used to be a source of pain — builds, including CPython, would get contaminated by packages provided by Macports and friends, e.g. http://bugs.python.org/issue7679

    Translation From Tip Should Now Work on OS X

    I've spent the last few weeks fixing up the various edge cases with building PyPy on OS X. And hopefully, as of last night, it should now build with a simple pypy-c translate.py -Ojit with nothing except plain old Xcode.

    Just pull the current tip/master with hg or git and you should be good to go... let me know how it goes. Thanks!