Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building on Windows machine fails for sqlite3-parser #43

Closed
gokkep opened this issue Aug 24, 2023 · 5 comments · Fixed by #58
Closed

Building on Windows machine fails for sqlite3-parser #43

gokkep opened this issue Aug 24, 2023 · 5 comments · Fixed by #58

Comments

@gokkep
Copy link

gokkep commented Aug 24, 2023

To learn using Rust with a focus on web and SQLite, we have created a working solution based on actix-web and turso using this library.
The project was created on a macOS machine and is running fine there.
Me, building it on a Windows machine fails and really have no clue how to solve the issue.

I get the following error:

error: failed to run custom build command for sqlite3-parser v0.8.0

Caused by:
process didn't exit successfully: C:\Users\gokkep\projects\rust\tursotest\target\debug\build\sqlite3-parser-9f9fcbb7d7225a5f\build-script-build (exit code: 101)
--- stdout
OPT_LEVEL = Some("1")
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("true")
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

I attached the used toml file and lock file

Cargo.zip

@samishoux
Copy link

I can also confirm that I have this issue

@gokkep
Copy link
Author

gokkep commented Aug 27, 2023

I just looked at the GitHub repo of sqlite3-parser and found the author fixed building issues on Windows since release 0.9.0 (the latest version is 0.10.0). I can see since 0.9.0 the GitHub action added the Windows built and test and succeeds.
The current toml uses 0.8.0, so I suppose this needs to be updated. Is it enough to update the toml file of my own project or does the update to this other version be implemented in the toml (https://github.com/libsql/libsql-client-rs/blob/main/Cargo.toml).
Can someone please advise me here?

@gokkep
Copy link
Author

gokkep commented Aug 29, 2023

I pursued this issue myself. I did found that the cargo.toml file of this library has to depend on at least version 0.9.0 of the sqlite3-parser rust library. I noticed @samishoux did fork this library and had made that particular change.

So I added the following line to the cargo.toml file of my project:
libsql-client = { git = "https://github.com/samishoux/libsql-client-rs" }

After that my project could build, but could not link, with the following error:
LINK : fatal error LNK1181: cannot open input file 'sqlite3.lib'

To solve this latest issue, I installed the sqlite3 package through vcpkg, with the following command inside my vcpkg environment:
.\vcpkg.exe install --triplet=x64-windows-static-md sqlite3, this installs package sqlite3 for Windows x64 environment and will be statically linked against the generated binary executable. See Explanation different vcpkg targets.

I saw that this library has an outstanding PR, which also updates the dependency of sqlite3-parser to a version that will build on Windows.

Could someone please update this, so I can use this repo again?

For me this issue can be closed when the toml file is updated.

@mnpqraven
Copy link

I've had the same errors as @gokkep has experienced, but for me vcpkg is not putting the lib file into the correct folder and the linking error persists.

In case anyone has the same error as mine, what I did was copy the sqlite3.lib from vcpkg's installation folder

\vcpkg\installed\x64-windows-static-md\lib

directly to microsoft visual studio's path e.g.:
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\lib\x64 (you can get this path from the error message when running/building with cargo)

@chrissuozzo
Copy link
Contributor

I've also experienced this issue, but the solution(s) proposed by @gokkep and @mnpqraven have my project building & linking now 🙌🎉, thanks guys!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants