Monorail Project: nativeclient Issues People Development process History Sign in
New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.
Starred by 3 users
Status: WontFix
Closed: Aug 2016

Sign in to add a comment
"Unrecognized struct value" error when using Emscripten to compile Julia bitcode
Reported by, Sep 1 2014 Back to list
This occurs when running Emscripten fastcomp on Julia-generated bitcode. 

For this "Unrecognized struct value" error, I wasn't able to find a
reduced case, so I'm including a link to a large emcc-0-basebc.bc

It's too big to attach to the issue.

Here is the error I get with Emscripten:

[tshort@bridgelinux julia]$ emcc -v
/tmp/emscripten_temp/emcc-0-basebc.bc  -o out.js -s
WARNING  root: invocation: /usr/bin/emcc -v
/tmp/emscripten_temp/emcc-0-basebc.bc -o out.js -s
EXPORTED_FUNCTIONS=['_julia_abs;104547']  (in
INFO     root: (Emscripten: Running sanity checks)
INFO     root: (Emscripten: Running sanity checks)
DEBUG    root: compiling to bitcode
DEBUG    root: emcc step "parse arguments and setup" took 0.11 seconds
DEBUG    root: using bitcode file: /tmp/emscripten_temp/emcc-0-basebc.bc
DEBUG    root: emcc step "bitcodeize inputs" took 0.00 seconds
DEBUG    root: emcc step "process inputs" took 0.00 seconds
DEBUG    root: will generate JavaScript
DEBUG    root: emcc step "calculate system libraries" took 2.69 seconds
DEBUG    root: emcc step "link" took 0.04 seconds
DEBUG    root: saving intermediate processing steps to /tmp/emscripten_temp
DEBUG    root: emcc: LLVM opts: -strip-debug -internalize
-globaldce -pnacl-abi-simplify-preopt -pnacl-abi-simplify-postopt
Value:   %27 = call { i64, i1 } @llvm.ssub.with.overflow.i64(i64 %26, i64 1)
LLVM ERROR: Unrecognized struct value
INFO     root: emcc saved files are in:/home/tshort/emjl/usr/lib/julia/mtmp
Traceback (most recent call last):
  File "/usr/bin/emcc", line 1200, in <module>
    shared.Building.llvm_opt(final, link_opts)
  File "/usr/lib/emscripten/tools/", line 1358, in llvm_opt
    assert os.path.exists(target), 'Failed to run llvm optimizations: ' + output
AssertionError: Failed to run llvm optimizations:

This started with a sys.bc generated by Julia. To create this, I took
a recent Julia with the following changes made to the main Julia

-    $(call spawn,$(JULIA_EXECUTABLE)) --build $(call
cygpath_w,$(build_private_libdir)/sys) \
+    $(call spawn,$(JULIA_EXECUTABLE)) --build $(call
cygpath_w,$(build_private_libdir)/sys) --dump-bitcode=yes
--compile=all \

Project Member Comment 1 by, Sep 1 2014
Labels: OS-All Arch-All Component-PNaCl
Status: Assigned
Mark, could you take a look at assign appropriately? This is based on a slightly older version of our code base so it may be something that got fixed recently.
Someone using Rust with Emscripten ran into struct issues that they worked around. Here are some links:

They changed an PNaCl pass and added a new LLVM pass. Are these related / helpful?

Project Member Comment 3 by, Dec 21 2014
Very helpful. Mark has been helping Richard Diamond patch our LLVM codebase to handle Rust properly:
Once the lastest patch is in I'd like to see if Rust "just works", if not I'll take a look at whether these patches would help fix the remaining issues.

I've also been talk to Alon on rebasing Emscripten on top of our 3.5 version of LLVM. He just moved to 3.4, so when the dust settles we'll rebase again, and I'd like both codebases to stay close to each other.
Comment 4 by, Jan 10 2015
This is still happening in the 3.5 merge of emscripten when trying to compile rust code. My results are here:
Project Member Comment 5 by, Feb 18 2015
mtrofin will look into this.
Project Member Comment 6 by, Feb 18 2015
Labels: LLVMIRSimplifications
I encountered this bug by trying to compile Numba-generated LLVM to JS via emscripten. I had some limited success thanks to a patch made by someone else for rust -- see more details at
Project Member Comment 8 by, Aug 11 2016
Status: WontFix
Sign in to add a comment