acorn-optimizer error with -O2 or higher

10 views
Skip to first unread message

Gregory Propf

unread,
Nov 28, 2022, 1:31:56 PM11/28/22
to emscripte...@googlegroups.com
Anyone know what this is about? I'm trying out various optimization options and discovered that if I use -O1 or -O0 the code compiles but -O2, -O3, -Os gives this error. It doesn't seem like DEMANGLE_SUPPORT is the issue since taking that out doesn't change anything. This is using 3.1.24 on Linux. It looks like 3.1.26 is out. Would upgrading help?


DEMANGLE_SUPPORT=1 emcc speedtest.cpp -o speedtest.o -c -O2 -std=c++17 -D USETF=1
DEMANGLE_SUPPORT=1 emcc ClarityNode.cpp -o ClarityNode.o -c -O2 -std=c++17 -D USETF=1
DEMANGLE_SUPPORT=1 emcc Selectables.cpp -o Selectables.o -c -O2 -std=c++17 -D USETF=1
DEMANGLE_SUPPORT=1 emcc clarity.cpp -o clarity.o -c -O2 -std=c++17 -D USETF=1
emcc -lembind --pre-js js.d/speedtest.js speedtest.o ClarityNode.o Selectables.o clarity.o -O2 -std=c++17 -o clarity_embind.js
/home/greg/repos/clarity/emsdk/upstream/emscripten/tools/acorn-optimizer.js:1863
  throw err;
  ^

SyntaxError: Unexpected token (61:22)
    staticSpeedtester = null;
                      ^

    at Parser.pp$4.raise (/home/greg/repos/clarity/emsdk/upstream/emscripten/node_modules/acorn/dist/acorn.js:3462:15)
    at Parser.pp$9.unexpected (/home/greg/repos/clarity/emsdk/upstream/emscripten/node_modules/acorn/dist/acorn.js:756:10)
    at Parser.pp$9.expect (/home/greg/repos/clarity/emsdk/upstream/emscripten/node_modules/acorn/dist/acorn.js:750:28)
    at Parser.pp$5.parseMethod (/home/greg/repos/clarity/emsdk/upstream/emscripten/node_modules/acorn/dist/acorn.js:3224:10)
    at Parser.pp$8.parseClassMethod (/home/greg/repos/clarity/emsdk/upstream/emscripten/node_modules/acorn/dist/acorn.js:1511:37)
    at Parser.pp$8.parseClassElement (/home/greg/repos/clarity/emsdk/upstream/emscripten/node_modules/acorn/dist/acorn.js:1469:12)
    at Parser.pp$8.parseClass (/home/greg/repos/clarity/emsdk/upstream/emscripten/node_modules/acorn/dist/acorn.js:1387:26)
    at Parser.pp$8.parseStatement (/home/greg/repos/clarity/emsdk/upstream/emscripten/node_modules/acorn/dist/acorn.js:902:19)
    at Parser.pp$8.parseTopLevel (/home/greg/repos/clarity/emsdk/upstream/emscripten/node_modules/acorn/dist/acorn.js:813:23)
    at Parser.parse (/home/greg/repos/clarity/emsdk/upstream/emscripten/node_modules/acorn/dist/acorn.js:585:17) {
  pos: 1941,
  loc: Position { line: 61, column: 22 },
  raisedAt: 1942
}
emcc: error: '/home/greg/repos/clarity/emsdk/node/14.18.2_64bit/bin/node /home/greg/repos/clarity/emsdk/upstream/emscripten/tools/acorn-optimizer.js /tmp/emscripten_temp_i786_vs2/clarity_embind.js.pp.js JSDCE minifyWhitespace -o /tmp/emscripten_temp_i786_vs2/clarity_embind.js.pp.jso1.js' failed (returned 1)
make: *** [Makefile:27: speedtest-prod] Error 1

Alon Zakai

unread,
Nov 28, 2022, 4:35:36 PM11/28/22
to emscripte...@googlegroups.com
Hmm, this doesn't sound like a known issue. You can build with EMCC_DEBUG=2 in the env, and then the temp JS files will be saved in /tmp/emscripten_temp. Reading the last JS one around the line it has the syntax error on might give a clue.

--
You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-disc...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/CAKdUWHOskXRExLeutqdyxBZ3OffSzVAjLWaL2p%2BYa%2BETOfTnLA%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages