sgrif / mysqlclient-sys

Rust bindings for libmysqlclient
Apache License 2.0
37 stars 31 forks source link

the crate recompiles every time #35

Closed Mueller-Peter-ATZ closed 1 year ago

Mueller-Peter-ATZ commented 1 year ago

OS: Windows 10 IDE: Visual Studio Code

with cargo c --verbose I get this entry: Dirty mysqlclient-sys v0.2.5: the env variable PKG_CONFIG_PATH changed Compiling mysqlclient-sys v0.2.5

On the console (bash, integrated in VSC) I checked: $ echo $PKG_CONFIG_PATH /mingw64/lib/pkgconfig:/mingw64/share/pkgconfig But the variable never reallay has changed

Expected Behavior: The libraray should only compile once and after that only if some of the dependencies are dirty.

weiznich commented 1 year ago

Can you explain what you expect to get a response here: We instruct cargo to recompile the crate if that environment variable changes because that changes how the crate is compiled. Cargo is responsible for monitoring of changed variable values and recompile the crate if necessary. The crate itself does not have control about that. So from our point of view that's either a configuration issue in your environment (variable changes because you compile the crate from somewhere else, e.g. rust-analyzer) or an issue in cargo (failed to recognize that the variable did not change, although I personally would consider that unlikely).

Mueller-Peter-ATZ commented 1 year ago

I've just seen, that this crate causes the recompiling. I've also seen it checks the variable but I could not find out why it assumes it changed. I started a project with diesel and mysql and i always recompiles a lot of thinks which is time consuming. So asking here was the best way I#ve seen so far.

I really use rust-analyzer but how does it affect the assumption? Can I change something in its settings or do something else in the enviroment to stabilize the detection?

Thanks in advance for your help

weiznich commented 1 year ago

I can understand that this is frustrating, there is just nothing we can do to help you there.

I've also seen it checks the variable but I could not find out why it assumes it changed.

Such variable changes are highly dependent on your environment. It's impossible to know what's causing them without access to that environment. I personally would start with the following assumption here: Cargo is right and that environment variable somehow changes. Find out why this might be the case. Maybe try the following steps:

  1. Close your editor and open a terminal in your project folder
  2. Run cargo c there several times. If it doesn't rebuild it's likely caused by your editor.
  3. Assuming that 2. doesn't rebuild anything: Open your editor and disable all rust related add-ons.
  4. Try building it again in the built-in terminal -> If it doesn't rebuild it's likely caused by one of the disabled addons
  5. Try enabling these add-ons one by one and see which is causing the rebuild behaviour
  6. See if you somehow can set the PKG_CONFIG_PATH for that addon as well

I'm now closing this issue as that's not an actual bug in mysqlclient-sys.