gdal icon indicating copy to clipboard operation
gdal copied to clipboard

The package cannot be compiling

Open WHULMQ opened this issue 3 years ago • 6 comments

I try to compiling the package today.But there are some errors as:

error: failed to run custom build command for gdal-sys v0.3.1

Caused by: process didn't exit successfully: D:\VScode\rust\read_tif\target\debug\build\gdal-sys-21e0a3b3239f1c3a\build-script-build (exit code: 101) --- stdout cargo:rerun-if-env-changed=GDAL_STATIC cargo:rerun-if-env-changed=GDAL_DYNAMIC cargo:rerun-if-env-changed=GDAL_INCLUDE_DIR cargo:rerun-if-env-changed=GDAL_LIB_DIR cargo:rerun-if-env-changed=GDAL_HOME cargo:rerun-if-env-changed=GDAL_VERSION

--- stderr thread 'main' panicked at 'windows-gnu requires gdal_i.lib to be present in either $GDAL_LIB_DIR or $GDAL_HOME\lib.', C:\Users\10717.cargo\registry\src\github.com-1ecc6299db9ec823\gdal-sys-0.3.1\build.rs:131:17 note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

WHULMQ avatar Apr 06 '21 09:04 WHULMQ

Did you try to download GDAL and set those environment variables (at least GDAL_HOME and/or GDAL_INCLUDE_DIR and GDAL_LIB_DIR)? ~~Windows binaries are a bit hard to find, but https://www.gisinternals.com/release.php should be fine. Make sure to download the one that matches your C compiler.~~ Looks like you might need a MinGW version instead.

lnicola avatar Apr 06 '21 10:04 lnicola

Did you try to download GDAL and set those environment variables (at least GDAL_HOME and/or GDAL_INCLUDE_DIR and GDAL_LIB_DIR)? ~Windows binaries are a bit hard to find, but https://www.gisinternals.com/release.php should be fine. Make sure to download the one that matches your C compiler.~ Looks like you might need a MinGW version instead.

How can I set those environment variables? I did not download GDAL. I just add ' gdal = "0.7.2" ' in Cargo.toml .

Cargo.toml: [dependencies] gdal = "0.7.2"

WHULMQ avatar Apr 06 '21 13:04 WHULMQ

You need to either compile or install/download a GDAL version compiled with MinGW (it might be easier to install VS Community, switch to the stable-msvc Rust toolchain, then download a MSVC GDAL), then you can set the environment variables like:

SET GDAL_HOME=D:\gdal
SET GDAL_INCLUDE_DIR=D:\gdal\include
SET GDAL_LIB_DIR=D:\gdal\lib

or similar.

lnicola avatar Apr 06 '21 13:04 lnicola

After we upgraded to the latest from 0.6, we found that $env:GDAL_VERSION must be set or the gdal-sys build script will just quit (Windows)

ktmattson-alion avatar Apr 13 '21 15:04 ktmattson-alion

it would be great if we could add a solution to the readme

jdroenner avatar Apr 25 '21 10:04 jdroenner

After we upgraded to the latest from 0.6, we found that $env:GDAL_VERSION must be set or the gdal-sys build script will just quit (Windows)

After we upgraded to the latest from 0.6, we found that $env:GDAL_VERSION must be set or the gdal-sys build script will just quit (Windows)

may i ask how to do that and the version is the windowns gdal version like "3.8.4" or the toml denpandenice version like "0.16.0"

kl402401 avatar Apr 28 '24 02:04 kl402401