-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
wasm-ld: error: failed to write the output file: permission denied #13067
Comments
This is also happening to me right now. Windows 7, full permissions, cmd as admin, no write only attribs C:\wasm-emscripten\emsdk\upstream\emscripten>emcc tests/hello_world.c -v clang -cc1 version 12.0.0 based upon LLVM 12.0.0git default target x86_64-pc-win C:/wasm-emscripten/emsdk/upstream/bin\llvm-ar.exe: error: C:\Users\urza\AppData |
jinkoo2, move \emsdk\ to c:, remove all read only attributes, that is how I stopped your error and got my error |
Thanks for the quick reply, geogiam-net! |
you are right, thx, now it can do it |
same environment. |
Thanks guys, this thread helped over here, first I tried latest (2.0.11 atm) and I'd get that permission error (win7 and unpacked on d:\software\emscripten). Then I just reverted to 2.0.0 as suggested and I was able to compile the hello world from the official tutorial. |
Can confirm: same issue for me (newest emscripten on Windows 7). Rolling back to emscripten 2.0.0 fixes the problem. |
For me 2.0.8 is the latest version that does not have this problem. |
If anyone can figure out what is going on here we would love to see a fix for this. |
Probably if some emscripten contributor would make a git-bisect this one would be fixed in no time :) |
There are docs for bisection here: https://emscripten.org/docs/contributing/developers_guide.html#bisecting Yes, for those that can reproduce this issue, bisection may be the fastest way to find out where this broke, as @brupelo said. I don't have a windows machine but let me know if there are any questions on those docs. |
I have no setup currently that could build and install emscripten from specific commits, but I have "bisected" emsdk-downloadable releases:
|
Still getting this issue. Any word on an official fix for this? |
Unfortunately this issue seems very specific to the virtual environment and the windows filesystem its hard to reproduce or diagnose without that specific setup. I think we are reliant those of folks who are experiencing this to dig into it and get to the bottom on if. One thing I'm curious about is whether this is actaully a generic llvm / lld issue. The code for writing output files is not specific to wasm-ld so it seems likely. If that is true we should file an upstream issue in the llvm bug tracker. |
I appreciate the quick reply and understand the issue now. Reverting to a previous version seems to have fixed this momentarily. Thanks. |
I ran into this issue today on Windows 7 trying to compile the Here are the tutorial steps I followed: https://emscripten.org/docs/getting_started/downloads.html https://emscripten.org/docs/getting_started/Tutorial.html Here's a log:
|
Can the compiler write output files to that directory? i.e. can you run |
I wonder if the regular lld linker can write output files here? Do you have a vanilla clang/lld installation you should try? Also, are you using virtual environment? We had some other bugs where folks were using virtual machines and getting unexpected failures that might have looked like this. |
@sbc100 The command you suggested runs without errors. I'm not using a VM, but a normal Win7 installation. I can think of no reason why the permissions to this directory should be restricted.
Clang compiles
|
I have this issue without using any virtual machine. |
Interesting. Can you run that clang command again with |
Looking at the wasm-ld code it seems that file is opened successfully here: But then the commit to disc fails here: Looking at the COFF linker (the one that normal clang/lld is using) the code looks roughly the same: .. so i wonder why one works here and the other doesn't (assuming windows COFF lld is actually used and working above). |
@sbc100 Here you go: I tried
|
More futzing about: I'm running this CLI as an administrator.
|
I can confirm that the tutorial works with version 2.0.8 on my Windows 7 installation:
|
The difference with 2.0.8 I believe is that we used to link to temp directory and then copy the resulting wasm file into place. With newer versions of emscripten we have wasm-ld link directly to the final location which I believe is what is causing this issue. Reverting to linking a temp directory and copying doesn't seem a like a very satisfying solution. I think it would be good to find out what is really going on here. |
@sbc100 I really don't know enough about emscripten or LLVM generally to debug this myself, but please feel free to give me a @mention if you have tests or troubleshooting steps you'd like me to try on my Win7 machine. |
Same issue with 2.0.13 and 2.0.10. |
What is the common theme here? Is this limited to windows 7? |
Will be interesting to see if this is fixed by https://reviews.llvm.org/D81803 |
On the contrary @sbc100 that seems to be the change that broke it. From the most recent comment on the thread:
|
Oh interesting! Anyway it looks like we found culprit and indeed it seems not to be emscripten-specific but a general llvm issue. |
Hello! I've fixed the issue in llvm/llvm-project@64ab2b6 - please let me know if the issue is still there in the next code drop. |
I install the latest version (2.0.30) and it also such error. I try to install the 2.0.0 version then it worked. amboo@ubuntu:/mnt/hgfs/workdir/wasm$ emcc hello_world.c |
Yes, there seems to be a bug with the way that llvm (wasm-ld) creates it output files. It seem to trigger and i/o error in certain circumstances that seem to be where the output file lives on a mounted of a windows filesystem in a virtual environment? @amboowang can you confirm some things about your environment? Are you using a linux VM inside of windows? What virtualization system are you using? If |
The reason this started happening between 2.0.0 and 2.0.30 is explained #13067 (comment) |
Installed following the getting started guide on Windows 7. The installation went fine with no error and the installation check was okay without any error. But, I get the permission error when I try to test on the hello_world.c sample (emcc hello_world.c). I have full-permission on the machine and the disk has enough free space.
C:\Users\jkim20\Desktop\projects\express\deleteme\emscripten\mytests>emcc hello_world.c
wasm-ld: error: failed to write the output file: permission denied
emcc: error: 'C:/Users/jkim20/Desktop/projects/express/deleteme/emscripten/emsdk/upstream/bin\wasm-ld.exe -o a.out.wasm C:\Users\jkim20\AppData\Local\Temp\emscripten_temp_b9hqya07\hello_world_0.o -LC:\Users\jkim20\Desktop\projects\express\deleteme\emscripten\emsdk\upstream\emscripten\system\local\lib -LC:\Users\jkim20\Desktop\projects\express\deleteme\emscripten\emsdk\upstream\emscripten\system\lib -LC:\Users\jkim20\Desktop\projects\express\deleteme\emscripten\emsdk\upstream\emscripten\cache\wasm C:\Users\jkim20\Desktop\projects\express\deleteme\emscripten\emsdk\upstream\emscripten\cache\wasm\libc.a C:\Users\jkim20\Desktop\projects\express\deleteme\emscripten\emsdk\upstream\emscripten\cache\wasm\libcompiler_rt.a C:\Users\jkim20\Desktop\projects\express\deleteme\emscripten\emsdk\upstream\emscripten\cache\wasm\libc++-noexcept.a C:\Users\jkim20\Desktop\projects\express\deleteme\emscripten\emsdk\upstream\emscripten\cache\wasm\libc++abi-noexcept.a C:\Users\jkim20\Desktop\projects\express\deleteme\emscripten\emsdk\upstream\emscripten\cache\wasm\libdlmalloc.a C:\Users\jkim20\Desktop\projects\express\deleteme\emscripten\emsdk\upstream\emscripten\cache\wasm\libc_rt_wasm.a C:\Users\jkim20\Desktop\projects\express\deleteme\emscripten\emsdk\upstream\emscripten\cache\wasm\libsockets.a -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr --allow-undefined --strip-debug --export-table --export main --export emscripten_stack_get_end --export emscripten_stack_get_free --export emscripten_stack_init --export stackSave --export stackRestore --export stackAlloc --export __wasm_call_ctors --export fflush --export __errno_location -z stack-size=5242880 --initial-memory=16777216 --no-entry --max-memory=16777216 --global-base=1024' failed (1)
The text was updated successfully, but these errors were encountered: