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

Hash sign in multiline string causes "Unknown preprocessor directive" error #19002

Closed
bbrk24 opened this issue Mar 19, 2023 · 2 comments · Fixed by #19006
Closed

Hash sign in multiline string causes "Unknown preprocessor directive" error #19002

bbrk24 opened this issue Mar 19, 2023 · 2 comments · Fixed by #19006

Comments

@bbrk24
Copy link

bbrk24 commented Mar 19, 2023

Please include the following in your bug report:

Version of emscripten/emsdk:

emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.32 (eab98adf462c39f3c31d348331c4830bcaa36949)
clang version 17.0.0 (https://github.com/llvm/llvm-project df82394e7a2d06506718cafa347bf7827c79fc4f)
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir: C:\[...]\emsdk\upstream\bin

Failing command line in full:

emcc ./*.cpp --post-js post.js 

Where post.js is:

const foo = `
#bar`;

Note that this does not happen if the hash sign is not the first (non-whitespace) character on the line. So, this would not trigger the error:

const foo = '\n#bar';

Full link command and output with -v appended:
Full output is over 26kB, so I can't attach it here. The wasm file is successfully generated, however. Without -v, the output is (with some paths redacted):

Internal compiler error in src/compiler.js!
Please create a bug report at https://github.com/emscripten-core/emscripten/issues/
with a log of the build and the input files used to run. Exception message: "Error: C:\[...]\[...]\post.js:2: Unknown preprocessor directive #bar`;
    at preprocess (C:\[...]\emsdk\upstream\emscripten\src\parseTools.js:137:17)
    at includeFile (C:\[...]\emsdk\upstream\emscripten\src\jsifier.js:456:25)
    at finalCombiner (C:\[...]\emsdk\upstream\emscripten\src\jsifier.js:528:7)
    at runJSify (C:\[...]\emsdk\upstream\emscripten\src\jsifier.js:552:3)
    at Object.<anonymous> (C:\[...]\emsdk\upstream\emscripten\src\compiler.js:97:3)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Module.load (internal/modules/cjs/loader.js:950:32)
    at Function.Module._load (internal/modules/cjs/loader.js:790:12)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
emcc: error: 'C:/[...]/emsdk/node/14.18.2_64bit/bin/node.exe C:\[...]\emsdk\upstream\emscripten\src\compiler.js 
C:\[...]\AppData\Local\Temp\tmppyhfuv98.json' failed (returned 1)
@sbc100
Copy link
Collaborator

sbc100 commented Mar 19, 2023

I believe this is a duplicate of #18609.

@bbrk24
Copy link
Author

bbrk24 commented Mar 19, 2023

It does seem to be the same general issue, but they could be considered distinct: that one found it in a block comment, while I encountered it in a multiline string.

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 a pull request may close this issue.

2 participants