bux
bux

Reputation: 7739

Compile Rust application for Windows with cross and sqlite3 dependecy

I'm trying to compile my Rust application for Windows with cross. I got this error :

   Compiling trsync v0.1.3 (/project)
error: linking with `x86_64-w64-mingw32-gcc` failed: exit status: 1
  |
  = note: "x86_64-w64-mingw32-gcc" "-fno-use-linker-plugin" "-Wl,--dynamicbase" "-Wl,--disable-auto-image-base" "-m64" "-Wl,--high-entropy-va" "/rust/lib/rustlib/x86_64-pc-windows-gnu/lib/rsbegin.o" "/target/x86_64-pc-windows-gnu/debug/deps/trsync-36594acb4f0db109.trsync.69d5ec1a-cgu.0.rcgu.o" [...] "-Wl,--gc-sections" "-no-pie" "-nodefaultlibs" "/rust/lib/rustlib/x86_64-pc-windows-gnu/lib/rsend.o"
  = note: /usr/bin/x86_64-w64-mingw32-ld: cannot find -lsqlite3
          collect2: error: ld returned 1 exit status
          

error: could not compile `trsync` due to previous error

How to compile my application for Windows with cross ?

Upvotes: 1

Views: 907

Answers (1)

Netwave
Netwave

Reputation: 42708

It is because it is not bundled by default with rusqlite. You could enable bundled through a feature gate. You will need to add this to your Cargo.toml file.

[features]
windows = ["rusqlite/bundled"]

or by linking to winsqlite3

[features]
windows = ["rusqlite/winsqlite3"]

Then when cross-compiling enable that feature in windows. Using the command line options

cross build --target x86_64-pc-windows-gnu --features windows

Upvotes: 2

Related Questions