Why the folder is not inside OUT_DIR

Hi all,

I am facing this error while trying to publish a crate.

Source directory was modified by build.rs during cargo publish. 
Build scripts should not modify anything outside of OUT_DIR. 
Modified file: $HOME/paho_mqtt_c-sys/target/package/paho_mqtt_c-sys-0.1.0/paho.mqtt.c/build/output/test/test5

I don't understand why $HOME/paho_mqtt_c-sys/target/ is not the OUT_DIR.

What is happening inside the build.rs is to just call make on a C library, of course it does generate some file.

Am I missing something?

In case it helps to self diagnose, the cargo PR for that check is:


The linked issue describes why it was added.

Do you use the current value of OUT_DIR in your build script? What is it set to during cargo publish?

Target dir and out dir are different directories. Out dir is a randomly named temp directory deep inside the target dir.