mattn / mattn/go-sqlite3

Issue with Windows Subsystem for Linux (WSL)

Open
#1,002 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
9.2k
Forks
1.2k
Avg merge
19m
Merged PRs (30d)
4

Description

Hi, during my app development I have faced with issue.
Error:

tyaonami@local:~/forum$ go run .
# forum
/home/linuxbrew/.linuxbrew/Cellar/go/1.16.5/libexec/pkg/tool/linux_amd64/link: running gcc-5 failed: exit status 1
/home/linuxbrew/.linuxbrew/bin/ld: /tmp/go-link-456674004/000010.o: in function `pthreadMutexTry':
/home/tyaonami/go/pkg/mod/github.com/mattn/go-sqlite3@v1.14.10/sqlite3-binding.c:27514: undefined reference to `pthread_mutex_trylock'
/home/linuxbrew/.linuxbrew/bin/ld: /tmp/go-link-456674004/000010.o: in function `sqlite3ThreadCreate':
/home/tyaonami/go/pkg/mod/github.com/mattn/go-sqlite3@v1.14.10/sqlite3-binding.c:31287: undefined reference to `pthread_create'
/home/linuxbrew/.linuxbrew/bin/ld: /tmp/go-link-456674004/000010.o: in function `pthreadMutexAlloc':
/home/tyaonami/go/pkg/mod/github.com/mattn/go-sqlite3@v1.14.10/sqlite3-binding.c:27369: undefined reference to `pthread_mutexattr_init'
/home/linuxbrew/.linuxbrew/bin/ld: /home/tyaonami/go/pkg/mod/github.com/mattn/go-sqlite3@v1.14.10/sqlite3-binding.c:27370: undefined reference to `pthread_mutexattr_settype'
/home/linuxbrew/.linuxbrew/bin/ld: /home/tyaonami/go/pkg/mod/github.com/mattn/go-sqlite3@v1.14.10/sqlite3-binding.c:27372: undefined reference to `pthread_mutexattr_destroy'
/home/linuxbrew/.linuxbrew/bin/ld: /tmp/go-link-456674004/000010.o: in function `sqlite3ThreadJoin':
/home/tyaonami/go/pkg/mod/github.com/mattn/go-sqlite3@v1.14.10/sqlite3-binding.c:31307: undefined reference to `pthread_join'
/home/linuxbrew/.linuxbrew/bin/ld: /tmp/go-link-456674004/000016.o: in function `_cgo_try_pthread_create':
/home/linuxbrew/.linuxbrew/Cellar/go/1.16.5/libexec/src/runtime/cgo/gcc_libinit.c:100: undefined reference to `pthread_create'
/home/linuxbrew/.linuxbrew/bin/ld: /home/linuxbrew/.linuxbrew/Cellar/go/1.16.5/libexec/src/runtime/cgo/gcc_libinit.c:102: undefined reference to `pthread_detach'
/home/linuxbrew/.linuxbrew/bin/ld: /tmp/go-link-456674004/000017.o: in function `x_cgo_init':
/home/linuxbrew/.linuxbrew/Cellar/go/1.16.5/libexec/src/runtime/cgo/gcc_linux_amd64.c:46: undefined reference to `pthread_attr_getstacksize'
/home/linuxbrew/.linuxbrew/bin/ld: /tmp/go-link-456674004/000017.o: in function `_cgo_sys_thread_start':
/home/linuxbrew/.linuxbrew/Cellar/go/1.16.5/libexec/src/runtime/cgo/gcc_linux_amd64.c:67: undefined reference to `pthread_sigmask'
/home/linuxbrew/.linuxbrew/bin/ld: /home/linuxbrew/.linuxbrew/Cellar/go/1.16.5/libexec/src/runtime/cgo/gcc_linux_amd64.c:70: undefined reference to `pthread_attr_getstacksize'
/home/linuxbrew/.linuxbrew/bin/ld: /home/linuxbrew/.linuxbrew/Cellar/go/1.16.5/libexec/src/runtime/cgo/gcc_linux_amd64.c:75: undefined reference to `pthread_sigmask'
collect2: error: ld returned 1 exit status

My code:

package main

import (
	"fmt"

	_ "github.com/mattn/go-sqlite3"
)

func main() {

	fmt.Println("Hello")
}

Go environment:

tyaonami@local:~/forum$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/tyaonami/.cache/go-build"
GOENV="/home/tyaonami/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/tyaonami/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/tyaonami/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/linuxbrew/.linuxbrew/Cellar/go/1.16.5/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/linuxbrew/.linuxbrew/Cellar/go/1.16.5/libexec/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.16.5"
GCCGO="gccgo"
AR="ar"
CC="gcc-5"
CXX="g++-5"
CGO_ENABLED="1"
GOMOD="/home/tyaonami/forum/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build3584474454=/tmp/go-build -gno-record-gcc-switches"

gcc version

tyaonami@local:~/forum$ gcc-5 --version
gcc-5 (Homebrew GCC 5.5.0_7) 5.5.0
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


tyaonami@local:~/forum$ gcc --version
gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Contributor guide

No contributing guide indexed for this repository

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

Reproduce the failure with go run . in the supplied WSL environment, then inspect the go-sqlite3 cgo build path and the configured CC=gcc-5 versus the system gcc. Done means identifying a repository-relevant resolution or documenting that the failure is caused by the external WSL toolchain configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, go, linux, sqlite
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.