smarco / WFA2-lib

WFA-lib: Wavefront alignment algorithm library v2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Problem getting rust bindings to build

wdecoster opened this issue · comments

Hi,

I'm trying to use the rust bindings in a rust project, but fail to build it. I think I may have to tag @RagnarGrootKoerkamp here?

It is the very first time that I do something like this, so I don't really know where to start debugging this. I am developing in WSL.

So I cloned the repository and ran

git clone https://github.com/smarco/WFA2-lib
cd WFA2-lib
mkdir build
cmake .. -DCMAKE_BUILD_TYPE=Release
cmake --build . --verbose
ctest . --verbose

make
make lib_wfa

I've added bindgen to the build dependencies and the build.rs file in the src directory of my rust project, adapting the paths from wfa2 to WFA2-lib to match the repository name.

Building seems to find the files, but then runs into the error below:

$ cargo build
   Compiling STRdust v0.1.0 (/home/wdecoster/wsl-repos/STRdust)
error: failed to run custom build command for `STRdust v0.1.0 (/home/wdecoster/wsl-repos/STRdust)`

Caused by:
  process didn't exit successfully: `/home/wdecoster/wsl-repos/STRdust/target/debug/build/STRdust-52f9cedab0223029/build-script-build` (exit status: 101)
  --- stdout
  cargo:rustc-link-search=../WFA2-lib/lib
  cargo:rustc-link-lib=wfa
  cargo:rustc-link-lib=omp
  cargo:rerun-if-changed=../WFA2-lib/lib/libwfa.a

  --- stderr
  ../WFA2-lib/utils/heatmap.h:86:5: error: unknown type name 'FILE'
  ../WFA2-lib/system/profiler_counter.h:40:3: error: unknown type name 'uint64_t'
  ../WFA2-lib/system/profiler_counter.h:41:3: error: unknown type name 'uint64_t'
  ../WFA2-lib/system/profiler_counter.h:42:3: error: unknown type name 'uint64_t'
  ../WFA2-lib/system/profiler_counter.h:43:3: error: unknown type name 'uint64_t'
  ../WFA2-lib/system/profiler_counter.h:54:11: error: unknown type name 'uint64_t'
  ../WFA2-lib/system/profiler_counter.h:56:1: error: unknown type name 'uint64_t'
  ../WFA2-lib/system/profiler_counter.h:57:1: error: unknown type name 'uint64_t'
  ../WFA2-lib/system/profiler_counter.h:58:1: error: unknown type name 'uint64_t'
  ../WFA2-lib/system/profiler_counter.h:59:1: error: unknown type name 'uint64_t'
  ../WFA2-lib/system/profiler_counter.h:69:5: error: unknown type name 'FILE'
  ../WFA2-lib/system/profiler_counter.h:73:11: error: unknown type name 'bool'
  ../WFA2-lib/system/profiler_counter.h:75:5: error: unknown type name 'FILE'
  ../WFA2-lib/system/profiler_counter.h:83:3: error: unknown type name 'uint64_t'
  ../WFA2-lib/system/profiler_counter.h:85:3: error: unknown type name 'uint64_t'
  ../WFA2-lib/system/profiler_counter.h:90:11: error: unknown type name 'uint64_t'
  ../WFA2-lib/system/profiler_counter.h:93:11: error: unknown type name 'uint64_t'
  ../WFA2-lib/system/profiler_counter.h:96:11: error: unknown type name 'uint64_t'
  ../WFA2-lib/system/profiler_counter.h:99:11: error: unknown type name 'uint64_t'
  fatal error: too many errors emitted, stopping now [-ferror-limit=]
  thread 'main' panicked at 'Unable to generate bindings: ClangDiagnostic("../WFA2-lib/utils/heatmap.h:86:5: error: unknown type name 'FILE'\n../WFA2-lib/system/profiler_counter.h:40:3: error: unknown type name 'uint64_t'\n../WFA2-lib/system/profiler_counter.h:41:3: error: unknown type name 'uint64_t'\n../WFA2-lib/system/profiler_counter.h:42:3: error: unknown type name 'uint64_t'\n../WFA2-lib/system/profiler_counter.h:43:3: error: unknown type name 'uint64_t'\n../WFA2-lib/system/profiler_counter.h:54:11: error: unknown type name 'uint64_t'\n../WFA2-lib/system/profiler_counter.h:56:1: error: unknown type name 'uint64_t'\n../WFA2-lib/system/profiler_counter.h:57:1: error: unknown type name 'uint64_t'\n../WFA2-lib/system/profiler_counter.h:58:1: error: unknown type name 'uint64_t'\n../WFA2-lib/system/profiler_counter.h:59:1: error: unknown type name 'uint64_t'\n../WFA2-lib/system/profiler_counter.h:69:5: error: unknown type name 'FILE'\n../WFA2-lib/system/profiler_counter.h:73:11: error: unknown type name 'bool'\n../WFA2-lib/system/profiler_counter.h:75:5: error: unknown type name 'FILE'\n../WFA2-lib/system/profiler_counter.h:83:3: error: unknown type name 'uint64_t'\n../WFA2-lib/system/profiler_counter.h:85:3: error: unknown type name 'uint64_t'\n../WFA2-lib/system/profiler_counter.h:90:11: error: unknown type name 'uint64_t'\n../WFA2-lib/system/profiler_counter.h:93:11: error: unknown type name 'uint64_t'\n../WFA2-lib/system/profiler_counter.h:96:11: error: unknown type name 'uint64_t'\n../WFA2-lib/system/profiler_counter.h:99:11: error: unknown type name 'uint64_t'\nfatal error: too many errors emitted, stopping now [-ferror-limit=]\n")', src/build.rs:54:10
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

What can I do to debug the issue here? Or is there an obvious thing I did wrong?

Thanks!

Are you using the bindings i added? In that case I'd recommend looking at https://github.com/pairwise-alignment/rust-wfa2 instead. This bindings I originally generated here were my first time doing that and other people have made much better bindings that compile standalone and should build without issues.

(But your problem looks more WSL specific so it may not actually fix anything.)

Yes I am using https://github.com/smarco/WFA2-lib/blob/main/bindings/rust/build.rs, but thank you for the other suggestion. I will try those then :-)
Could you get me started in using those? Do I use them in the same way as the bindings here?

Thank you! I will see if I can figure it out, and open an issue in the appropriate repository if I need further help.