Skip to content
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

Build failure with musl 1.2.4 #1164

Closed
jefferyto opened this issue May 17, 2023 · 15 comments
Closed

Build failure with musl 1.2.4 #1164

jefferyto opened this issue May 17, 2023 · 15 comments

Comments

@jefferyto
Copy link

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?

leso-kn added a commit to leso-kn/go-sqlite3 that referenced this issue Jul 10, 2023
jefferyto added a commit to jefferyto/openwrt-packages that referenced this issue Jul 13, 2023
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 license; the project was relicensed in
3.13.0[2].

[1]: mattn/go-sqlite3#1164
[2]: ooni/probe-cli#446

Signed-off-by: Jeffery To <jeffery.to@gmail.com>
jefferyto added a commit to jefferyto/openwrt-packages that referenced this issue Jul 13, 2023
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 license; the project was relicensed in
3.13.0[2].

[1]: mattn/go-sqlite3#1164
[2]: ooni/probe-cli#446

Signed-off-by: Jeffery To <jeffery.to@gmail.com>
jefferyto added a commit to jefferyto/openwrt-packages that referenced this issue Jul 13, 2023
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_PKG to build the main binary (ooniprobe) only

* Updates the package license; the project was relicensed in 3.13.0[2]

[1]: mattn/go-sqlite3#1164
[2]: ooni/probe-cli#446

Signed-off-by: Jeffery To <jeffery.to@gmail.com>
@omerxx
Copy link

omerxx commented Jul 13, 2023

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:

replace github.com/mattn/go-sqlite3 => github.com/leso-kn/go-sqlite3 v0.0.0-20230710125852-03158dc838ed

neheb pushed a commit to openwrt/packages that referenced this issue Jul 13, 2023
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_PKG to build the main binary (ooniprobe) only

* Updates the package license; the project was relicensed in 3.13.0[2]

[1]: mattn/go-sqlite3#1164
[2]: ooni/probe-cli#446

Signed-off-by: Jeffery To <jeffery.to@gmail.com>
@nekopsykose
Copy link

nekopsykose commented Jul 14, 2023

you can use CGO_CFLAGS="-D_LARGEFILE64_SOURCE"(passed to go via environment when building) as a workaround too.

jefferyto added a commit to jefferyto/openwrt-packages that referenced this issue Jul 14, 2023
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_PKG to build the main binary (ooniprobe) only

* Updates the package license; the project was relicensed in 3.13.0[2]

[1]: mattn/go-sqlite3#1164
[2]: ooni/probe-cli#446

Signed-off-by: Jeffery To <jeffery.to@gmail.com>
(cherry picked from commit dc7382e)
leso-kn added a commit to leso-kn/go-sqlite3 that referenced this issue Jul 15, 2023
@ghost
Copy link

ghost commented Jul 16, 2023

Issue doesn't fix for me
IMG_20230716_111334_171

graysky2 pushed a commit to graysky2/packages that referenced this issue Aug 9, 2023
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_PKG to build the main binary (ooniprobe) only

* Updates the package license; the project was relicensed in 3.13.0[2]

[1]: mattn/go-sqlite3#1164
[2]: ooni/probe-cli#446

Signed-off-by: Jeffery To <jeffery.to@gmail.com>
bouncepaw added a commit to bouncepaw/betula that referenced this issue Aug 24, 2023
lu-zero pushed a commit to domo-iot/packages that referenced this issue Oct 23, 2023
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_PKG to build the main binary (ooniprobe) only

* Updates the package license; the project was relicensed in 3.13.0[2]

[1]: mattn/go-sqlite3#1164
[2]: ooni/probe-cli#446

Signed-off-by: Jeffery To <jeffery.to@gmail.com>
alfredfo added a commit to alfredfo/gentoo that referenced this issue Nov 17, 2023
See-also: mattn/go-sqlite3#1164
Closes: 912311
Signed-off-by: Alfred Persson Forsberg <cat@catcream.org>
gentoo-bot pushed a commit to gentoo/gentoo that referenced this issue Nov 17, 2023
[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 doesn't
yet in Gentoo respect CFLAGS et. al, although should soon.]

See-also: mattn/go-sqlite3#1164
Closes: https://bugs.gentoo.org/912311
Signed-off-by: Alfred Persson Forsberg <cat@catcream.org>
Closes: #33863
Signed-off-by: Sam James <sam@gentoo.org>
supakeen added a commit to supakeen/images that referenced this issue Dec 8, 2023
Switching to Fedora containers due to an updated musl in alpine causing
build errors in Go bindings to sqlite, see:
mattn/go-sqlite3#1164
supakeen added a commit to supakeen/images that referenced this issue Dec 8, 2023
Switching to Fedora containers due to an updated musl in alpine causing
build errors in Go bindings to sqlite, see:
mattn/go-sqlite3#1164
github-merge-queue bot pushed a commit to osbuild/images that referenced this issue Dec 8, 2023
Switching to Fedora containers due to an updated musl in alpine causing
build errors in Go bindings to sqlite, see:
mattn/go-sqlite3#1164
leso-kn pushed a commit to leso-kn/go-sqlite3 that referenced this issue Dec 8, 2023
leso-kn added a commit to leso-kn/go-sqlite3 that referenced this issue Dec 8, 2023
@avakarev
Copy link

avakarev commented Dec 9, 2023

This is now broken in latest go:alpine image (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 with gcc 13.2 and musl-dev 2.14 https://pkgs.alpinelinux.org/packages?name=musl-dev&branch=v3.19&repo=&arch=x86_64

As a temporary workaround, it's possible to downgrade base go image to go:alpine3.18 in Dockerfile.

\cc @mattn

jgiannuzzi pushed a commit to jgiannuzzi/go-sqlite3 that referenced this issue Jan 22, 2024
jgiannuzzi added a commit to jgiannuzzi/go-sqlite3 that referenced this issue Jan 22, 2024
2403905 pushed a commit to 2403905/ocis that referenced this issue Jan 24, 2024
dir01 added a commit to dir01/tg-podcastotron that referenced this issue Feb 16, 2024
arkon108 added a commit to AstroSynapseAI/app-service that referenced this issue Feb 22, 2024
Build was failing with an error, first line being
| sqlite3-binding.c:37644:42: error: 'pread64' undeclared
Found solution at mattn/go-sqlite3#1164
@davidindra
Copy link

I agree with @r10r, upgrading to 1.14.19 fixes the issue.

woblerr added a commit to woblerr/gpbackman that referenced this issue Feb 26, 2024
Update all dependencies.
Update github.com/mattn/go-sqlite3 to v1.14.19 for fixing mattn/go-sqlite3#1164.

Switch to alpine 1.19.
@martinrode
Copy link

This fails with alpine-3.19 too. Any attempts to fix this?

@rittneje
Copy link
Collaborator

@martinrode which version of this library are you using?

@martinrode
Copy link

@martinrode which version of this library are you using?

The latest released version v1.14.16

@rittneje
Copy link
Collaborator

@martinrode the latest release is v1.14.22

@rittneje
Copy link
Collaborator

rittneje commented Mar 3, 2024

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.)

@rittneje rittneje closed this as completed Mar 3, 2024
@martinrode
Copy link

It's fine. Works with TAG checkout v1.14.22. I checked Github Releases only and there the latest is .16.

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

No branches or pull requests