emscripten-core / emscripten-core/emscripten

Clean after linking: file is being used by another process

Open
#18,150 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

Please include the following in your bug report:

**Version of emscripten/emsdk:**
3.1.24

**Failing command line in full:**
Everything worked in at least 3.1.16
Everything works in 'debug' build:
```
set(COMMON_DEBUG_CXX
-O0
)
set(COMMON_DEBUG_LNK
-O0
-sASSERTIONS=1
-sDEMANGLE_SUPPORT
-sRUNTIME_LOGGING
-sINITIAL_MEMORY=512MB
-sMAXIMUM_MEMORY=4096MB
)
set(DEBUG_CXX ${COMMON_DEBUG_CXX}
-g2
-fsanitize=undefined
)
set(DEBUG_LNK ${COMMON_DEBUG_LNK}
-g2
-fsanitize=undefined
)
(also works):
set(DEBUGDWARF_CXX ${COMMON_DEBUG_CXX}
-g3
)
set(DEBUGDWARF_LNK ${COMMON_DEBUG_LNK}
-g3
)
```

This crash happens in 'release' build:
```
set(COMMON_RELEASE_CXX
-Oz
-g0
-fno-exceptions
-flto
-DNDEBUG
)
set(COMMON_RELEASE_LNK
-Oz
-g0
-fno-exceptions
-flto
-sINLINING_LIMIT=1
-sELIMINATE_DUPLICATE_FUNCTIONS=1
-sNO_ASSERTIONS
-sNO_DEMANGLE_SUPPORT
-sDISABLE_EXCEPTION_CATCHING
-sDISABLE_EXCEPTION_THROWING
)
set(RELEASE_CXX ${COMMON_RELEASE_CXX})
set(RELEASE_LNK ${COMMON_RELEASE_LNK}
-sINITIAL_MEMORY=128MB
-sMAXIMUM_MEMORY=1024MB
)
```

**Full link command and output with `-v` appended:**
```
profiler:INFO: block "calculate system libraries" took 6.011 seconds
profiler:INFO: start block "link"
profiler:INFO: block "link" took 50.427 seconds
profiler:INFO: start block "post_link"
profiler:INFO: start block "emscript"
profiler:INFO: start block "get_metadata"
profiler:INFO: block "get_metadata" took 1.031 seconds
profiler:INFO: start block "check_node"
profiler:INFO: block "check_node" took 0.092 seconds
profiler:INFO: block "emscript" took 1.486 seconds
profiler:INFO: start block "source transforms"
profiler:INFO: block "source transforms" took 0.000 seconds
profiler:INFO: start block "binaryen"
profiler:INFO: block "binaryen" took 16.823 seconds
profiler:INFO: start block "final emitting"
profiler:INFO: block "final emitting" took 0.049 seconds
profiler:INFO: block "post_link" took 18.361 seconds
Traceback (most recent call last):
File "F:\Apps\W4Trial\emsdk\upstream\emscripten\tools\tempfiles.py", line 58, in clean
utils.delete_file(filename)
File "F:\Apps\W4Trial\emsdk\upstream\emscripten\tools\utils.py", line 103, in delete_file
os.remove(filename)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\caxap\\AppData\\Local\\Temp\\emcc_acorn_info_zaxpu9cg.js'
```

The problem happens on every try. The problem happens on different projects.

Tell me if it is needed to do a binary search of the compilation flags and emscripten version where does the issue firstly exist if it isn't clear whats the root of the problem right now

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.