Skip to content

PermissionError: [Errno 13] Permission denied: '/usr/lib/emscripten/cache.lock' #11313

Closed

Description

@jendrikw

Hi, I just installed emscripten 1.39.16 via the Arch Linux package.

When I run emcc --version I get this onm the first run:

==============================================================================
Welcome to Emscripten!

This is the first time any of the Emscripten tools has been run.

A settings file has been copied to ~/.emscripten, at absolute path: /home/jendrik/.emscripten

It contains our best guesses for the important paths, which are:

  LLVM_ROOT       = /usr/bin
  NODE_JS         = /usr/bin/node
  EMSCRIPTEN_ROOT = /usr/lib/emscripten

Please edit the file if any of those are incorrect.

This command will now exit. When you are done editing those paths, re-run it.
==============================================================================

When I run it again, I get an error:

Traceback (most recent call last):
  File "/usr/lib/emscripten/emcc.py", line 42, in <module>
    import emscripten
  File "/usr/lib/emscripten/emscripten.py", line 25, in <module>
    from tools import shared
  File "/usr/lib/emscripten/tools/shared.py", line 3501, in <module>
    check_vanilla()
  File "/usr/lib/emscripten/tools/shared.py", line 660, in check_vanilla
    is_vanilla_file = temp_cache.get('is_vanilla.txt', get_vanilla_file)
  File "/usr/lib/emscripten/tools/cache.py", line 110, in get
    self.acquire_cache_lock()
  File "/usr/lib/emscripten/tools/cache.py", line 60, in acquire_cache_lock
    self.filelock.acquire(60)
  File "/usr/lib/emscripten/tools/filelock.py", line 240, in acquire
    self._acquire()
  File "/usr/lib/emscripten/tools/filelock.py", line 360, in _acquire
    fd = os.open(self._lock_file, open_mode)
PermissionError: [Errno 13] Permission denied: '/usr/lib/emscripten/cache.lock'

Why is it trying to write in /usr/lib/emscripten?

