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

Broken on latest nightly #844

Closed
SergioBenitez opened this Issue Apr 6, 2017 · 5 comments

Comments

Projects
None yet
4 participants
@SergioBenitez
Contributor

SergioBenitez commented Apr 6, 2017

Diesel 0.12 appears to be broken on the latest nightly. I'm seeing the following:

error[E0531]: cannot find unit struct/variant or constant `SQLITE_CONSTRAINT_UNIQUE` in module `ffi`
   --> /Users/sbenitez/.cargo/registry/src/github.com-1ecc6299db9ec823/diesel-0.12.0/src/sqlite/connection/stmt.rs:148:14
    |
148 |         ffi::SQLITE_CONSTRAINT_UNIQUE | ffi::SQLITE_CONSTRAINT_PRIMARYKEY =>
    |              ^^^^^^^^^^^^^^^^^^^^^^^^ did you mean `SQLITE_CONSTRAINT`?

error[E0531]: cannot find unit struct/variant or constant `SQLITE_CONSTRAINT_PRIMARYKEY` in module `ffi`
   --> /Users/sbenitez/.cargo/registry/src/github.com-1ecc6299db9ec823/diesel-0.12.0/src/sqlite/connection/stmt.rs:148:46
    |
148 |         ffi::SQLITE_CONSTRAINT_UNIQUE | ffi::SQLITE_CONSTRAINT_PRIMARYKEY =>
    |                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in `ffi`

error[E0531]: cannot find unit struct/variant or constant `SQLITE_CONSTRAINT_FOREIGNKEY` in module `ffi`
   --> /Users/sbenitez/.cargo/registry/src/github.com-1ecc6299db9ec823/diesel-0.12.0/src/sqlite/connection/stmt.rs:150:14
    |
150 |         ffi::SQLITE_CONSTRAINT_FOREIGNKEY => DatabaseErrorKind::ForeignKeyViolation,
    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in `ffi`

It doesn't seem like this is something that would be affected by a nightly. Perhaps there are some incorrect version bounds to an FFI library?

@aulisius

This comment has been minimized.

aulisius commented Apr 6, 2017

The problem lies in the libsqlite3-sys crate I believe

The recent commit doesn't export the constants as public.

@killercup

This comment has been minimized.

Member

killercup commented Apr 6, 2017

FYI this works

libsqlite3-sys = { version = "=0.7.1", optional = true }
@jgallagher

This comment has been minimized.

Contributor

jgallagher commented Apr 6, 2017

Short story long -

At some point bindgen started outputting macro-like constants, and libsqlite3-sys was "double exporting" a bunch of constants that we had previously included manually (see jgallagher/rusqlite#252). 0.7.2 removed the manual constants, instead relying on the bindgen-generated ones.

However, I made a mistake here - there were manual constants (like the three in the diesel error above) that are newer than SQLite 3.6.8 (the default bindgen bindings chosen if you don't select an explicitly newer version of libsqlite3-sys). The removal of the manual constants means any users of constants that were added after SQLite 3.6.8 just got an unexpected breaking change - sorry about that!

I'm taking @killercup's suggestion and doing two things:

  • Yanked libsqlite3-sys 0.7.2 (already done a few hours ago)
  • Publishing libsqlite3-sys 0.8.0 that includes a feature requiring a SQLite at least as new as 3.7.16, which is when these constraint constants were added.

The fix to use 0.7.1 works as long as you're linking against SQLite 3.7.16 or newer, but the "right" fix will be to use 0.8.0 with the min_sqlite_version_3_7_16 feature enabled. I can PR this to diesel once I get 0.8.0 published.

jgallagher added a commit to jgallagher/diesel that referenced this issue Apr 6, 2017

Update to libsqlite3-sys 0.8.0.
Specifies feature to use SQLite 3.7.16+ bindings. Closes diesel-rs#844.
@killercup

This comment has been minimized.

Member

killercup commented Apr 6, 2017

Thanks, @jgallagher! This should fix this issue for now. Can you confirm this, @SergioBenitez?

Updating our dependency on libsqlite3-sys to a version >0.7 is a breaking change to diesel, especially as this is a system lib that can only be linked once. So, this will happen with the 0.13 release at the earliest.

I'm not sure if what minimum version of sqlite we require, but 3.7.16 was release on 2013-03-18, so I'm pretty sure it's not a problem to require that. (We also have #829 open to add a bundled sqlite.)

@SergioBenitez

This comment has been minimized.

Contributor

SergioBenitez commented Apr 6, 2017

@killercup Indeed, this issue is resolved. Unfortunately another sprung up, but I'll deal with that in a different issue tracker. :)

Thanks for being quick about this, @killercup, @jgallagher!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment