Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Greenlet Crystax/Python3 support, fixes #1245 #1250

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions pythonforandroid/archs.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ def get_env(self, with_flags_in_cc=True):

if self.ctx.ndk == 'crystax':
env['LDFLAGS'] += ' -L{}/sources/crystax/libs/{} -lcrystax'.format(self.ctx.ndk_dir, self.arch)
env['CFLAGS'] += ' -I{}/sources/python/{}/include/python/'.format(
self.ctx.ndk_dir, self.ctx.python_recipe.version[0:3])
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe other recipes should benefit from it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is now probably addressed in #1361


py_platform = sys.platform
if py_platform in ['linux2', 'linux3']:
Expand Down
12 changes: 12 additions & 0 deletions pythonforandroid/recipes/greenlet/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
from pythonforandroid.toolchain import PythonRecipe


Expand All @@ -6,4 +7,15 @@ class GreenletRecipe(PythonRecipe):
url = 'https://pypi.python.org/packages/source/g/greenlet/greenlet-{version}.tar.gz'
depends = [('python2', 'python3crystax')]

def get_recipe_env(self, arch=None, with_flags_in_cc=True):
env = super(GreenletRecipe, self).get_recipe_env(arch, with_flags_in_cc)
# sets linker to use the correct gcc (cross compiler)
env['LDSHARED'] = env['CC'] + ' -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions'
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise the default host linker was picked up rather than the ARM cross compiler.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also addressed in #1361

# required additional library and path for Crystax
if self.ctx.ndk == 'crystax':
env['LDFLAGS'] += ' -L{}'.format(os.path.join(self.ctx.bootstrap.build_dir, 'libs', arch.arch))
env['LDFLAGS'] += ' -lpython{}m'.format(self.ctx.python_recipe.version[0:3])
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So that we don't get run time cannot locate symbol errors.

return env


recipe = GreenletRecipe()