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

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

Closed
ghost opened this issue Jan 28, 2019 · 2 comments · Fixed by #1623
Closed

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

ghost opened this issue Jan 28, 2019 · 2 comments · Fixed by #1623

Comments

@ghost
Copy link

ghost commented Jan 28, 2019

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

@ghost 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 Jan 28, 2019
@ghost
Copy link
Author

ghost commented Jan 28, 2019

Hmmmmm, shouldn't it be possible to set LD_LIBRARY_PATH to some separate place, and just add this symlink in a completely different folder? Or can anyone think of a reason why that wouldn't possibly work

@AndreMiras
Copy link
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
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant