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

emcc.bat: command line is too long #4438

Closed
yglukhov opened this issue Jul 14, 2016 · 5 comments
Closed

emcc.bat: command line is too long #4438

yglukhov opened this issue Jul 14, 2016 · 5 comments

Comments

@yglukhov
Copy link

Since emcc.bat uses cmd.exe, there is a limit for command line length of 8191 characters. More info. This issue makes it a pain to do a drop-in replacement of gcc with emcc in build systems. Some simple emcc.exe that does exactly what emcc.bat currently does should fix the issue.

@kripken
Copy link
Member

kripken commented Jul 14, 2016

What version is this on? I think we've had improvements since the last stable release.

@Tormund
Copy link

Tormund commented Jul 15, 2016

Same problem on emscripten versions 1.36.0 and 1.35.0
Windows 10 Enterprise

@juj juj added the windows label Jul 18, 2016
@juj
Copy link
Collaborator

juj commented Jul 18, 2016

The linked article reads like the issue is not specific to .bat files, so moving to a .exe file would not likely fix the problem. Perhaps .bat files might have a shorter limit than .exe files, but the issue would still persist.

Emscripten uses the first workaround specified in the article, these files are called response files in Emscripten, and the syntax is same as for e.g. MSBuild. That is, when building

em++ tests/hello_world.cpp -o program.html

one can instead do

echo tests/hello_world.cpp -o program.html > cmdline.rsp
em++ @cmdline.rsp

to pass the parameters to the compiler. Multiple response files may be used, and regular command line arguments can be mixed with response files, so

em++ -o program.html @cmdline1.rsp @cmdline2.rsp

would be valid. The contents of the response files are expanded in place to preserve the order.

Note that backslashes don't go too well in response files. They need to either be escaped or just use forward slashes.

Response files are caller's responsibility, the callee does not delete them when finished. So caller should remember to delete the files after the em++ process has finished, em++ itself does not delete the response files it consumes.

The cmdline length issue is not specific to Emscripten, for example gcc.exe also has the same issue and uses the same response file workaround as Emscripten does, so using an emcc.exe would likely not offer a solution.

Can you try using response files to work around the issue?

@phoenixx2
Copy link

I would like to say that using a response file allowed emcc to link against large table of files. Thanks for that workaround.

@stale
Copy link

stale bot commented Sep 18, 2019

This issue has been automatically marked as stale because there has been no activity in the past year. It will be closed automatically if no further activity occurs in the next 7 days. Feel free to re-open at any time if this issue is still relevant.

@stale stale bot added the wontfix label Sep 18, 2019
@stale stale bot closed this as completed Sep 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants