georust / proj-sys Goto Github PK
View Code? Open in Web Editor NEW*-sys crate for PROJ
Home Page: https://docs.rs/proj-sys
*-sys crate for PROJ
Home Page: https://docs.rs/proj-sys
I'm getting an error while building:
Compiling proj-sys v0.6.1 (file:///private/tmp/proj-sys)
error: failed to run custom build command for `proj-sys v0.6.1 (file:///private/tmp/proj-sys)`
process didn't exit successfully: `/private/tmp/proj-sys/target/debug/build/proj-sys-de8be0349baaa23b/build-script-build` (exit code: 101)
--- stdout
cargo:rustc-link-lib=proj
--- stderr
wrapper.h:1:10: fatal error: 'proj.h' file not found
wrapper.h:1:10: fatal error: 'proj.h' file not found, err: true
thread 'main' panicked at 'Unable to generate bindings: ()', src/libcore/result.rs:906:4
note: Run with `RUST_BACKTRACE=1` for a backtrace.
Rather than juggling system proj.4 versions and header files, would it make sense to directly build and link proj.4 doing something like in libgit2-sys?
When trying to compile a project using proj
, I'm getting a linker error:
error: linking with `cc` failed: exit code: 1
|
= note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-L" "/home/gegy1000/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "/mnt/c/Development/Projects/Experimental/proj-test/target/release/deps/proj_test-7704cec
b1c45b2cb.proj_test.amtqhapn-cgu.0.rcgu.o" "/mnt/c/Development/Projects/Experimental/proj-test/target/release/deps/proj_test-7704cecb1c45b2cb.proj_test.amtqhapn-cgu.1.rcgu.o" "-o" "/mnt/c/Development/Projects/Experimental/proj-test/target/release/deps/proj_test-770
4cecb1c45b2cb" "/mnt/c/Development/Projects/Experimental/proj-test/target/release/deps/proj_test-7704cecb1c45b2cb.kii7y0eln117ss1.rcgu.o" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro" "-Wl,-znow" "-Wl,-O1" "-nodefaultlibs" "-L" "/mnt/c/Development/Projects/Experimental/
proj-test/target/release/deps" "-L" "/mnt/c/Development/Projects/Experimental/proj-test/target/release/build/backtrace-sys-b90cabdcdabda6a9/out" "-L" "/home/gegy1000/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,
-Bstatic" "/mnt/c/Development/Projects/Experimental/proj-test/target/release/deps/libproj-6aeb122b824692f6.rlib" "/mnt/c/Development/Projects/Experimental/proj-test/target/release/deps/libproj_sys-6af878fad6db79d4.rlib" "/mnt/c/Development/Projects/Experimental/pro
j-test/target/release/deps/libgeo_types-ff77a31207f18dd1.rlib" "/mnt/c/Development/Projects/Experimental/proj-test/target/release/deps/libnum_traits-a4d9916a2932ee42.rlib" "/mnt/c/Development/Projects/Experimental/proj-test/target/release/deps/libfailure-715f40c821
de081d.rlib" "/mnt/c/Development/Projects/Experimental/proj-test/target/release/deps/libbacktrace-f888fe3f821ba9cd.rlib" "/mnt/c/Development/Projects/Experimental/proj-test/target/release/deps/libbacktrace_sys-e4d1ff8523ec863d.rlib" "/mnt/c/Development/Projects/Exp
erimental/proj-test/target/release/deps/liblibc-77d554fdd62618ba.rlib" "/mnt/c/Development/Projects/Experimental/proj-test/target/release/deps/libcfg_if-8ef93411fa3d347e.rlib" "/mnt/c/Development/Projects/Experimental/proj-test/target/release/deps/librustc_demangle
-a55ce6a8ee6a97ff.rlib" "-Wl,--start-group" "/home/gegy1000/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-e1ef3ed0bd712c66.rlib" "/home/gegy1000/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x8
6_64-unknown-linux-gnu/lib/libpanic_unwind-70015e0cbf914a45.rlib" "/home/gegy1000/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-5ad672b990e01dad.rlib" "/home/gegy1000/.rustup/toolchains/nightly-x86_64-unkn
own-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-57f0b9751bef7278.rlib" "/home/gegy1000/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libbacktrace-c08e3bd79a268553.rlib" "/home/gegy10
00/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libbacktrace_sys-e94c8558b2493f45.rlib" "/home/gegy1000/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-e0
b56574f0e7355d.rlib" "/home/gegy1000/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-b12ab750f20453cc.rlib" "/home/gegy1000/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-g
nu/lib/libcfg_if-3c4a9ef8e5898164.rlib" "/home/gegy1000/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-28c451a2dd927fde.rlib" "/home/gegy1000/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_6
4-unknown-linux-gnu/lib/liballoc-e9adb24f5a1b55e1.rlib" "/home/gegy1000/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-179a7d91d9a0a4af.rlib" "/home/gegy1000/.rustup/toolchains/nightly-x86_64
-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-11a41358349f8dcb.rlib" "-Wl,--end-group" "/home/gegy1000/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-bf08dd0ba0428ea9.rlib" "-W
l,-Bdynamic" "-lproj" "-lutil" "-lutil" "-ldl" "-lrt" "-lpthread" "-lgcc_s" "-lc" "-lm" "-lrt" "-lpthread" "-lutil" "-lutil"
= note: /mnt/c/Development/Projects/Experimental/proj-test/target/release/deps/libproj-6aeb122b824692f6.rlib(proj-6aeb122b824692f6.proj.2iv9z5nl-cgu.9.rcgu.o): In function `proj::proj::Proj::new_known_crs::h718411046c8ff7a0':
proj.2iv9z5nl-cgu.9:(.text._ZN4proj4proj4Proj13new_known_crs17h718411046c8ff7a0E+0x99): undefined reference to `proj_context_create'
proj.2iv9z5nl-cgu.9:(.text._ZN4proj4proj4Proj13new_known_crs17h718411046c8ff7a0E+0xa2): undefined reference to `proj_area_create'
proj.2iv9z5nl-cgu.9:(.text._ZN4proj4proj4Proj13new_known_crs17h718411046c8ff7a0E+0xcd): undefined reference to `proj_area_set_bbox'
proj.2iv9z5nl-cgu.9:(.text._ZN4proj4proj4Proj13new_known_crs17h718411046c8ff7a0E+0xdf): undefined reference to `proj_create_crs_to_crs'
/mnt/c/Development/Projects/Experimental/proj-test/target/release/deps/libproj-6aeb122b824692f6.rlib(proj-6aeb122b824692f6.proj.2iv9z5nl-cgu.9.rcgu.o): In function `_$LT$proj..proj..Proj$u20$as$u20$core..ops..drop..Drop$GT$::drop::h74f2bb9a49ff3e35':
proj.2iv9z5nl-cgu.9:(.text._ZN58_$LT$proj..proj..Proj$u20$as$u20$core..ops..drop..Drop$GT$4drop17h74f2bb9a49ff3e35E+0x9): undefined reference to `proj_destroy'
proj.2iv9z5nl-cgu.9:(.text._ZN58_$LT$proj..proj..Proj$u20$as$u20$core..ops..drop..Drop$GT$4drop17h74f2bb9a49ff3e35E+0x13): undefined reference to `proj_context_destroy'
proj.2iv9z5nl-cgu.9:(.text._ZN58_$LT$proj..proj..Proj$u20$as$u20$core..ops..drop..Drop$GT$4drop17h74f2bb9a49ff3e35E+0x25): undefined reference to `proj_area_destroy'
collect2: error: ld returned 1 exit status
error: aborting due to previous error
From research it seems this usually happens when on an old clang version due to mangling issues, but the trust_clang_mangling(false)
in build.rs
should fix that. I also made sure to update to clang 3.9. I initially experienced the error as described by #3 when installing the proj binaries through apt
-- but compiling and installing from source fixed that error, leading to where I am now.
Am.. pretty lost now. I don't know much about how linking works, but possibly interesting: in a lot of people reporting errors like this, they were able to find the .o file to check the references: here, I can't seem to find any .o file from proj. I don't know if that's related.
Any pointers greatly appreciated, thanks! ๐
It's pretty common to track a sys-crate and it's higher level bindings in a single repo.
e.g.
It's one less repo to manage and it makes it a little easier to ensure we don't break the api - e.g. we can avoid the situation where proj-sys tests pass, but proj tests using that proj-sys break.
In practice I end up doing something like this locally anyway, by modifying my local proj to use my local proj-sys, but to me it seems a little more convenient if they share a repo. And we can confer that benefit to anyone else opening a PR.
Additionally, the projects can share ci config, issue trackers, etc.
Since we're using pkg-config on macOS, and we now have an additional Linux config, we should really be testing those.
crates.io has a 10mb limit on crate sizes. Neither a shallow clone (around 37mb) or a downloaded PROJ (around 24.8 mb) will work. The only possibility I see is bundling it as a .tar.gz โ 5.3mb.
I have no idea whether anyone else has done this, though in principle, it's easy to extract a tarball.
I've cloned the repo, but running cargo build
on it produces the following output:
Compiling proj-sys v0.12.2 (/home/maxim/dev/rust/proj-sys)
error: failed to run custom build command for `proj-sys v0.12.2 (/home/maxim/dev/rust/proj-sys)`
Caused by:
process didn't exit successfully: `/home/maxim/dev/rust/proj-sys/target/debug/build/proj-sys-b67742c1a5915ba3/build-script-build` (exit code: 101)
--- stdout
cargo:rustc-link-lib=proj
cargo:warning=couldn't execute `llvm-config --prefix` (error: No such file or directory (os error 2))
cargo:warning=set the LLVM_CONFIG_PATH environment variable to a valid `llvm-config` executable
--- stderr
/usr/local/include/proj.h:120:10: fatal error: 'stddef.h' file not found
/usr/local/include/proj.h:120:10: fatal error: 'stddef.h' file not found, err: true
thread 'main' panicked at 'Unable to generate bindings: ()', src/libcore/result.rs:999:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
I'm not very familiar with the C build chains, but it seems that the stdlib header files are not located where the build system expects to find them.
My system:
I would be happy to give more details if needed.
I would like to use this rust proj bindings, with the proj lib from a conda env. My OS is Pop!_OS 19.10 and the most easy way to install the proj lib is via a conda env:
conda create --name proj7 -c conda-forge python=3 proj proj-data
However, when I try to compile it, I get the same error which is described in this issue:
wrapper.h:1:10: fatal error: 'proj.h' file not found
wrapper.h:1:10: fatal error: 'proj.h' file not found, err: true
thread 'main' panicked at 'Unable to generate bindings: ()', src/libcore/result.rs:1188:5
stack backtrace:
0: backtrace::backtrace::libunwind::trace
at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/libunwind.rs:88
1: backtrace::backtrace::trace_unsynchronized
at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/mod.rs:66
2: std::sys_common::backtrace::_print_fmt
at src/libstd/sys_common/backtrace.rs:84
3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
at src/libstd/sys_common/backtrace.rs:61
4: core::fmt::write
at src/libcore/fmt/mod.rs:1025
5: std::io::Write::write_fmt
at src/libstd/io/mod.rs:1426
6: std::sys_common::backtrace::_print
at src/libstd/sys_common/backtrace.rs:65
7: std::sys_common::backtrace::print
at src/libstd/sys_common/backtrace.rs:50
8: std::panicking::default_hook::{{closure}}
at src/libstd/panicking.rs:193
9: std::panicking::default_hook
at src/libstd/panicking.rs:210
10: std::panicking::rust_panic_with_hook
at src/libstd/panicking.rs:471
11: rust_begin_unwind
at src/libstd/panicking.rs:375
12: core::panicking::panic_fmt
at src/libcore/panicking.rs:84
13: core::result::unwrap_failed
at src/libcore/result.rs:1188
14: core::result::Result<T,E>::expect
at /rustc/f3e1a954d2ead4e2fc197c7da7d71e6c61bad196/src/libcore/result.rs:983
15: build_script_build::main
at ./build.rs:18
16: std::rt::lang_start::{{closure}}
at /rustc/f3e1a954d2ead4e2fc197c7da7d71e6c61bad196/src/libstd/rt.rs:67
17: std::rt::lang_start_internal::{{closure}}
at src/libstd/rt.rs:52
18: std::panicking::try::do_call
at src/libstd/panicking.rs:292
19: __rust_maybe_catch_panic
at src/libpanic_unwind/lib.rs:78
20: std::panicking::try
at src/libstd/panicking.rs:270
21: std::panic::catch_unwind
at src/libstd/panic.rs:394
22: std::rt::lang_start_internal
at src/libstd/rt.rs:51
23: std::rt::lang_start
at /rustc/f3e1a954d2ead4e2fc197c7da7d71e6c61bad196/src/libstd/rt.rs:67
24: main
25: __libc_start_main
26: _start
I guess the problem lies here:
Line 49 in 779703e
Would it be possible to manually tell the build script the path to the Proj Lib somehow, for e.g. by an environment variable?
With my proj conda install, the proj lib is located at: $HOME/anaconda3/envs/proj7
โฏ tree $HOME/anaconda3/envs/proj7 -L 1
/home/aaron/anaconda3/envs/proj7
โโโ bin
โโโ compiler_compat
โโโ conda-meta
โโโ etc
โโโ include
โโโ lib
โโโ sbin
โโโ share
โโโ ssl
โโโ x86_64-conda_cos6-linux-gnu
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.