python-for-android icon indicating copy to clipboard operation
python-for-android copied to clipboard

[WIP] Add correct CFLAGS to hostpython3 and -fPIC flag to avoid relocation error for few recipes

Open rdbisme opened this issue 5 years ago • 8 comments

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.

rdbisme avatar Apr 10 '20 01:04 rdbisme

Ok, I should have re-done all the edits disabling Black auto formatting (on my Vim 🤣 )

rdbisme avatar Apr 10 '20 12:04 rdbisme

Ok, everything looks like it's working now. Only thing, I don't know how to fix the Travis error...

rdbisme avatar Apr 10 '20 16:04 rdbisme

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

AndreMiras avatar Apr 10 '20 16:04 AndreMiras

Ok, that test went well now.

rdbisme avatar Apr 10 '20 17:04 rdbisme

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?

rdbisme avatar Apr 12 '20 16:04 rdbisme

@rubendibattista , there is an ongoing PR that fix the pyconfig.h issue (#2159)...could we deal with the -fPIC thing in here?

opacam avatar Apr 29 '20 10:04 opacam

@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?

rdbisme avatar Apr 29 '20 10:04 rdbisme

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:

opacam avatar Apr 29 '20 10:04 opacam