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

Cannot Compile Anymore #79

Open
xFGhoul opened this issue Mar 12, 2025 · 15 comments
Open

Cannot Compile Anymore #79

xFGhoul opened this issue Mar 12, 2025 · 15 comments

Comments

@xFGhoul
Copy link

xFGhoul commented Mar 12, 2025

Updated to diesel 2.2.8 and from then on I can no longer compile this module:

rust: rustup 1.28.1 (f9edccde0 2025-03-05)
cargo: cargo 1.87.0-nightly (ab1463d63 2025-03-08)

please let me know if you need any other information.

@weiznich
Copy link
Collaborator

It's impossible to help you based on these information. You need to at least provide information about:

  • You pq-sys version
  • The feature flags you enabled
  • Your operating system
  • If relevant your pq-src version
  • The exact error message as emitted by rustc

@xFGhoul
Copy link
Author

xFGhoul commented Mar 12, 2025

I apologize for the lack of information, did not even realize I did not post the error message.

pq-sys version: registry+https://github.com/rust-lang/crates.io-index#pq-sys@0.7.0
diesel features:

  19 ~ │ diesel = { version = "2.2.8", features = [
  20   │     "postgres",
  21   │     "uuid",
  22   │     "chrono",
  23   │     "numeric",
  24   │ ] }
  25   │ diesel-derive-enum = { version = "2.1.0", features = ["postgres"] }
  26   │ diesel-async = { version = "0.5.2", features = [
  27   │     "postgres",
  28   │     "deadpool",
  29   │     "async-connection-wrapper",
  30   │ ] }
  31   │ diesel_migrations = { version = "2.2.0" }

os: Windows 11 24H2
pq-src: 17

  31   │ # PostgreSQL
  32   │ [target.x86_64-pc-windows-msvc.pq]
  33   │ rustc-link-search = ["C:\\Program Files\\PostgreSQL\\17\\lib"]
  34   │ rustc-link-lib = ["libpq"]

Error Message:

error: couldn't read `C:\Users\daunt\dev\Protein\target\debug\build\pq-sys-4ddb3d56de9010e2\out/bindings.rs`: The system cannot find the path specified. (os error 3)
 --> C:\Users\daunt\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\pq-sys-0.7.0\src\lib.rs:6:5
  |
6 |     include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: this error originates in the macro `include` (in Nightly builds, run with -Z macro-backtrace for more info)

@weiznich
Copy link
Collaborator

That's surprising, given that we have a CI job that tests this for windows. Can you verify that the file C:\Users\daunt\dev\Protein\target\debug\build\pq-sys-4ddb3d56de9010e2\out/bindings.rs actually does not exist (also not in slightly different path configurations?)

@xFGhoul
Copy link
Author

xFGhoul commented Mar 12, 2025

The directory pq-sys-4ddb3d56de9010e2 does not even exist.

Image

@weiznich
Copy link
Collaborator

In this case something very strange is going on at your system because OUT_DIR is set by cargo to explicitly point to the directory where we should place output from the build script like the bindings. Documentation. I'm not sure what we can do here other than stating that this looks either like an environment or a cargo issue.

@xFGhoul
Copy link
Author

xFGhoul commented Mar 12, 2025

Well, I do not have a build.rs script. is there any boilerplate I can create?

@weiznich
Copy link
Collaborator

You don't need a build.rs script for that. pq-sys needs that, but it has that build script. The relevant part that copies this file in place is here:

https://github.com/sgrif/pq-sys/blob/master/build.rs#L89-L119

@xFGhoul
Copy link
Author

xFGhoul commented Mar 12, 2025

from reading the documentation, will cargo set OUT_DIR in the first place though, as I would assume my "root" crate has no build script, meaning no need to set the environment variable.

@weiznich
Copy link
Collaborator

Again: Your crate does not matter for this, the compilation does not even reach your crate. The only thing that's required here is that pq-src has a build script. Then cargo sets this variable while building pq-sys.

@xFGhoul
Copy link
Author

xFGhoul commented Mar 12, 2025

I understand, so what can I do?

@weiznich
Copy link
Collaborator

Well given that this seems to be specific to your environment there is not much we can do this to solve the problem for you. You could try:

  • to debug it locally to see where exactly the bindings file is written to
  • to report it to the cargo team and see what they say
  • try to downgrade pq-sys to a version that works for you
  • possibly drop the dependency on pq-sys given that you use diesel-async (which shouldn't require it)

@xFGhoul
Copy link
Author

xFGhoul commented Mar 12, 2025

I think downgrading or dropping the dependency works, how would I drop pq-sys this all occured after doing cargo update, so something could've gone wrong.

@weiznich
Copy link
Collaborator

weiznich commented Mar 12, 2025

cargo update always updates all possible dependencies. You can update only a single crate by using cargo update -p your-crate. You can specify a target version via the --precise flag.

@xFGhoul
Copy link
Author

xFGhoul commented Mar 12, 2025

I was thankfully able to do a git restore on cargo update and got a successful compile.

@xFGhoul
Copy link
Author

xFGhoul commented Mar 12, 2025

very strange error though I will not lie, will have to investigate later.

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

2 participants