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

Error reported when cross compiling on Windows #524

Open
allenlu2008 opened this issue Feb 28, 2024 · 2 comments
Open

Error reported when cross compiling on Windows #524

allenlu2008 opened this issue Feb 28, 2024 · 2 comments

Comments

@allenlu2008
Copy link

I need to cross-compile the Linux environment on Windows. Run the command as follows:

cargo build --release --target=x86_64-unknown-linux-musl

output:

Compiling gdal-sys v0.9.1
Compiling nalgebra v0.30.1
Compiling itertools v0.10.5
Compiling log v0.4.20
Compiling float_next_after v1.0.0
Compiling bitflags v2.4.2
Compiling rand v0.8.5
Compiling lazy_static v1.4.0
Compiling dotenv v0.15.0
Compiling gdal v0.16.0
Compiling geo v0.28.0
error: could not find native static library gdal_i, perhaps an -L flag is missing?

error: could not compile gdal-sys (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...

but cargo build --release

complie success。

why?

@allenlu2008
Copy link
Author

and on linux:

= note: /usr/lib64/libgdal.so: undefined reference to PQcmdStatus@RHPG_9.6' /usr/lib64/libgdal.so: undefined reference to PQfname@RHPG_9.6'
/usr/lib64/libgdal.so: undefined reference to PQsetNoticeProcessor@RHPG_9.6' /usr/lib64/libgdal.so: undefined reference to PQftable@RHPG_9.6'
/usr/lib64/libgdal.so: undefined reference to PQstatus@RHPG_9.6' /usr/lib64/libgdal.so: undefined reference to PQftablecol@RHPG_9.6'
/usr/lib64/libgdal.so: undefined reference to PQconnectdb@RHPG_9.6' /usr/lib64/libgdal.so: undefined reference to PQescapeStringConn@RHPG_9.6'
/usr/lib64/libgdal.so: undefined reference to lo_close@RHPG_9.6' /usr/lib64/libgdal.so: undefined reference to PQputCopyEnd@RHPG_9.6'
/usr/lib64/libgdal.so: undefined reference to PQgetvalue@RHPG_9.6' /usr/lib64/libgdal.so: undefined reference to PQgetisnull@RHPG_9.6'
/usr/lib64/libgdal.so: undefined reference to PQftype@RHPG_9.6' /usr/lib64/libgdal.so: undefined reference to PQfmod@RHPG_9.6'
/usr/lib64/libgdal.so: undefined reference to lo_creat@RHPG_9.6' /usr/lib64/libgdal.so: undefined reference to PQresultStatus@RHPG_9.6'
/usr/lib64/libgdal.so: undefined reference to lo_read@RHPG_9.6' /usr/lib64/libgdal.so: undefined reference to PQexec@RHPG_9.6'
/usr/lib64/libgdal.so: undefined reference to PQsetClientEncoding@RHPG_9.6' /usr/lib64/libgdal.so: undefined reference to PQgetlength@RHPG_9.6'
/usr/lib64/libgdal.so: undefined reference to PQputCopyData@RHPG_9.6' /usr/lib64/libgdal.so: undefined reference to PQgetResult@RHPG_9.6'
/usr/lib64/libgdal.so: undefined reference to lo_write@RHPG_9.6' /usr/lib64/libgdal.so: undefined reference to PQfinish@RHPG_9.6'
/usr/lib64/libgdal.so: undefined reference to PQclear@RHPG_9.6' /usr/lib64/libgdal.so: undefined reference to PQerrorMessage@RHPG_9.6'
/usr/lib64/libgdal.so: undefined reference to PQnfields@RHPG_9.6' /usr/lib64/libgdal.so: undefined reference to lo_open@RHPG_9.6'
/usr/lib64/libgdal.so: undefined reference to PQexecParams@RHPG_9.6' /usr/lib64/libgdal.so: undefined reference to PQntuples@RHPG_9.6'
/usr/lib64/libgdal.so: undefined reference to `PQresultErrorMessage@RHPG_9.6'
collect2: error: ld returned 1 exit status

= note: some extern functions couldn't be found; some native libraries may need to be installed or have their path specified
= note: use the -l flag to specify native libraries to link
= note: use the cargo:rustc-link-lib directive to specify the native libraries to link with Cargo (see https://doc.rust-lang.org/cargo/reference/build-scripts.html#cargorustc-link-libkindname)

error: could not compile geo2png (bin "geo2png") due to previous error

@Quietly-20201113
Copy link

error[E0308]: mismatched types
--> C:\Users\dell.cargo\registry\src\index.crates.io-6f17d22bba15001f\gdal-0.16.0\src\raster\rasterband.rs:44:24
|
44 | NearestNeighbour = GDALRIOResampleAlg::GRIORA_NearestNeighbour,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected u32, found i32

error[E0308]: mismatched types
--> C:\Users\dell.cargo\registry\src\index.crates.io-6f17d22bba15001f\gdal-0.16.0\src\raster\rasterband.rs:46:16
|
46 | Bilinear = GDALRIOResampleAlg::GRIORA_Bilinear,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected u32, found i32

error[E0308]: mismatched types
--> C:\Users\dell.cargo\registry\src\index.crates.io-6f17d22bba15001f\gdal-0.16.0\src\raster\rasterband.rs:48:13
|
48 | Cubic = GDALRIOResampleAlg::GRIORA_Cubic,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected u32, found i32

error[E0308]: mismatched types
--> C:\Users\dell.cargo\registry\src\index.crates.io-6f17d22bba15001f\gdal-0.16.0\src\raster\rasterband.rs:50:19
|
50 | CubicSpline = GDALRIOResampleAlg::GRIORA_CubicSpline,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected u32, found i32

error[E0308]: mismatched types
--> C:\Users\dell.cargo\registry\src\index.crates.io-6f17d22bba15001f\gdal-0.16.0\src\raster\rasterband.rs:52:15
|
52 | Lanczos = GDALRIOResampleAlg::GRIORA_Lanczos,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected u32, found i32

error[E0308]: mismatched types
--> C:\Users\dell.cargo\registry\src\index.crates.io-6f17d22bba15001f\gdal-0.16.0\src\raster\rasterband.rs:54:15
|
54 | Average = GDALRIOResampleAlg::GRIORA_Average,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected u32, found i32

error[E0308]: mismatched types
--> C:\Users\dell.cargo\registry\src\index.crates.io-6f17d22bba15001f\gdal-0.16.0\src\raster\rasterband.rs:56:12
|
56 | Mode = GDALRIOResampleAlg::GRIORA_Mode,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected u32, found i32

error[E0308]: mismatched types
--> C:\Users\dell.cargo\registry\src\index.crates.io-6f17d22bba15001f\gdal-0.16.0\src\raster\rasterband.rs:58:13
|
58 | Gauss = GDALRIOResampleAlg::GRIORA_Gauss,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected u32, found i32

error[E0308]: mismatched types
--> C:\Users\dell.cargo\registry\src\index.crates.io-6f17d22bba15001f\gdal-0.16.0\src\raster\types.rs:29:15
|
29 | Unknown = GDALDataType::GDT_Unknown,
| ^^^^^^^^^^^^^^^^^^^^^^^^^ expected u32, found i32

error[E0308]: mismatched types
--> C:\Users\dell.cargo\registry\src\index.crates.io-6f17d22bba15001f\gdal-0.16.0\src\raster\types.rs:31:13
|
31 | UInt8 = GDALDataType::GDT_Byte,
| ^^^^^^^^^^^^^^^^^^^^^^ expected u32, found i32

error[E0308]: mismatched types
--> C:\Users\dell.cargo\registry\src\index.crates.io-6f17d22bba15001f\gdal-0.16.0\src\raster\types.rs:34:12
|
34 | Int8 = GDALDataType::GDT_Int8,
| ^^^^^^^^^^^^^^^^^^^^^^ expected u32, found i32

error[E0308]: mismatched types
--> C:\Users\dell.cargo\registry\src\index.crates.io-6f17d22bba15001f\gdal-0.16.0\src\raster\types.rs:36:14
|
36 | UInt16 = GDALDataType::GDT_UInt16,
| ^^^^^^^^^^^^^^^^^^^^^^^^ expected u32, found i32

error[E0308]: mismatched types
--> C:\Users\dell.cargo\registry\src\index.crates.io-6f17d22bba15001f\gdal-0.16.0\src\raster\types.rs:38:13
|
38 | Int16 = GDALDataType::GDT_Int16,
| ^^^^^^^^^^^^^^^^^^^^^^^ expected u32, found i32

error[E0308]: mismatched types
--> C:\Users\dell.cargo\registry\src\index.crates.io-6f17d22bba15001f\gdal-0.16.0\src\raster\types.rs:40:14
|
40 | UInt32 = GDALDataType::GDT_UInt32,
| ^^^^^^^^^^^^^^^^^^^^^^^^ expected u32, found i32

error[E0308]: mismatched types
--> C:\Users\dell.cargo\registry\src\index.crates.io-6f17d22bba15001f\gdal-0.16.0\src\raster\types.rs:42:13
|
42 | Int32 = GDALDataType::GDT_Int32,
| ^^^^^^^^^^^^^^^^^^^^^^^ expected u32, found i32

error[E0308]: mismatched types
--> C:\Users\dell.cargo\registry\src\index.crates.io-6f17d22bba15001f\gdal-0.16.0\src\raster\types.rs:45:14
|
45 | UInt64 = GDALDataType::GDT_UInt64,
| ^^^^^^^^^^^^^^^^^^^^^^^^ expected u32, found i32

error[E0308]: mismatched types
--> C:\Users\dell.cargo\registry\src\index.crates.io-6f17d22bba15001f\gdal-0.16.0\src\raster\types.rs:48:13
|
48 | Int64 = GDALDataType::GDT_Int64,
| ^^^^^^^^^^^^^^^^^^^^^^^ expected u32, found i32

error[E0308]: mismatched types
--> C:\Users\dell.cargo\registry\src\index.crates.io-6f17d22bba15001f\gdal-0.16.0\src\raster\types.rs:50:15
|
50 | Float32 = GDALDataType::GDT_Float32,
| ^^^^^^^^^^^^^^^^^^^^^^^^^ expected u32, found i32

error[E0308]: mismatched types
--> C:\Users\dell.cargo\registry\src\index.crates.io-6f17d22bba15001f\gdal-0.16.0\src\raster\types.rs:52:15
|
52 | Float64 = GDALDataType::GDT_Float64,
| ^^^^^^^^^^^^^^^^^^^^^^^^^ expected u32, found i32

For more information about this error, try rustc --explain E0308.
error: could not compile gdal (lib) due to 19 previous errors

本地安装gdal 3.8.4 rust插件0.16.0

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