Skip to content

Build crashes if NDK is installed system-wide without write permissions #1621

Closed

Description

Versions

shouldn't be relevant

Description

There is an issue (I thought it was a regression introduced by #1618 at first, but I think this was broken before) where in an environment where the NDK is installed system-wide, the build will crash because then files cannot simply be changed:

[INFO]:    Building lxml for armeabi-v7a
[INFO]:    lxml apparently isn't already in site-packages
[DEBUG]:   -> running ln -sf /ndk/platforms/android-21/arch-arm/usr/lib/libc.so /ndk/platforms/android-21/arch-arm/usr/lib/librt.so
[DEBUG]:   	/bin/ln: failed to create symbolic link '/ndk/platforms/android-21/arch-arm/usr/lib/librt.so': Permission denied
Exception in thread background thread for pid 18688:
Traceback (most recent call last):
  File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.6/threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "/home/userhome/.local/lib/python3.6/site-packages/sh.py", line 1540, in wrap
    fn(*args, **kwargs)
  File "/home/userhome/.local/lib/python3.6/site-packages/sh.py", line 2459, in background_thread
    handle_exit_code(exit_code)
  File "/home/userhome/.local/lib/python3.6/site-packages/sh.py", line 2157, in fn
    return self.command.handle_command_exit_code(exit_code)
  File "/home/userhome/.local/lib/python3.6/site-packages/sh.py", line 815, in handle_command_exit_code
    raise exc
sh.ErrorReturnCode_1: 

  RAN: /bin/ln -sf /ndk/platforms/android-21/arch-arm/usr/lib/libc.so /ndk/platforms/android-21/arch-arm/usr/lib/librt.so

  STDOUT:
/bin/ln: failed to create symbolic link '/ndk/platforms/android-21/arch-arm/usr/lib/librt.so': Permission denied


  STDERR:


Traceback (most recent call last):
  File "/home/userhome/.local/bin/p4a", line 11, in <module>
    sys.exit(main())
  File "/home/userhome/.local/lib/python3.6/site-packages/pythonforandroid/toolchain.py", line 1033, in main
    ToolchainCL()
  File "/home/userhome/.local/lib/python3.6/site-packages/pythonforandroid/toolchain.py", line 553, in __init__
    getattr(self, args.subparser_name.replace('-', '_'))(args)
  File "/home/userhome/.local/lib/python3.6/site-packages/pythonforandroid/toolchain.py", line 150, in wrapper_func
    build_dist_from_args(ctx, dist, args)
  File "/home/userhome/.local/lib/python3.6/site-packages/pythonforandroid/toolchain.py", line 191, in build_dist_from_args
    build_recipes(build_order, python_modules, ctx)
  File "/home/userhome/.local/lib/python3.6/site-packages/pythonforandroid/build.py", line 634, in build_recipes
    recipe.build_arch(arch)
  File "/home/userhome/.local/lib/python3.6/site-packages/pythonforandroid/recipe.py", line 902, in build_arch
    self.build_compiled_components(arch)
  File "/home/userhome/.local/lib/python3.6/site-packages/pythonforandroid/recipes/lxml/__init__.py", line 35, in build_compiled_components
    shprint(sh.ln, '-sf', link_c + '.so', link_rt + '.so')
  File "/home/userhome/.local/lib/python3.6/site-packages/pythonforandroid/logger.py", line 178, in shprint
    for line in output:
  File "/home/userhome/.local/lib/python3.6/site-packages/sh.py", line 863, in next
    self.wait()
  File "/home/userhome/.local/lib/python3.6/site-packages/sh.py", line 792, in wait
    self.handle_command_exit_code(exit_code)
  File "/home/userhome/.local/lib/python3.6/site-packages/sh.py", line 815, in handle_command_exit_code
    raise exc
sh.ErrorReturnCode_1: 

  RAN: /bin/ln -sf /ndk/platforms/android-21/arch-arm/usr/lib/libc.so /ndk/platforms/android-21/arch-arm/usr/lib/librt.so

  STDOUT:
/bin/ln: failed to create symbolic link '/ndk/platforms/android-21/arch-arm/usr/lib/librt.so': Permission denied

Now that I am pondering this, this also seems somewhat ugly to me (not the symlink in itself, but actually writing around inside the NDK folder - I don't think this is to be expected from the user). Therefore I think a better solution should be found that doesn't require write permissions in the NDK folder

Activity

  1. ghost changed the title [-]Regression caused by #1618: build crashes if NDK is installed system-wide without write permissions[/-] [+]Build crashes if NDK is installed system-wide without write permissions[/+] on Jan 28, 2019
  2. AndreMiras commented on Jan 29, 2019

    @AndreMiras
    Member

    What about symlinking to the dumb recipe build folder? I mean just like if we were compiling a lib, at the end we just Recipe.get_recipe() and use it in our link -Ldir right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions