Closed cbhushan closed 8 months ago
portable-python
tries hard to avoid things like /usr/local
, because that would mean the compiled binary would imply users to have the same (or compatible) /usr/local
as well.
For libffi
, it will use the system one if you have libffi-dev
(as the upstream setup does).
portable-python
can however also compile statically libffi
, so that the produced binary works wether or not target user has /usr/local/lib*
Why don't you simply compile libffi
statically? You can do so via config or by adding -m libffi
on the command line
OOh, "broken, can't compile without libffi-dev" -> that reminds me, I indeed observed that even if you do want libffi
compiled statically, for whatever reason the upstream setup will fail compilation, libffi-dev
is unfortunately needed.
I don't know why, probably some bug in upstream ./configure
Thank you for the response. I am actually trying to get things working in older CentOS 6.x environment, and upstream libffi-devel
is too old for python 3.8. So, I had to build my own version in /usr/local
. And the same case for openssl, sqlite.
OOh, "broken, can't compile without libffi-dev" -> that reminds me, I indeed observed that even if you do want
libffi
compiled statically, for whatever reason the upstream setup will fail compilation,libffi-dev
is unfortunately needed. I don't know why, probably some bug in upstream./configure
Based on your above response, it seems there is no way to get portable-python
work in my scenario with older CentOS 6.x environment. If so, feel free to close the issue or mark as unfixable etc.
PS: BTW, I think that it would help users to understand difference between portable-python
and python-build-standalone (Github link). My understanding, which may be wrong, is that portable-python
targets to create binaries that will be used on same/very similar environment. Correct?
Good point, that's a good doc to have indeed. I looked initially at python-build-standalone, but I was having trouble to make it successfully compile, and it didn't create portable binaries, I submitted a PR at the time here for one issue preventing portability: https://github.com/indygreg/python-build-standalone/pull/61
It looks like it was eventually fixed indeed now.
I'd need to re-examine python-build-standalone to list exact differences, originally it was:
portable-python
is "simpler", doesn't try to support cross-compilingTry installing libffi-devel
, and then instruct portable-python
to statically compile libffi
(with for example -m libffi
) -> it should work then. Ie: you will get a statically compiled libffi
(the libffi-devel
will just be there to satisfy the upstream cpython ./configure
at compile time - I'm sorry I couldn't find what exactly was making it consistently fail without it otherwise)
I have few custom version of libraries installed in
/usr/local
. These are openssl, sqlite, libffi. I was able even able to build python 3.8 with these libraries.portable-python was installed using pipx (in the same python 3.8 I built above). Now when I try to use portable-python to build portable 3.7, I get following error.
libffi.s0 files are in /usr/local as seen below, and so are other include files:
Is there a way to tell portable-python to look for libraries in
/usr/local
? Or any other suggestions to avoid above error?