sqlc icon indicating copy to clipboard operation
sqlc copied to clipboard

`libwinpthread-1.dll` was not found

Open coolaj86 opened this issue 1 year ago • 7 comments

Version

1.27.0

What happened?

Running on Windows I get the libwinpthread-1.dll error. From a brief search it looks like it might be due to not having statically linked against mingw libc?

Relevant log output

Windows dialog box pops up with:

> sqlc.exe - System Error
> 
> The code execution cannot proceed because libwinpthread-1.dll was not found.
> Reinstalling the program may fix this problem.
>
> [OK]

Database schema

N/A

SQL queries

N/A

Configuration

N/A

Playground URL

No response

What operating system are you using?

Windows

What database engines are you using?

PostgreSQL

What type of code are you generating?

Go

coolaj86 avatar Sep 17 '24 05:09 coolaj86

I'm also experiencing this problem. (Windows 10 Pro | 64-bit)

petdomaa100 avatar Dec 12 '24 17:12 petdomaa100

Experiencing the same thing on Windows 11 Pro

rayakame avatar Mar 25 '25 13:03 rayakame

I encountered the same issue. The installation guide also states that only a single file is needed. I will try static compilation to see if the problem is caused by inconsistent environments. system by windows 11 24H2

2938915974 avatar May 11 '25 16:05 2938915974

I encountered the same issue. The installation guide also states that only a single file is needed. I will try static compilation to see if the problem is caused by inconsistent environments. system by windows 11 24H2

I cloned and downloaded the code, changed only the Go version to 1.24.3 to keep it consistent, and then manually compiled the program. The compiled program can be opened, but I am not sure yet if this will affect any functionality. Below is the command I used for compilation:

Environment: Windows 11 24H2, PowerShell Build command: cmd /c "set CGO_ENABLED=0&& set GOOS=windows&& set GOARCH=amd64&& go build -trimpath -ldflags=\"-s -w\"" -o sqlc.exe ./cmd/sqlc

2938915974 avatar May 12 '25 12:05 2938915974

Can people try out this build? I used Windows Server 2025, which may fix things?

sqlc_1.29.0_windows_amd64.tar.gz sqlc_1.29.0_windows_amd64.zip

kyleconroy avatar May 13 '25 19:05 kyleconroy

On Windows Server 2019 Standard Evaluation Version 1809 it still throws the same error.

rayakame avatar May 13 '25 20:05 rayakame

Can people try out this build? I used Windows Server 2025, which may fix things?

sqlc_1.29.0_windows_amd64.tar.gz sqlc_1.29.0_windows_amd64.zip

I tried using the version you compiled, but the same issue still occurs on both my Windows Server 2025 and Windows 11 24H2 devices. Since Git on my device is not linked to GitHub, I packaged my local code and the compiled binary file and uploaded them to the Releases section of one of my empty projects. In theory, the only change I made should be to the go.mod file.

https://github.com/2938915974/desktop-tutorial/releases/download/my-sqlc-compile/sqlc-mycompile-main_src.zip https://github.com/2938915974/desktop-tutorial/releases/download/my-sqlc-compile/sqlc_1.29.0_mycompile_windows_amd64.zip

2938915974 avatar May 14 '25 05:05 2938915974

@2938915974 I am running into this issue currently and was trying to download your new compiled binary, but the link is dead. Any chance you could provide it again?

Rlowenstein1 avatar Jun 17 '25 20:06 Rlowenstein1

I've recompiled without using cgo which may fix the issue. Can you try these?

  • https://downloads.sqlc.dev/prerelease/sqlc_1.29.0_windows_arm64.zip
  • https://downloads.sqlc.dev/prerelease/sqlc_1.29.0_windows_amd64.zip

kyleconroy avatar Aug 02 '25 23:08 kyleconroy

I've recompiled without using cgo which may fix the issue. Can you try these?

  • https://downloads.sqlc.dev/prerelease/sqlc_1.29.0_windows_arm64.zip
  • https://downloads.sqlc.dev/prerelease/sqlc_1.29.0_windows_amd64.zip

Yes, it can start normally now! This may be due to the fact that the Postgres dependency, pg_query_go, invokes the Windows library libwinpthread-1.dll. Although the application is able to start properly after disabling CGO, I am not yet certain whether this will cause any issues with Postgres.

2938915974 avatar Aug 04 '25 02:08 2938915974

When cgo is disabled, we use wazero to execute the parser instead. Everything should work 100%

kyleconroy avatar Aug 04 '25 02:08 kyleconroy

When cgo is disabled, we use wazero to execute the parser instead. Everything should work 100%

kyleconroy avatar Aug 04 '25 02:08 kyleconroy

Fixed in v1.30.0

kyleconroy avatar Sep 01 '25 23:09 kyleconroy