Skip to content

--emit=exe finds gc.lib and the runtime beside tslang when no path is given - #1107

Merged
ASDAlexander77 merged 1 commit into
mainfrom
exe-libs-beside-compiler
Dec 2, 2026
Merged

ASDAlexander77 merged 1 commit into
mainfrom
exe-libs-beside-compiler

Conversation

@ASDAlexander77

Copy link
Copy Markdown
Owner

Running tslang --emit=exe x.ts from any folder other than the release package's own failed:

lld-link: error: could not open 'gc.lib': no such file or directory
lld-link: error: could not open 'TypeScriptAsyncRuntime.lib': no such file or directory

The link added a library folder only for --gc-lib-path/GC_LIB_PATH and --tslang-lib-path/TSLANG_LIB_PATH. With neither set, lld-link searched only the current folder.

getGCLibPath, getTslangLibPath and the static path getGCSharedLibPath derives gcdll from now fall back to tslang's own folder, or its ../lib on Linux. The fallback is used only when the target's library is actually there, so a cross-compile still finds none, as before. The default library and the JIT's runtime lookup already used tslang's own folder.

Checked on Windows: a program linked from I:\Playground, with the release package's libraries beside a freshly built tslang and no lib env vars, builds and runs under gc, rc and own. The release tslang fails there with the errors above.

🤖 Generated with Claude Code

…when no path is given

With neither --gc-lib-path/GC_LIB_PATH nor --tslang-lib-path/TSLANG_LIB_PATH, the link named no
library folder, so lld-link found gc.lib and the runtime only when run from tslang's own folder
(the release package): from any other folder every program failed with "could not open 'gc.lib'".
Now the folder tslang is in (or its ../lib, the Linux build) is used when it holds the target's
library, as the default library and the JIT's runtime lookup already do.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ASDAlexander77
ASDAlexander77 merged commit bd3c57d into main Dec 2, 2026
8 checks passed
@ASDAlexander77
ASDAlexander77 deleted the exe-libs-beside-compiler branch December 2, 2026 17:21
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 this pull request may close these issues.

1 participant