go-sqlite3: Build failure with musl 1.2.4
OpenWrt updated musl to 1.2.4 and we are seeing this build failure with ooni/probe-cli (which uses go-sqlite3):
sqlite3-binding.c:35911:42: error: 'pread64' undeclared here (not in a function); did you mean 'pread'?
35911 | { "pread64", (sqlite3_syscall_ptr)pread64, 0 },
| ^~~~~~~
| pread
sqlite3-binding.c:35929:42: error: 'pwrite64' undeclared here (not in a function); did you mean 'pwrite'?
35929 | { "pwrite64", (sqlite3_syscall_ptr)pwrite64, 0 },
| ^~~~~~~~
| pwrite
sqlite3-binding.c: In function 'seekAndRead':
sqlite3-binding.c:35915:49: error: unknown type name 'off64_t'; did you mean 'off_t'?
35915 | #define osPread64 ((ssize_t(*)(int,void*,size_t,off64_t))aSyscall[10].pCurrent)
| ^~~~~~~
sqlite3-binding.c:38777:11: note: in expansion of macro 'osPread64'
38777 | got = osPread64(id->h, pBuf, cnt, offset);
| ^~~~~~~~~
sqlite3-binding.c:35915:58: error: expected ')' before 'aSyscall'
35915 | #define osPread64 ((ssize_t(*)(int,void*,size_t,off64_t))aSyscall[10].pCurrent)
| ~ ^~~~~~~~
sqlite3-binding.c:38777:11: note: in expansion of macro 'osPread64'
38777 | got = osPread64(id->h, pBuf, cnt, offset);
| ^~~~~~~~~
sqlite3-binding.c: In function 'seekAndWriteFd':
sqlite3-binding.c:35933:57: error: unknown type name 'off64_t'; did you mean 'off_t'?
35933 | #define osPwrite64 ((ssize_t(*)(int,const void*,size_t,off64_t))\
| ^~~~~~~
sqlite3-binding.c:38906:17: note: in expansion of macro 'osPwrite64'
38906 | do{ rc = (int)osPwrite64(fd, pBuf, nBuf, iOff);}while( rc<0 && errno==EINTR);
| ^~~~~~~~~~
sqlite3-binding.c:35934:21: error: expected ')' before 'aSyscall'
35934 | aSyscall[13].pCurrent)
| ^~~~~~~~
sqlite3-binding.c:38906:17: note: in expansion of macro 'osPwrite64'
38906 | do{ rc = (int)osPwrite64(fd, pBuf, nBuf, iOff);}while( rc<0 && errno==EINTR);
| ^~~~~~~~~~
sqlite3-binding.c:35933:21: note: to match this '('
35933 | #define osPwrite64 ((ssize_t(*)(int,const void*,size_t,off64_t))\
| ^
sqlite3-binding.c:38906:17: note: in expansion of macro 'osPwrite64'
38906 | do{ rc = (int)osPwrite64(fd, pBuf, nBuf, iOff);}while( rc<0 && errno==EINTR);
| ^~~~~~~~~~
(This is from a PR for the current version of probe-cli which uses 1.14.16; we are also seeing very similar errors when building an older version of probe-cli which uses 1.14.15.)
This is because in musl 1.2.4, LFS64 interfaces were marked as deprecated (release notes, commit).
Perhaps HAVE_PREAD/HAVE_PWRITE can be set instead of HAVE_PREAD64/HAVE_PWRITE64 in sqlite3.go?
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 12
- Comments: 17 (1 by maintainers)
Commits related to this issue
- ooniprobe: Update to 3.18.0 This version includes support for Go 1.20 (specifically 1.20.5), and a workaround for musl 1.2.4 compatibility in mattn/go-sqlite3[1]. This also updates the package licen... — committed to jefferyto/openwrt-packages by jefferyto 3 years ago
- ooniprobe: Update to 3.18.0 This version includes support for Go 1.20 (specifically 1.20.5), and a workaround for musl 1.2.4 compatibility in mattn/go-sqlite3[1]. This also updates the package licen... — committed to jefferyto/openwrt-packages by jefferyto 3 years ago
- ooniprobe: Update to 3.18.0 This version includes support for Go 1.20 (specifically 1.20.5). This also: * Adds a workaround for musl 1.2.4 compatibility in mattn/go-sqlite3[1] * Sets GO_PKG_BUILD_... — committed to jefferyto/openwrt-packages by jefferyto 3 years ago
- ooniprobe: Update to 3.18.0 This version includes support for Go 1.20 (specifically 1.20.5). This also: * Adds a workaround for musl 1.2.4 compatibility in mattn/go-sqlite3[1] * Sets GO_PKG_BUILD_... — committed to openwrt/packages by jefferyto 3 years ago
- ooniprobe: Update to 3.18.0 This version includes support for Go 1.20 (specifically 1.20.5). This also: * Adds a workaround for musl 1.2.4 compatibility in mattn/go-sqlite3[1] * Sets GO_PKG_BUILD_... — committed to jefferyto/openwrt-packages by jefferyto 3 years ago
- ooniprobe: Update to 3.18.0 This version includes support for Go 1.20 (specifically 1.20.5). This also: * Adds a workaround for musl 1.2.4 compatibility in mattn/go-sqlite3[1] * Sets GO_PKG_BUILD_... — committed to graysky2/packages by jefferyto 3 years ago
- Experiment no. 7: Use Psykose's magic tricks See: https://github.com/mattn/go-sqlite3/issues/1164#issuecomment-1635253695 — committed to bouncepaw/betula by bouncepaw 3 years ago
- ooniprobe: Update to 3.18.0 This version includes support for Go 1.20 (specifically 1.20.5). This also: * Adds a workaround for musl 1.2.4 compatibility in mattn/go-sqlite3[1] * Sets GO_PKG_BUILD_... — committed to domo-iot/packages by jefferyto 3 years ago
- net-irc/soju: pass -D_LARGEFILE64_SOURCE for musl-1.2.4 See-also: https://github.com/mattn/go-sqlite3/issues/1164 Closes: 912311 Signed-off-by: Alfred Persson Forsberg <cat@catcream.org> — committed to alfredfo/gentoo by alfredfo 3 years ago
- net-irc/soju: pass -D_LARGEFILE64_SOURCE for musl-1.2.4 [sam: The macro is not ideal at all but patching Go isn't exactly ideal itself. Besides, this was arleady in the ebuild, but ignored b/c Go doe... — committed to gentoo/gentoo by alfredfo 3 years ago
- ci: switch to fedora container(s) Switching to Fedora containers due to an updated musl in alpine causing build errors in Go bindings to sqlite, see: https://github.com/mattn/go-sqlite3/issues/1164 — committed to supakeen/images by supakeen 3 years ago
- ci: switch to fedora container(s) Switching to Fedora containers due to an updated musl in alpine causing build errors in Go bindings to sqlite, see: https://github.com/mattn/go-sqlite3/issues/1164 — committed to supakeen/images by supakeen 3 years ago
- ci: switch to fedora container(s) Switching to Fedora containers due to an updated musl in alpine causing build errors in Go bindings to sqlite, see: https://github.com/mattn/go-sqlite3/issues/1164 — committed to osbuild/images by supakeen 3 years ago
- [BUG] Fix go build due to sqlite dependency (#1486) ## Description of changes *Summarize the changes made by this PR.* - Improvements & Bug fixes - Fix go build issue due to https://github.com... — committed to chroma-core/chroma by Ishiihara 3 years ago
- fix: change docker image to golang:1.20-alpine3.17 ref: https://github.com/mattn/go-sqlite3/issues/1164 — committed to sttnbnb/kenkoukun by shmn7iii 3 years ago
- fix(docker): fix sqlite3 musl build https://github.com/mattn/go-sqlite3/issues/1164 https://github.com/mattn/go-sqlite3/pull/1177 — committed to sentriz/gonic by sentriz 3 years ago
- Pin golang image for builder. Pin alpine 3.18. See See https://github.com/mattn/go-sqlite3/issues/1164#issuecomment-1848677118. — committed to woblerr/gpbackman by woblerr 3 years ago
- Fix build docker with sqlite3 musl error This is now broken in latest `golang:alpine` image (from alpine3.18 to alpine3.19). Alpine 3.19 was released on 2023-12-07. [^1] It is shipped with gcc 13.2 a... — committed to Pengxn/go-xn by huiyifyj 3 years ago
- :art: Build failure with musl 1.2.4 https://github.com/mattn/go-sqlite3/issues/1164 — committed to 88250/go-sqlite3 by 88250 3 years ago
- Pin cfssl build to alpine 3.18 It can't be built with later versions of alpine. More accurately, its dependency on https://github.com/mattn/go-sqlite3 cannot be built. See: https://github.com/mattn/g... — committed to conjurdemos/conjur-intro by micahlee 3 years ago
you can use
CGO_CFLAGS="-D_LARGEFILE64_SOURCE"(passed togovia environment when building) as a workaround too.This is now broken in latest
go:alpineimage (1.21.5-alpine3.19). Alpine 3.19 was released on 2023-12-07: https://www.alpinelinux.org/posts/Alpine-3.19.0-released.html It is shipped withgcc13.2 andmusl-dev2.14 https://pkgs.alpinelinux.org/packages?name=musl-dev&branch=v3.19&repo=&arch=x86_64As a temporary workaround, it’s possible to downgrade base go image to
go:alpine3.18in Dockerfile.\cc @mattn
Not sure how come this isn’t extremely urgent to users out there but the #1177 save me. So for what it’s worth I added this to my
go.mod:If anyone is still looking for solution, this worked for me:
This worked for me
Closing because this issue is resolved in v1.14.19. If you are still experiencing this issue, please first confirm you are using at least that version. (The GitHub releases page does not consider tags and thus is out of date.)
@mattn Can this be closed because the fix is included in v1.14.19 ?
I can successfully build on alpine with musl 1.2.4 after upgrading