[WIP] Add correct CFLAGS to hostpython3 and -fPIC flag to avoid relocation error for few recipes
I think this fixes #2074 (and related), at least for me on macOS. I tried to build the KivyMD Kittchen Sink app for x86, armv7 and armv8-64, and went ok on my machine (macOS Catalina) using latest NDK 21.0.6113669 and also 19c.
PS: Most of the changes are related to automatic formatting using black.
Ok, I should have re-done all the edits disabling Black auto formatting (on my Vim 🤣 )
Ok, everything looks like it's working now. Only thing, I don't know how to fix the Travis error...
The Travis error is probably a flaky test, I've restarted this specific job to see. For future records this was the error:
def test_blacklist():
# First, get order without blacklist:
build_order, python_modules, bs = get_recipe_order_and_bootstrap(
ctx, ["python3", "kivy"], None
)
# Now, obtain again with blacklist:
build_order_2, python_modules_2, bs_2 = get_recipe_order_and_bootstrap(
ctx, ["python3", "kivy"], None, blacklist=["libffi"]
)
assert "libffi" not in build_order_2
> assert set(build_order_2).union({"libffi"}) == set(build_order)
E AssertionError: assert {'android', '...pyjnius', ...} == {'android', '...openssl', ...}
E Extra items in the right set:
E 'genericndkbuild'
E Use -v to get the full diff
tests/test_graph.py:96: AssertionError
And the PR looks good to me thanks :+1: I'll let @opacam have the final word for it
Ok, that test went well now.
Unfortunately, this does not fix the problem with pyconfig.h on macOS. I just realized that if I run the configure and then make command of the hostpython3 with a completely empty environment except for the CPPFLAG pointing to the pyconfig. It works. But then it breaks on Linux.
I also discovered this anomaly: https://bugs.python.org/issue40261
Can any of you with a mac try it out and check if it's getting the same?
@rubendibattista , there is an ongoing PR that fix the pyconfig.h issue (#2159)...could we deal with the -fPIC thing in here?
@opacam That's great. I guess those are two different problems. Maybe just land the PR about the pyconfig and I'll reabse and test againt the -fPIC flag. What do you think?
As you wish, but I think that you could do it whithout waiting if you want (I don't think that we have merge conflicts), whatever you decide is fine to me :wink: