Parcel: 馃悰 Error compiling simple rust project: multiple input filenames provided

Created on 30 Jan 2018  路  9Comments  路  Source: parcel-bundler/parcel

馃悰 bug report

馃帥 Configuration (.babelrc, package.json, cli command)

package.json

{
  "name": "rust-wasm",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "MIT",
  "dependencies": {
    "parcel-bundler": "^1.5.1"
  }
}

Run parcel index.js

馃 Expected Behavior

Should compile

馃槸 Current Behavior

Console output:

Server running at http://localhost:1234
馃毃  /Users/rob/Development/testing/web/rust-wasm/ops.rs: Command failed: rustc +nightly --target wasm32-unknown-unknown -O --crate-type=cdylib /Users/rob/Development/testing/web/rust-wasm/ops.rs -o /Users/rob/Development/testing/web/rust-wasm/.cache/933d122f8546a30c5660c45821247fad.wasm
error: multiple input filenames provided

error: multiple input filenames provided


    at ChildProcess.exithandler (child_process.js:275:12)
    at emitTwo (events.js:126:13)
    at ChildProcess.emit (events.js:214:7)
    at maybeClose (internal/child_process.js:925:16)
    at Socket.stream.socket.on (internal/child_process.js:346:11)
    at emitOne (events.js:116:13)
    at Socket.emit (events.js:211:7)
    at Pipe._handle.close [as _onclose] (net.js:554:12)

馃敠 Context

Just a simple test of Rust support

馃捇 Code Sample

index.js

import { add } from './ops.rs'

console.log(add(4, 6))

ops.rs

#[no_mangle]
pub fn add(a: i32, b: i32) -> i32 {
  return a + b
}

馃實 Your Environment

| Software | Version(s) |
| ---------------- | ---------- |
| Parcel | 1.5.1 |
| Node | v8.9.3 |
| npm/Yarn | npm 5.5.1 |
| Operating System | macOS 10.13.4 beta (17E139j) |
| Rust | nightly-x86_64-apple-darwin unchanged - rustc 1.25.0-nightly (90eb44a58 2018-01-29) |

Bug WASM

Most helpful comment

Okay, so it turns out that rustc installed via homebrew doesn't respect the +nightly modifier. That coupled with rustup being used to install toolchains and such results in the case where the toolchains are installed to the ~/.cargo installation but parcel tries to use (rightly) the first occurence of rustc in the PATH; which in this case was the homebrew version.

TL;DR: uninstalled homebrew version. it works now.

All 9 comments

\cc @albizures

hey @robjtede, I made a quick test with the two files that you sent, but I couldn't reproduce the error, could you please provide a repo with this error?

hmm i only see one input file in the command. maybe the version of rust you're using has a bug?

@devongovett I was wondering if that might be the case, it's possible its mis-handing the arguments.

@albizures I'll get one together, yes.

Simplified the command all the way to rustc +nightly ./ops.rs and still getting error: multiple input filenames provided. Seems that +nightly is causing the problems?

@robjtede do you tried without the +nightly?

I have been trying, but I can't get the "multiple input filenames provided" message 馃槥

@albizures yes but the wasm32-unknown-unknown target is not available on stable yet, afaik. So while that will work adding the --target argument wont.

I just tried this on a Linux machine and it worked fine. Seems there are other factors...

ooh right, so but you could try, setting nightly as default and without the flag

Okay, so it turns out that rustc installed via homebrew doesn't respect the +nightly modifier. That coupled with rustup being used to install toolchains and such results in the case where the toolchains are installed to the ~/.cargo installation but parcel tries to use (rightly) the first occurence of rustc in the PATH; which in this case was the homebrew version.

TL;DR: uninstalled homebrew version. it works now.

Was this page helpful?
0 / 5 - 0 ratings