libH3 link error on Windows

I am trying to connect to the uber H3 library with the help of libh3 crate. The repo of the libh3-sys crate, where libh3 is dependent on, describes what to do:

When I mimic those steps I end up with a link error:

...
liblibh3-9ade3a037fdaca75.rlib(libh3-9ade3a037fdaca75.libh3.5b304504-cgu.2.rcgu.o) : error LNK2019: unresolved external symbol h3ToParent referenced in function _ZN5libh312h3_to_parent17h9ca0f64a9b59992aE
          liblibh3-9ade3a037fdaca75.rlib(libh3-9ade3a037fdaca75.libh3.5b304504-cgu.2.rcgu.o) : error LNK2019: unresolved external symbol h3ToChildren referenced in function _ZN5libh314h3_to_children17h1227ce6880900681E
          liblibh3-9ade3a037fdaca75.rlib(libh3-9ade3a037fdaca75.libh3.5b304504-cgu.2.rcgu.o) : error LNK2019: unresolved external symbol res0IndexCount referenced in function _ZN5libh317res_0_index_count17hd4f2fceeecf27663E
          liblibh3-9ade3a037fdaca75.rlib(libh3-9ade3a037fdaca75.libh3.5b304504-cgu.2.rcgu.o) : error LNK2019: unresolved external symbol getRes0Indexes referenced in function _ZN5libh317get_res_0_indexes17hb1ab29e946bfd9acE
          C:\dev\heated_hex_server\target\release\deps\heated_hex_server.exe : fatal error LNK1120: 25 unresolved externals

The steps are:

  • get the uber h3 repo from github
  • make a build.rs
use cmake::Config;

fn main() {
    let build_type = if cfg!(debug_assertions) {
        "Debug"
    } else {
        "Release"
    };

    let dst = Config::new("deps/h3")
        .define("BUILD_TESTING", "OFF")
        .define("BUILD_GENERATORS", "OFF")
        .define("BUILD_BENCHMARKS", "OFF")
        .define("BUILD_FILTERS", "OFF")
        .define("ENABLE_LINTING", "OFF")
        .define("ENABLE_DOCS", "OFF")
        .define("ENABLE_COVERAGE", "OFF")
        .define("BUILD_TYPE", build_type)
        .build();
    println!("cargo:rustc-link-search=native={}/lib", dst.display());
    println!("cargo:cargo:include={}/include", dst.display());
    println!("cargo:rustc-link-lib=static=h3");
}
  • adjust the cargo.toml with a build dependency for cmake
[build-dependencies]
cmake = "0.1"

Any suggestions on how to proceed?

Versioning + backwards compatibility trouble. For example the 3.x function is named h3ToChildren. The new name is cellToChildren.

You need a newer rcgu thing or an older H3 library.

Wow, really, interesting :slight_smile:
I missed this option completly but it make sense
thnx!

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.