Skip to content

Cannot compile to asm.js/wasm; Linking error; Input file unknown suffix? #39406

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

Closed
AjBreidenbach opened this issue Jan 30, 2017 · 7 comments
Closed
Labels
O-asmjs Target: asm.js - http://asmjs.org/ O-emscripten Target: 50% off wasm32-unknown-musl. the savings come out of stdio.h, but hey, you get SDL! O-wasm Target: WASM (WebAssembly), http://webassembly.org/

Comments

@AjBreidenbach
Copy link

AjBreidenbach commented Jan 30, 2017

andrew@andrew-HP-Spectre-x360-Convertible:~/Desktop/programming/rust/projects/hello world$ rustc --target=asmjs-unknown-emscripten hello.rs
error: linking with `emcc` failed: exit code: 1
  |
  = note: "emcc" "-L" "/home/andrew/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/asmjs-unknown-emscripten/lib" "hello.0.o" "-o" "hello.js" "-Wl,--gc-sections" "-nodefaultlibs" "-L" "/home/andrew/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/asmjs-unknown-emscripten/lib" "-Wl,-Bstatic" "-Wl,-Bdynamic" "/home/andrew/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/asmjs-unknown-emscripten/lib/libstd-610aec1c0c2edd5b.rlib" "/home/andrew/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/asmjs-unknown-emscripten/lib/libpanic_unwind-f2d5dd75c5a64c5f.rlib" "/home/andrew/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/asmjs-unknown-emscripten/lib/libunwind-cce8009dda26867d.rlib" "/home/andrew/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/asmjs-unknown-emscripten/lib/librand-d2f56491199d3b9f.rlib" "/home/andrew/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/asmjs-unknown-emscripten/lib/libcollections-4f02fd86535a3157.rlib" "/home/andrew/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/asmjs-unknown-emscripten/lib/librustc_unicode-8d6c34ad46f07f91.rlib" "/home/andrew/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/asmjs-unknown-emscripten/lib/liballoc-198f48436646c796.rlib" "/home/andrew/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/asmjs-unknown-emscripten/lib/liballoc_system-22e63f2ceba0e6f8.rlib" "/home/andrew/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/asmjs-unknown-emscripten/lib/liblibc-9b19cb4b417215a8.rlib" "/home/andrew/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/asmjs-unknown-emscripten/lib/libcore-ec0461203eec19c8.rlib" "/home/andrew/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/asmjs-unknown-emscripten/lib/libcompiler_builtins-ad8606f391af463e.rlib" "-l" "c" "-s" "ERROR_ON_UNDEFINED_SYMBOLS=1"
  = note: WARNING  root: LLVM version appears incorrect (seeing "(https://github.com/kripken/emscripten-fastcomp-clang/", expected "3.4")
INFO     root: (Emscripten: Running sanity checks)
ERROR    root: /home/andrew/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/asmjs-unknown-emscripten/lib: Input file has an unknown suffix, don't know what to do with it!


error: aborting due to previous error


So I get the same error I guess trying to target both asmjs and wasm. I guess I don't know if I did something stupid, or if it's a real issue with emscripten...

Here is emcc --v

andrew@andrew-HP-Spectre-x360-Convertible:~/Desktop/programming/rust/projects/hello world$ emcc --version
emcc (Emscripten GCC-like replacement) 1.22.1 ()
Copyright (C) 2014 the Emscripten authors (see AUTHORS.txt)
This is free and open source software under the MIT license.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  
andrew@andrew-HP-Spectre-x360-Convertible:~/Desktop/programming/rust/projects/hello world$ emcc -v
emcc (Emscripten GCC-like replacement + linker emulating GNU ld ) 1.22.1
clang version 3.9.0 (https://github.com/kripken/emscripten-fastcomp-clang/ 7372fbdc769db28fd534454268f4b008e629464f) (https://github.com/kripken/emscripten-fastcomp/ bf977937f361ed99dcb790805415bd0921ae8591) (emscripten 1.37.1 : 1.37.1)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/andrew/Desktop/programming/rust/emsdk_portable/clang/fastcomp/build_incoming_64/bin
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5.4.0
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/6.0.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.4.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.0.0
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.4.0
Candidate multilib: .;@m64
Selected multilib: .;@m64
WARNING  root: LLVM version appears incorrect (seeing "(https://github.com/kripken/emscripten-fastcomp-clang/", expected "3.4")
INFO     root: (Emscripten: Running sanity checks)

@est31
Copy link
Member

est31 commented Jan 30, 2017

Seems like #39355 is related? cc @brson

@brson
Copy link
Contributor

brson commented Feb 1, 2017

I don't see anything obviously wrong with any of the suffixes being passed to emcc. I might guess that emcc has added new validation that doesn't anticipate being passed 'rlib's.

@brson brson added O-asmjs Target: asm.js - http://asmjs.org/ O-wasm Target: WASM (WebAssembly), http://webassembly.org/ labels Feb 1, 2017
@bakape
Copy link

bakape commented Feb 4, 2017

Can confirm this behaviour with the same version of emcc. Fixed it by upgrading the latest release.

@AjBreidenbach
Copy link
Author

I'm getting the same issue under the new version as well

andrew@andrew-HP-Spectre-x360-Convertible:~/Desktop/programming/rust/projects/hello world$ rustc --target=wasm32-unknown-emscripten hello.rs -o hello.html
error: linking with `emcc` failed: exit code: 1
  |
  = note: "emcc" "-L" "/home/andrew/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-emscripten/lib" "hello.0.o" "-o" "hello.html" "-Wl,--gc-sections" "-nodefaultlibs" "-L" "/home/andrew/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-emscripten/lib" "-Wl,-Bstatic" "-Wl,-Bdynamic" "/home/andrew/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-emscripten/lib/libstd-610aec1c0c2edd5b.rlib" "/home/andrew/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-emscripten/lib/libpanic_unwind-f2d5dd75c5a64c5f.rlib" "/home/andrew/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-emscripten/lib/libunwind-cce8009dda26867d.rlib" "/home/andrew/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-emscripten/lib/librand-d2f56491199d3b9f.rlib" "/home/andrew/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-emscripten/lib/libcollections-4f02fd86535a3157.rlib" "/home/andrew/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-emscripten/lib/librustc_unicode-8d6c34ad46f07f91.rlib" "/home/andrew/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-emscripten/lib/liballoc-198f48436646c796.rlib" "/home/andrew/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-emscripten/lib/liballoc_system-22e63f2ceba0e6f8.rlib" "/home/andrew/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-emscripten/lib/liblibc-9b19cb4b417215a8.rlib" "/home/andrew/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-emscripten/lib/libcore-ec0461203eec19c8.rlib" "/home/andrew/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-emscripten/lib/libcompiler_builtins-ad8606f391af463e.rlib" "-l" "c" "-s" "BINARYEN=1" "-s" "ERROR_ON_UNDEFINED_SYMBOLS=1"
  = note: WARNING  root: LLVM version appears incorrect (seeing "(https://github.com/kripken/emscripten-fastcomp-clang/", expected "3.4")
INFO     root: (Emscripten: Running sanity checks)
ERROR    root: /home/andrew/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-emscripten/lib: Input file has an unknown suffix, don't know what to do with it!

error: aborting due to previous error

emcc -v

andrew@andrew-HP-Spectre-x360-Convertible:~/Desktop/programming/rust/projects/hello world$ emcc -v
emcc (Emscripten GCC-like replacement + linker emulating GNU ld ) 1.22.1
clang version 3.9.0 (https://github.com/kripken/emscripten-fastcomp-clang/ a828c709b9ea5f74b5dd305759f6fc4cc541b3e3) (https://github.com/kripken/emscripten-fastcomp/ 048eb19b8d349cd5182599cfef9b01fab2d43846) (emscripten 1.37.2 : 1.37.2)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/andrew/Desktop/programming/rust/emsdk_portable/clang/fastcomp/build_incoming_64/bin
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5.4.0
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/6.0.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.4.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.0.0
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.4.0
Candidate multilib: .;@m64
Selected multilib: .;@m64
WARNING  root: LLVM version appears incorrect (seeing "(https://github.com/kripken/emscripten-fastcomp-clang/", expected "3.4")
INFO     root: (Emscripten: Running sanity checks)

@bakape
Copy link

bakape commented Feb 5, 2017

@AjBreidenbach
That's because it's still version 1.22.1.

@AjBreidenbach
Copy link
Author

@bakape
Thanks for pointing that out I realised I wasn't able to compile from another directory, turns out I'm a Linux noob and it was an issue with my environment variables.
The fix was running ./emsdk_env.sh and compiling my project under the same directory.

@Mark-Simulacrum
Copy link
Member

I don't see this with a recent emscripten, so I'm going to close.

emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 1.37.9
clang version 4.0.0  (emscripten 1.37.9 : 1.37.9)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/mark/bin/emsdk-portable/clang/e1.37.9_64bit
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.4.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.0.0
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.4.0
Candidate multilib: .;@m64
Selected multilib: .;@m64
INFO:root:(Emscripten: Running sanity checks)

@workingjubilee workingjubilee added the O-emscripten Target: 50% off wasm32-unknown-musl. the savings come out of stdio.h, but hey, you get SDL! label Oct 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
O-asmjs Target: asm.js - http://asmjs.org/ O-emscripten Target: 50% off wasm32-unknown-musl. the savings come out of stdio.h, but hey, you get SDL! O-wasm Target: WASM (WebAssembly), http://webassembly.org/
Projects
None yet
Development

No branches or pull requests

6 participants