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

using rustbuild breaks compiling against system llvm when linked against libffi #39880

Closed
hussamT opened this Issue Feb 16, 2017 · 8 comments

Comments

Projects
None yet
6 participants
@hussamT
Copy link

hussamT commented Feb 16, 2017

I get the following error:
rust undefined reference to `ffi_type_double'

There was a workaround that helped in the past but it doesn't anymore.

@nagisa

This comment has been minimized.

Copy link
Contributor

nagisa commented Feb 16, 2017

That’s most likely because your system llvm-config does not print -lffi in

$ llvm-config --system-libs
-lrt -ldl -lcurses -lpthread -lz -lm -lffi

That’s a bug in your system LLVM. Workaround is to put something like

#!/usr/bin/bash
/usr/bin/llvm-config "$@" | sed 's/-lm/-lm -lffi/'

in your path (so the script would execute instead of the actual llvm-config, when llvm-config is invoked)

@hussamT

This comment has been minimized.

Copy link
Author

hussamT commented Feb 16, 2017

I will try that now. Than you.
Edit: It didn't help. Maybe I need to patch llvm instead?

@kyrias

This comment has been minimized.

Copy link
Contributor

kyrias commented Mar 3, 2017

Yeah, I'm currently trying to build rust 1.15.1 for Arch, and I've tried both the old setting RUSTFLAGS to -C link-args=-lffi approach, and making llvm-config a wrapper script that adds it, but neither works anymore. Not sure how it decides the CFLAGS it uses now.

@hussamT

This comment has been minimized.

Copy link
Author

hussamT commented Mar 3, 2017

I noticed Fedora is using --disable-rustbuild http://pkgs.fedoraproject.org/cgit/rpms/rust.git/tree/rust.spec#n260 which retains the old behavior.

@kyrias

This comment has been minimized.

Copy link
Contributor

kyrias commented Mar 3, 2017

Just discovered that it's a regression in llvm(-config). On e.g. debian it is included in llvm-config, and if I download the Arch package for the same llvm version it also outputs -lffi there, so seems to have been a regression between LLVM 3.5 and 3.9. Would need help from some LLVM people to figure out what changed though.

@cuviper

This comment has been minimized.

Copy link
Member

cuviper commented Mar 3, 2017

I noticed Fedora is using --disable-rustbuild http://pkgs.fedoraproject.org/cgit/rpms/rust.git/tree/rust.spec#n260 which retains the old behavior.

For 1.15, yes, as I haven't transitioned yet. I hope to use rustbuild for 1.16.

Fedora doesn't normally use static linking, but it's an option, and you can see my ffi workaround here:
http://pkgs.fedoraproject.org/cgit/rpms/rust.git/tree/rust.spec#n233

I still think llvm-config --link-static --system-libs ought to output -lffi itself though. It was mentioned in #34486 (comment) that llvm-config has a FIXME about this, which is still there in the latest sources.

japaric added a commit to japaric/rust that referenced this issue Apr 7, 2017

japaric added a commit to japaric/rust that referenced this issue Apr 7, 2017

@Mark-Simulacrum

This comment has been minimized.

Copy link
Member

Mark-Simulacrum commented Sep 15, 2017

I take it this isn't a problem on Rust's side, so closing. If I'm wrong please let us know!

dylanmckay added a commit to avr-rust/rust that referenced this issue Sep 24, 2017

[AVR][No Upstream] Cherry-pick workaround for rust-lang#39880
This shouldn't need to be in tree, but I'm committing it anyway because
it's a headache when compiling with a separate LLVM root.

dylanmckay added a commit to avr-rust/rust that referenced this issue Sep 24, 2017

[AVR][No Upstream] Cherry-pick workaround for rust-lang#39880
This shouldn't need to be in tree, but I'm committing it anyway because
it's a headache when compiling with a separate LLVM root.

dylanmckay added a commit to avr-rust/rust that referenced this issue Sep 25, 2017

[AVR][No Upstream] Cherry-pick workaround for rust-lang#39880
This shouldn't need to be in tree, but I'm committing it anyway because
it's a headache when compiling with a separate LLVM root.

dylanmckay added a commit to avr-rust/rust that referenced this issue Sep 25, 2017

[AVR][No Upstream] Cherry-pick workaround for rust-lang#39880
This shouldn't need to be in tree, but I'm committing it anyway because
it's a headache when compiling with a separate LLVM root.

shepmaster added a commit to avr-rust/rust that referenced this issue Sep 28, 2017

[AVR][No Upstream] Cherry-pick workaround for rust-lang#39880
This shouldn't need to be in tree, but I'm committing it anyway because
it's a headache when compiling with a separate LLVM root.
@tmccombs

This comment has been minimized.

Copy link
Contributor

tmccombs commented Mar 16, 2019

is there an llvm issue open for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.