launchbadge / sqlx

🧰 The Rust SQL Toolkit. An async, pure Rust SQL crate featuring compile-time checked queries without a DSL. Supports PostgreSQL, MySQL, and SQLite.
Apache License 2.0
13.39k stars 1.27k forks source link

sqlx-cli 0.5.10 install fails if only built with postgres feature #1604

Closed bk138 closed 2 years ago

bk138 commented 2 years ago

To repro:

# as per https://crates.io/crates/sqlx-cli
cargo install sqlx-cli --no-default-features --features postgres

yields:

Compiling sqlx-rt v0.5.10
error: one of the features ['runtime-actix-native-tls', 'runtime-async-std-native-tls', 'runtime-tokio-native-tls', 'runtime-actix-rustls', 'runtime-async-std-rustls', 'runtime-tokio-rustls'] must be enabled
  --> /home/bk/.cargo/registry/src/github.com-1ecc6299db9ec823/sqlx-rt-0.5.10/src/lib.rs:9:1
   |
9  | / compile_error!(
10 | |     "one of the features ['runtime-actix-native-tls', 'runtime-async-std-native-tls', \
11 | |      'runtime-tokio-native-tls', 'runtime-actix-rustls', 'runtime-async-std-rustls', \
12 | |      'runtime-tokio-rustls'] must be enabled"
13 | | );
   | |_^

error: could not compile `sqlx-rt` due to previous error
warning: build failed, waiting for other jobs to finish...
error: failed to compile `sqlx-cli v0.5.10`, intermediate artifacts can be found at `/tmp/cargo-installrC1RJT`

Caused by:
  build failed

I think this appeared in 0.5.10, but am unsure. 0.5.5 worked for me.

paolobarbolini commented 2 years ago

Most likely caused by #1584. The issue is fixed by also including either the native-tls or the rustls feature

abonander commented 2 years ago

Heh, I knew that PR would break something with those instructions, I just focused in the wrong thing.

bk138 commented 2 years ago

Thanks! Will the docs get updated or Cargo.toml "fixed"?

abonander commented 2 years ago

The docs will be updated but I don't think we'll be putting out a patch release just for this.

It's just a minor hiccup which is unfortunately another gotcha with the coupling of the runtime selection and TLS integration. We've got some plans to address this in the next major release but no significant developments yet.

leofidus commented 2 years ago

I'll be the outsider who barges in and complains that a patch release broke their CI pipeline. Not even obscure usage, but literally the second example in https://github.com/launchbadge/sqlx/tree/master/sqlx-cli

What's done is done, but #1584 should really have been a major release.

abonander commented 2 years ago

To be fair, if you're using that command to install it in CI then a major release would have broken it all the same since cargo install always installs the latest version.

It's probably a good idea to change your script to always install an exact version and then upgrade it manually.

abonander commented 2 years ago

Install instructions have been updated: https://github.com/launchbadge/sqlx/tree/master/sqlx-cli#with-rust-toolchain

binkabir commented 1 year ago

Hello, Im facing this same issue

  --> /home/binkabir/.cargo/registry/src/github.com-1ecc6299db9ec823/sqlx-rt-0.6.2/src/lib.rs:23:1
   |
23 | / compile_error!(
24 | |     "only one of ['runtime-actix-native-tls', 'runtime-async-std-native-tls', \
25 | |      'runtime-tokio-native-tls', 'runtime-actix-rustls', 'runtime-async-std-rustls', \
26 | |      'runtime-tokio-rustls'] can be enabled"
27 | | );
   | |_^

error: could not compile `sqlx-rt` due to previous error
warning: build failed, waiting for other jobs to finish...

even after following the installation instruction

abonander commented 1 year ago

Installation instructions in the README on main are for the current 0.7 alpha as stated there. Installation instructions for 0.6 can be found in the Git tags or on crates.io: https://crates.io/crates/sqlx/0.6.2