tursodatabase / tursodatabase/libsql

`libsql-sys-0.8.0` compilation seems to fail for windows.

Open
#1,763 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
17.2k
Forks
531
Avg merge
1h 12m
Merged PRs (30d)
1

Description

Issue

When running test --locked --all-features --all-targets for Windows, it throws the error below.

Run cargo test --locked --all-features --all-targets
  cargo test --locked --all-features --all-targets
  shell: C:\Program Files\PowerShell\7\pwsh.EXE -command ". '{0}'"
  env:
    CARGO_HOME: C:\Users\runneradmin/.cargo
    CARGO_INCREMENTAL: 0
    CARGO_TERM_COLOR: always
    Updating crates.io index
 Downloading crates ...
  Downloaded cexpr v0.[6](https://github.com/sjunepark/bspl/actions/runs/11120249280/job/30896887671#step:5:6).0

// Omitted

error[E0433]: failed to resolve: could not find `unix` in `os`
   --> C:\Users\runneradmin/.cargo\registry\src\index.crates.io-6f17d22bba15001f\libsql-sys-0.8.0\src\connection.rs:276:26
    |
276 |             use std::os::unix::ffi::OsStrExt;
    |                          ^^^^ could not find `unix` in `os`
    |
note: found an item that was configured out
   --> /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c\library\std\src\os\mod.rs:27:9
note: the item is gated here
   --> /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c\library\std\src\os\mod.rs:19:1
note: found an item that was configured out
   --> /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c\library\std\src\os\mod.rs:65:9
note: the item is gated here
   --> /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c\library\std\src\os\mod.rs:64:1

error[E0599]: no method named `as_bytes` found for reference `&OsStr` in the current scope
   --> C:\Users\runneradmin/.cargo\registry\src\index.crates.io-6f17d22bba15001f\libsql-sys-0.8.0\src\connection.rs:277:73
    |
277 |             let path = std::ffi::CString::new(path.as_ref().as_os_str().as_bytes())
    |                                                                         ^^^^^^^^
    |
help: there is a method `as_encoded_bytes` with a similar name
    |
277 |             let path = std::ffi::CString::new(path.as_ref().as_os_str().as_encoded_bytes())
    |                                                                         ~~~~~~~~~~~~~~~~

Some errors have detailed explanations: E0433, E0599.
For more information about an error, try `rustc --explain E0433`.
error: could not compile `libsql-sys` (lib) due to 2 previous errors
warning: build failed, waiting for other jobs to finish...
Error: Process completed with exit code 1.

Context

Got the error above during github actions. Below is the github action jobs script which I ran.

  os-check:
    # run cargo test on mac and windows
    runs-on: ${{ matrix.os }}
    name: ${{ matrix.os }} / stable
    strategy:
      fail-fast: false
      matrix:
        # todo: Add "windows-latest". Currently doesn't work due to `libsql-sys`.  
        os: [ windows-latest ]
    steps:
      # if your project needs OpenSSL, uncomment this to fix Windows builds.
      # it's commented out by default as the install command takes 5-10m.
      # - run: echo "VCPKG_ROOT=$env:VCPKG_INSTALLATION_ROOT" | Out-File -FilePath $env:GITHUB_ENV -Append
      #   if: runner.os == 'Windows'
      # - run: vcpkg install openssl:x64-windows-static-md
      #   if: runner.os == 'Windows'
      - uses: actions/checkout@v4
        with:
          submodules: true
      - name: Install stable
        uses: dtolnay/rust-toolchain@stable
      - name: cargo generate-lockfile
        if: hashFiles('Cargo.lock') == ''
        run: cargo generate-lockfile
      - name: cargo test
        run: cargo test --locked --all-features --all-targets

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running cargo test --locked --all-features --all-targets on windows-latest using the workflow shown. Inspect the libsql-sys-0.8.0/src/connection.rs errors around lines 276–277 and trace how the dependency is selected; done means the Windows build completes successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system, databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.