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
Owner:
Closed: Aug 2016
Cc:
Components:



Sign in to add a comment
"Unrecognized struct value" error when using Emscripten to compile Julia bitcode
Reported by tshort.r...@gmail.com, 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
file:

http://1drv.ms/1vE5fXs

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
EXPORTED_FUNCTIONS="['_julia_abs;104547']"
WARNING  root: invocation: /usr/bin/emcc -v
/tmp/emscripten_temp/emcc-0-basebc.bc -o out.js -s
EXPORTED_FUNCTIONS=['_julia_abs;104547']  (in
/home/tshort/emjl/usr/lib/julia)
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
-internalize-public-api-list=julia_abs;104547,malloc,free,malloc
-globaldce -pnacl-abi-simplify-preopt -pnacl-abi-simplify-postopt
-enable-emscripten-cxx-exceptions
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/shared.py", 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
Makefile:

-    $(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 jfb@chromium.org, Sep 1 2014
Cc: jfb@chromium.org dschuff@chromium.org
Labels: OS-All Arch-All Component-PNaCl
Owner: mseaborn@chromium.org
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:

https://www.reddit.com/r/rust_gamedev/comments/2n0x08/emscripten_experiments/cmcakwr

https://github.com/epdtry/rust-emscripten-passes

https://github.com/epdtry/emscripten-fastcomp

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

Project Member Comment 3 by jfb@chromium.org, Dec 21 2014
Cc: tshort.r...@gmail.com
Very helpful. Mark has been helping Richard Diamond patch our LLVM codebase to handle Rust properly:
  https://codereview.chromium.org/user/Richard%20Diamond
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 ibdk...@gmail.com, Jan 10 2015
This is still happening in the 3.5 merge of emscripten when trying to compile rust code. My results are here: https://github.com/rust-lang/rust/issues/2235#issuecomment-69471693
Project Member Comment 5 by jfb@chromium.org, Feb 18 2015
Cc: mseaborn@chromium.org
Owner: mtrofin@chromium.org
mtrofin will look into this.
Project Member Comment 6 by mseaborn@chromium.org, 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 http://cyrille.rossant.net/numpy-browser-llvm/
Project Member Comment 8 by jfb@chromium.org, Aug 11 2016
Status: WontFix
Sign in to add a comment