Skip to content

Fix libsql-ffi build on Windows #2005

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

Merged
merged 1 commit into from
Apr 17, 2025
Merged

Conversation

allan2
Copy link
Contributor

@allan2 allan2 commented Mar 27, 2025

libsql-ffi build on Windows has been intermittently broken for a while due build.rs calling cp which is not present on Windows.

Timeline:

This commit fixes a bug introduced by da54c1b. Command::status()? was propogating the error so the fallback, fs::copy, was never reached. This is now fixed so libsql-ffi builds again on Windows.

Closes #1657

libsql-ffi build on Windows has been intermittently broken for a while due _build.rs_ calling `cp` which is not present on Windows.

Timeline:
- 2024-08-10: Issue tursodatabase#1657 was opened.
- 2024-11-14: tursodatabase#1791 was merged. First fix using `#[cfg(windows)]`.
- 2024-11-15: tursodatabase#1791 reverted in 9499c3c for breaking libsql-js on macOS.
- 2024-12-04: 9499c3c was reverted since tursodatabase#1791 was fine and did not cause the macOS problem. Windows build works again.
- 2025-03-17: da54c1b breaks Windows build.
- 2025-03-21: 0.9.1 is released with broken Windows build.
- 2025-03-27: This commit fixes the bug introduced in da54c1b.

This commit fixes a bug introduced by da54c1b. `Command::status()?` was propogating the error so the fallback, `fs::copy`, was never reached.
This is now fixed so libsql-ffi builds again on Windows.

Closes tursodatabase#1657
@allan2
Copy link
Contributor Author

allan2 commented Apr 9, 2025

I've rebased on main branch, rev 483a150. Please take a look if you have time :)

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (2)

libsql-ffi/build.rs:79

  • Switching from using the '?' operator to a match statement now correctly prevents early error propagation from the 'cp' command, ensuring the fallback is executed. Consider adding a brief comment to clarify this handling for future maintainers.
match Command::new("cp")

libsql-ffi/build.rs:88

  • The conditional fallback using 'io::ErrorKind::InvalidInput' might be too narrow. Verify that this condition reliably indicates a directory copy, or consider broadening the error matching to better cover other possible error kinds for non-file sources.
Err(err) if err.kind() == io::ErrorKind::InvalidInput => copy_dir_all(from, to),

@avinassh avinassh added this pull request to the merge queue Apr 17, 2025
@avinassh
Copy link
Member

Thanks for the patch @allan2!

Merged via the queue into tursodatabase:main with commit 1e0ce80 Apr 17, 2025
19 checks passed
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 this pull request may close these issues.

libsql-ffi build failed on Windows
3 participants