pganalyze / pg_query_go

Go library to parse and normalize SQL queries using the PostgreSQL query parser
BSD 3-Clause "New" or "Revised" License
663 stars 79 forks source link

WIndows compilation from linux #44

Closed mixmind closed 3 years ago

mixmind commented 3 years ago

Hi,

I'm trying to use this library and compile it to windows from Ubuntu 20. When I'm compiling it I have an error: # github.com/pganalyze/pg_query_go/v2/parser In file included from ../../go/pkg/mod/github.com/pganalyze/pg_query_go/v2@v2.0.2/parser/include/c.h:1318, from ../../go/pkg/mod/github.com/pganalyze/pg_query_go/v2@v2.0.2/parser/include/postgres.h:46, from pg_query_internal.h:4, from pg_query.c:2: ../../go/pkg/mod/github.com/pganalyze/pg_query_go/v2@v2.0.2/parser/include/port.h:17:10: fatal error: netdb.h: No such file or directory 17 | #include <netdb.h> | ^~~~~~~~~

Compile command for example: CGO_ENABLED=1 GOOS=windows GOARCH=amd64 CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ go build -o /bin/file ./cmd/file

From some google search i found that it's talking about that file that already exists: ls -l /usr/include/rpc/netdb.h -rw-r--r-- 1 root root 2897 Dec 16 2020 /usr/include/rpc/netdb.h

What I'm doing wrong? Please help

lfittl commented 3 years ago

@mixmind Thanks for reaching out!

Windows is currently not supported for pg_query, which is why you are getting this error.

The parent issue tracking this is https://github.com/pganalyze/libpg_query/issues/44 -- note that there are no immediate plans to add this support, but feel free to subscribe to that issue for updates.

lfittl commented 3 years ago

Closing this per the earlier comment - please track the libpg_query issue for updates.