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

pq-sys fails to compile: function not loaded: clang_Type_getNumTemplateArguments #9

Closed
pwestrich opened this issue Feb 17, 2017 · 13 comments

Comments

@pwestrich
Copy link

Earlier today I attempted to install the diesel_cli tool. In the build process, pq-sys fails to compile with the following output.I am running CentOS 7 and I have ensured that the postgresql drivers are installed for my system (postgresql-devel).

error: failed to compile `diesel_cli v0.11.0`, intermediate artifacts can be found at `/tmp/cargo-install.Ca0pik3nWLxM`

Caused by:
  failed to run custom build command for `pq-sys v0.3.2`
process didn't exit successfully: `/tmp/cargo-install.Ca0pik3nWLxM/release/build/pq-sys-5e98d83271bac7b9/build-script-build` (exit code: 101)
--- stderr
thread 'main' panicked at 'function not loaded: clang_Type_getNumTemplateArguments', /home/pwestrich/.cargo/registry/src/github.jparrowsec.cn-1ecc6299db9ec823/clang-sys-0.14.0/src/lib.rs:1334
stack backtrace:
   1:     0x7f6fa175bb8a - std::sys::imp::backtrace::tracing::imp::write::h3188f035833a2635
                        at /buildslave/rust-buildbot/slave/stable-dist-rustc-linux/build/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:42
   2:     0x7f6fa176001f - std::panicking::default_hook::{{closure}}::h6385b6959a2dd25b
                        at /buildslave/rust-buildbot/slave/stable-dist-rustc-linux/build/src/libstd/panicking.rs:349
   3:     0x7f6fa175fc1e - std::panicking::default_hook::he4f3b61755d7fa95
                        at /buildslave/rust-buildbot/slave/stable-dist-rustc-linux/build/src/libstd/panicking.rs:365
   4:     0x7f6fa1760467 - std::panicking::rust_panic_with_hook::hf00b8130f73095ec
                        at /buildslave/rust-buildbot/slave/stable-dist-rustc-linux/build/src/libstd/panicking.rs:553
   5:     0x7f6fa15bf6ff - std::panicking::begin_panic::haa6e343a5b54e680
   6:     0x7f6fa15c5e46 - clang_sys::clang_Type_getNumTemplateArguments::hf6ae1986c9e5bbf0
   7:     0x7f6fa153685b - bindgen::ir::ty::Type::from_clang_ty::h7b8f3debdb8011b0
   8:     0x7f6fa153131e - <bindgen::ir::item::Item as bindgen::parse::ClangItemParser>::from_ty_with_id::he4c5aa76fe1f9fdf
   9:     0x7f6fa152ffaf - <bindgen::ir::item::Item as bindgen::parse::ClangItemParser>::parse::h9c90429bb42e0f3b
  10:     0x7f6fa153de41 - bindgen::parse_one::h5bd4381ad3005ffa
  11:     0x7f6fa1513d43 - bindgen::clang::visit_children::h3d5cc1a5a3e7a047
  12:     0x7f6f9f0a64ea - <unknown>
  13:     0x7f6f9f0b6a67 - <unknown>
  14:     0x7f6f9f0a72d1 - <unknown>
  15:     0x7f6f9f0a5f4a - <unknown>
  16:     0x7f6f9f0ae844 - clang_visitChildren
  17:     0x7f6fa15cd147 - clang_sys::clang_visitChildren::hdf70b9b1b2ade471
  18:     0x7f6fa153b7c1 - bindgen::Bindings::generate::h63b32743cc3cb9b0
  19:     0x7f6fa153aa84 - bindgen::Builder::generate::h3559f27b62685dac
  20:     0x7f6fa14e0ecc - build_script_build::main::ha64233a576cc6b9c
  21:     0x7f6fa176737a - __rust_maybe_catch_panic
                        at /buildslave/rust-buildbot/slave/stable-dist-rustc-linux/build/src/libpanic_unwind/lib.rs:98
  22:     0x7f6fa1760ba6 - std::rt::lang_start::h65647f6e36cffdae
                        at /buildslave/rust-buildbot/slave/stable-dist-rustc-linux/build/src/libstd/panicking.rs:434
                        at /buildslave/rust-buildbot/slave/stable-dist-rustc-linux/build/src/libstd/panic.rs:351
                        at /buildslave/rust-buildbot/slave/stable-dist-rustc-linux/build/src/libstd/rt.rs:57
  23:     0x7f6fa06bcb34 - __libc_start_main
  24:     0x7f6fa14dba88 - <unknown>
  25:                0x0 - <unknown>

@sgrif
Copy link
Owner

sgrif commented Feb 17, 2017

What version of clang do you see when running clang --version?

@freinn
Copy link

freinn commented Feb 18, 2017

That's the current list of packages I had to install on ubuntu 16.04 for diesel (and rocket) to work:

sudo apt-get install sqlite libsqlite3-dev clang libclang-dev

Maybe some of them are needed for you to compile successfully.

@pwestrich
Copy link
Author

I believe I have the CentOS versions of all those packages installed; I'll have to go check once I'm back at work Monday, because I can't get to the machine right now.

I want to say clang is version 3.4.2 from the EPEL repository. Is it too old?

@sgrif
Copy link
Owner

sgrif commented Feb 18, 2017

Yes. Bindgen requires clang 3.9 (I've had success with older versions, but not with versions quite that old)

@pwestrich
Copy link
Author

That's what I get for using CentOS. Though it it were up to me, I wouldn't be. Guess I'll have to try my luck building a newer version of clang from source.

It would be nice if Cargo had some kind of method of checking for things like this rather than print a pretty cryptic error message. But that's an issue for another time.

@sgrif
Copy link
Owner

sgrif commented Feb 18, 2017

Bindgen actually could if it wanted to. I think it avoids erroring because somethings do work with older versions. Either way the change to "generate the bindings off the headers on your machine" has been causing a lot of problems, and I'm considering going back to using pre-generated bindings.

@pwestrich
Copy link
Author

Perhaps rather than erroring out it could print a warning along the lines of, "Hey, Library version x.y.z is ancient, things might not work!" that way it would give a little bit of a lead to people when things explode. I don't have any idea how difficult that would be though.

@sgrif
Copy link
Owner

sgrif commented Feb 18, 2017

Yeah, I've been thinking about doing that from the pq-sys side. The problem is that if it does error, the warning will get completely buried.

@pwestrich
Copy link
Author

Well that's lame. I'm guessing there's no way to make sure both get printed out in that case?

@sgrif
Copy link
Owner

sgrif commented Feb 18, 2017

They'll both be printed. The problem is that the warning is small and the error is big (and will come after the warning).

@pwestrich
Copy link
Author

And then the error buries the warning in your history, causing it to be lost forever if your terminal won't scroll back. Being partially visible is at least better than eating it alive, which I have seen other tools do before.

@sgrif
Copy link
Owner

sgrif commented Feb 18, 2017

I think the better solution is to just go back to vendoring pre-generated bindings.

@pwestrich
Copy link
Author

Whatever you think will work out best. Either way, thanks for helping with my issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants