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 appears to fail with glibc 2.38 #95

Closed
mvdan opened this issue Aug 3, 2023 · 2 comments
Closed

build appears to fail with glibc 2.38 #95

mvdan opened this issue Aug 3, 2023 · 2 comments

Comments

@mvdan
Copy link

mvdan commented Aug 3, 2023

I build this library via https://github.com/sqlc-dev/sqlc, and recently it's started failing the C build:

$ pacman -Q glibc
glibc 2.38-1
$ go version
go version go1.20.7 linux/amd64
$ go install github.com/sqlc-dev/sqlc/cmd/[email protected]
# github.com/pganalyze/pg_query_go/v4/parser
src_port_snprintf.c:374:1: error: conflicting types for ‘strchrnul’; have ‘const char *(const char *, int)’
  374 | strchrnul(const char *s, int c)
      | ^~~~~~~~~
In file included from /home/mvdan/go/pkg/mod/github.com/pganalyze/pg_query_go/[email protected]/parser/include/c.h:61,
                 from src_port_snprintf.c:62:
/usr/include/string.h:286:14: note: previous declaration of ‘strchrnul’ with type ‘char *(const char *, int)’
  286 | extern char *strchrnul (const char *__s, int __c)
      |              ^~~~~~~~~
cc1: note: unrecognized command-line option ‘-Wno-unknown-warning-option’ may have been intended to silence earlier diagnostics
cc1: note: unrecognized command-line option ‘-Wno-deprecated-non-prototype’ may have been intended to silence earlier diagnostics

I think the cause here is that Arch Linux recently updated from glibc 2.37 to 2.38, so the header at /usr/include/string.h likely changed considerably.

@lfittl
Copy link
Member

lfittl commented Aug 4, 2023

@mvdan Thanks for the report, tracking this in the core library as pganalyze/libpg_query#202

@msepga
Copy link
Contributor

msepga commented Aug 4, 2023

This should be patched now in #96. Released as tag v4.2.3, thanks for the report!

@msepga msepga closed this as completed Aug 4, 2023
oschwald added a commit to oschwald/sqlvet that referenced this issue May 30, 2024
4.2.0 does not work with newer glibc versions, including the version in
Ubuntu 24.04. The problem was fixed in
pganalyze/pg_query_go#95. Rather than just
upgrading to 4.2.3, I thought it would make sense to switch to v5 for
Postgres 16 support.
houqp pushed a commit to houqp/sqlvet that referenced this issue Jun 3, 2024
* Upgrade to pg_query_go v5

4.2.0 does not work with newer glibc versions, including the version in
Ubuntu 24.04. The problem was fixed in
pganalyze/pg_query_go#95. Rather than just
upgrading to 4.2.3, I thought it would make sense to switch to v5 for
Postgres 16 support.

* Update other dependencies

* Compare error strings instead of the full error

The parsing errors have significantly more state now and comparing the whole error is fragile.
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

3 participants