Skip to content
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

Clippy fails at link time: Syntax error in VERSION script #1500

Closed
ustulation opened this issue Feb 1, 2017 · 11 comments · Fixed by #1852
Closed

Clippy fails at link time: Syntax error in VERSION script #1500

ustulation opened this issue Feb 1, 2017 · 11 comments · Fixed by #1852
Labels
C-bug Category: Clippy is not doing the correct thing

Comments

@ustulation
Copy link

If my crate Cargo.toml specifies:

[lib]
crate_type = ["cdylib"]

then running cargo clippy produces the above linker error. cargo clippy --profile=test , cargo build , cargo test etc. are all fine however.

You can even reproduce on an empty/minimal project. All it needs is the above lib type mentioned in the toml.

Using clippy version 0.0.99 with nightly from 17th Nov 2016 was fine. After updating to 19th Dec 2016 nightly and clippy 0.0.104 this was a problem and ever since continued to this date (with lates nightly and latest clippy - v0.0.112 at the time of writing this).

Is this known and is there any resolution planned on this.

@oli-obk oli-obk added the C-bug Category: Clippy is not doing the correct thing label Feb 1, 2017
@oli-obk
Copy link
Contributor

oli-obk commented Feb 1, 2017

That was probably the move to serde in the code that parses the cargo metadata output. Hmm no, December is much earlier. I'll investigate.

@oli-obk
Copy link
Contributor

oli-obk commented Feb 1, 2017

So apparently it's our use of -Zno-trans, since cargo rustc -- -Zno-trans also fails with the same error.

I reported this upstream: rust-lang/rust#39445

@ssokolow
Copy link

ssokolow commented May 14, 2017

In case anyone's interested in working around this, here's a reduced version of the justfile task I use in one of my rust-cpython projects:

check:
	#!/usr/bin/env python3
	import os, re, subprocess, sys

	filter_re = re.compile(b"\n?\n[^\n]*error.*: linking with `cc` failed: exit code: 1(.|\n)*syntax error in VERSION script(.|\n)*To learn more, run the command again with --verbose\.")

	# Run clippy with filter and ignored return code
	clippy = subprocess.Popen(
		['cargo', '+nightly', 'clippy', '--color=always'],
		stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
	clippy_output = clippy.communicate()[0]
	sys.stdout.buffer.write(filter_re.sub(b'', clippy_output))

	# ...and let `cargo check` handle dying on failure instead
	with open(os.devnull, 'wb') as devnull:
		sys.exit(subprocess.call(['cargo', 'check'], 
			stdout=devnull, stderr=devnull))
	# Use sys.exit() rather than check_call() to avoid traceback
	# (no conditional since it's the last thing in the task anyway)

@oli-obk
Copy link
Contributor

oli-obk commented May 23, 2017

according to rustc this is fixed: rust-lang/rust#39445 (comment)

@ssokolow @ustulation can you confirm?

@ssokolow
Copy link

ssokolow commented May 23, 2017

Still a problem here.

(I tested with a freshly-run rustup update and cargo +nightly install -f clippy about 5 hours ago and still got the error message, but got side-tracked before I could respond.)

@stanislav-tkach
Copy link
Contributor

I have run into this problem too. Is there any workaround?..

@oli-obk
Copy link
Contributor

oli-obk commented Jun 22, 2017

Apparently the "new" way to do this is to use --emit=metadata should be easy enough to change in cargo clippy

@ssokolow
Copy link

ssokolow commented Jul 9, 2017

Has this fix been pushed to crates.io yet?

I just did a rustup update; cargo +nightly install -f clippy; cargo +nightly clippy run and I'm still getting this error.

@stanislav-tkach
Copy link
Contributor

As far as I can see, #1852 was merged just after version had been bumped to 0.0.142 (Manishearth@e56331f). I'm waiting for the fix too. 😄

@oli-obk
Copy link
Contributor

oli-obk commented Jul 10, 2017

This has been published.

The delay happened because we mostly publish on rustups, and these can be a week or two apart.

@ssokolow
Copy link

I can confirm that the problem appears to be fixed now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants