damus-io / nostrdb

The unfairly fast embedded nostr database backed by lmdb
Other
87 stars 15 forks source link

Compiling issues on windows #28

Open yukibtc opened 3 months ago

yukibtc commented 3 months ago

Hey, I'm releasing a new version of rust-nostr and I noticed issues when compiling the python bindings for windows targets.

The following warnings were emitted during compilation:

warning: nostrdb@0.3.2: cl : Command line error D8021 : invalid numeric argument '/Wno-sign-compare'

error: failed to run custom build command for `nostrdb v0.3.2`

Caused by:
  process didn't exit successfully: `D:\a\nostr\nostr\target\release\build\nostrdb-b56ad8f182f2e273\build-script-build` (exit code: 1)
  --- stdout
  TARGET = Some("x86_64-pc-windows-msvc")
  OPT_LEVEL = Some("3")
  HOST = Some("x86_64-pc-windows-msvc")
  cargo:rerun-if-env-changed=CC_x86_64-pc-windows-msvc
  CC_x86_64-pc-windows-msvc = None
  cargo:rerun-if-env-changed=CC_x86_64_pc_windows_msvc
  CC_x86_64_pc_windows_msvc = None
  cargo:rerun-if-env-changed=HOST_CC
  HOST_CC = None
  cargo:rerun-if-env-changed=CC
  CC = None
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
  DEBUG = Some("false")
  cargo:rerun-if-env-changed=CFLAGS_x86_64-pc-windows-msvc
  CFLAGS_x86_64-pc-windows-msvc = None
  cargo:rerun-if-env-changed=CFLAGS_x86_64_pc_windows_msvc
  CFLAGS_x86_64_pc_windows_msvc = None
  cargo:rerun-if-env-changed=HOST_CFLAGS
  HOST_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None
  running: "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\VC\\Tools\\MSVC\\14.39.33519\\bin\\HostX64\\x64\\cl.exe" "-nologo" "-MD" "-O2" "-Brepro" "-I" "nostrdb/deps/lmdb" "-I" "nostrdb/deps/flatcc/include" "-I" "nostrdb/deps/secp256k1/include" "-W4" "-Wno-sign-compare" "-Wno-misleading-indentation" "-Wno-unused-function" "-Wno-unused-parameter" "-FoD:\\a\\nostr\\nostr\\target\\x86_64-pc-windows-msvc\\release\\build\\nostrdb-1b0d66dae74807a4\\out\\nostrdb/src/nostrdb.o" "-c" "nostrdb/src/nostrdb.c"
  cargo:warning=cl : Command line error D8021 : invalid numeric argument '/Wno-sign-compare'

  exit code: 2

  --- stderr

  error occurred: Command "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\VC\\Tools\\MSVC\\14.39.33519\\bin\\HostX64\\x64\\cl.exe" "-nologo" "-MD" "-O2" "-Brepro" "-I" "nostrdb/deps/lmdb" "-I" "nostrdb/deps/flatcc/include" "-I" "nostrdb/deps/secp256k1/include" "-W4" "-Wno-sign-compare" "-Wno-misleading-indentation" "-Wno-unused-function" "-Wno-unused-parameter" "-FoD:\\a\\nostr\\nostr\\target\\x86_64-pc-windows-msvc\\release\\build\\nostrdb-1b0d66dae74807a4\\out\\nostrdb/src/nostrdb.o" "-c" "nostrdb/src/nostrdb.c" with args "cl.exe" did not execute successfully (status code exit code: 2).

Here you can see the GitHub actions: https://github.com/rust-nostr/nostr/actions/runs/8663236733/job/23756949244

jb55 commented 3 months ago

going to add a cross build github action on nostrdb-rs. I see what the issue is, looks like I need a conditional compilation flag for windows.

jb55 commented 3 months ago

looks like I'll need a windows thread backend!

D:\a\nostrdb-rs\nostrdb-rs\nostrdb\src\protected_queue.h(15): fatal error C1083: Cannot open include file: 'pthread.h': No such file or directory