Activity

  1. louisabraham commented on Jun 2, 2020

    @louisabraham

    Haha, I just came to post the same issue (on manjaro). I ended up doing a chown on the directory but it is not ideal.

  2. kripken commented on Jun 2, 2020

    @kripken
    Member

    I think this may be related to @sbc100 's recent changes to make emscripten use a different place for the cache, rather than the user's home directory. But I'm not sure since /usr/lib/emscripten/ is the path here. As this is on arch, however, perhaps that's where it puts things, and that has the wrong permissions? (so possibly a change is needed on arch, but maybe we can work around that on emscripten to undo the recent change partially)

  3. sbc100 commented on Jun 2, 2020

    @sbc100
    Collaborator

    This should be fixed in top of tree.

    See #11301

  4. jendrikw commented on Jun 3, 2020

    @jendrikw
    Author

    @sbc100 Thanks. When is a release planned?

  5. sbc100 commented on Jun 3, 2020

    @sbc100
    Collaborator

    Today I hope.

    Is using 1.39.15 not an option for you? Is that even possible with arch linux?

    You can also set EM_CONFIG=$HOME/.emscripten to solve this issue.

  6. jendrikw commented on Jun 4, 2020

    @jendrikw
    Author

    You can downgrade packages, but it's severely discouraged because of dependencies which may also be downgraded. It has basically the same issues as mixing repositories in Debian. See also https://wiki.archlinux.org/index.php/Downgrading_packages.

  7. sbc100 commented on Jun 4, 2020

    @sbc100
    Collaborator

    How does the upgrade process work? Its seems like this package must have been releases with basically zero testing.

    Does the EM_CONFIG=$HOME/.emscripten solution for you for now?

  8. sbc100 commented on Jun 4, 2020

    @sbc100
    Collaborator

    @svenstaro is there some way to could run some basic tests before releasing new versions of the arch linux package?

  9. svenstaro commented on Jun 5, 2020

    @svenstaro
    Contributor

    Sadly, due to limitations in our packaging infrastructure, we can't automatically run tests of the to-be-installed package after its packaging and with user permissions. We can only run basic software suite tests such as make test. I couldn't get your python tests/runner.py to run as it depends on the software being installed prior to running.

    I do usually run emcc -v manually but I usually don't unset my EM_CONFIG so I don't think I would have noticed.

    Since you want to deprecate the implicit $HOME-based cache/config dir, I have to wonder: How do you want downstream packagers to set a user-writable default dir for the config and cache?

    That said, a release soon would be appreciated as the patch of the MR doesn't apply cleanly.

  10. sbc100 commented on Jun 5, 2020

    @sbc100
    Collaborator

    Great question! I've tried to document some of this in the new docs/packaging.md.

    I think it would be great if downstream distos would ship an embedded .emscripten within the installation directory. That way you can point to the correct versions of llvm, binaryen, and node for your disto. This is how emsdk already works and I think it would be great if all packaged version of emscripten worked like this.

    You could also set "CACHE = ~/.emscripten" in that file.. or you could let the new code that detects the read-only installation fall back to this.

    the added benefit of this is that you won't see that first use message when emcc if first run asking you to configure it. It should "just work" on first use.

  11. sbc100 commented on Jun 5, 2020

    @sbc100
    Collaborator

    Regarding testing.. ah I see.. makes sense. This issue would only show up in some kind of true post-installation testing.

  12. svenstaro commented on Jun 5, 2020

    @svenstaro
    Contributor

    I'll try that. Related: Can we now finally use system LLVM without compiling a custom version for Emscripten? I'd much prefer that as we'd get fewer duplications that way, a smaller package and less complexity all around.

  13. sbc100 commented on Jun 5, 2020

    @sbc100
    Collaborator

    Eventually it would be nice to use the system version of LLVM yes. Perhaps starting with LLVM 11 we could support the current LLVM stable as well as ToT (with certainly features only available with ToT).

    As of today we do unfortunately depend on LLVM ToT so you can't depend on the system LLVM (unless you can get a ToT packages of LLVM?)

  14. sbc100 commented on Jun 9, 2020

    @sbc100
    Collaborator

    Awesome! Thanks @svenstaro .. this is great.

  15. reopened this on Jun 9, 2020
  16. sbc100 commented on Jun 9, 2020

    @sbc100
    Collaborator

    @svenstaro, my advise would be to remove all the comments and unused sections from the config file, since its not designed to be modified by the user directly.

    I imagine you will also need to set BINARYEN to something non-empty. And I think you can remove the os.getenv stuff since emscripten implicitly supports EM_XXXX environment variables for overriding all config variables already.

    A good example would be the config files that are written by emsdk:

    NODE_JS = emsdk_path + '/node/12.9.1_64bit/bin/node'
    LLVM_ROOT = emsdk_path + '/upstream/bin'
    BINARYEN_ROOT = emsdk_path + '/upstream'
    EMSCRIPTEN_ROOT = emsdk_path + '/upstream/emscripten'
    
  17. sbc100 commented on Jun 15, 2020

    @sbc100
    Collaborator

    Looks great! I think you can drop the JAVA line as it will look for java by default.

  18. svenstaro commented on Jun 16, 2020

    @svenstaro
    Contributor

    Alright, thanks. I made the change. Then, can we close this?

  19. sbc100 commented on Jun 16, 2020

    @sbc100
    Collaborator

    Sounds good to me.

  20. midzer commented on Oct 18, 2022

    @midzer
    Contributor

    Using emscripten v3.1.6 via debian package, I also get an PermissionError after calling emcc to build on of my old projects:

    Traceback (most recent call last):
      File "/usr/share/emscripten/emcc.py", line 3947, in <module>
        sys.exit(main(sys.argv))
      File "/usr/lib/python3.10/contextlib.py", line 79, in inner
        return func(*args, **kwds)
      File "/usr/share/emscripten/emcc.py", line 3940, in main
        ret = run(args)
      File "/usr/share/emscripten/emcc.py", line 1151, in run
        linker_inputs = phase_compile_inputs(options, state, newargs, input_files)
      File "/usr/lib/python3.10/contextlib.py", line 79, in inner
        return func(*args, **kwds)
      File "/usr/share/emscripten/emcc.py", line 2677, in phase_compile_inputs
        compile_source_file(i, input_file)
      File "/usr/share/emscripten/emcc.py", line 2657, in compile_source_file
        cmd = get_clang_command(input_file)
      File "/usr/share/emscripten/emcc.py", line 2598, in get_clang_command
        return get_compiler(src_file) + get_cflags(state.orig_args) + compile_args + [src_file]
      File "/usr/share/emscripten/emcc.py", line 903, in get_cflags
        ports.add_cflags(cflags, settings)
      File "/usr/share/emscripten/tools/ports/__init__.py", line 364, in add_cflags
        port.get(Ports, settings, shared)
      File "/usr/share/emscripten/tools/ports/sdl2.py", line 23, in get
        ports.fetch_project('sdl2', 'https://github.com/libsdl-org/SDL/archive/' + TAG + '.zip', SUBDIR, sha512hash=HASH)
      File "/usr/share/emscripten/tools/ports/__init__.py", line 159, in fetch_project
        fullname = os.path.join(Ports.get_dir(), name)
      File "/usr/share/emscripten/tools/ports/__init__.py", line 140, in get_dir
        shared.safe_ensure_dirs(dirname)
      File "/usr/share/emscripten/tools/utils.py", line 28, in safe_ensure_dirs
        os.makedirs(dirname, exist_ok=True)
      File "/usr/lib/python3.10/os.py", line 225, in makedirs
        mkdir(name, mode)
    PermissionError: [Errno 13] Permission denied: '/usr/share/emscripten/cache/ports'
    

    edit: actually EM_CONFIG=$HOME/.emscripten as posted before worked for me. And I had to upgrade LLVM_ADD_VERSION and CLANG_ADD_VERSION in .emscripten file.

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