Skip to content

Conversation

@coffeebe4code
Copy link
Contributor

@coffeebe4code coffeebe4code commented Dec 7, 2025

There are still a few outstanding issues, and I'm unsure if some of these values can be set based on the presence of a target feature or glibc version etc.

My steps for doing this was.

  1. compile libpq from source with ./configure CC='zig cc' CXX='zig c++' --with-ssl=openssl
  2. compare the tag for files needed in the Makefile for each of the 3 folders common port libpq.
  3. Update, and remove any files.
  4. compile zig version of libpq with zig build -Dssl=OpenSSL
  5. read the error output, and start adding new header values and removing the old ones not needed.
  6. set values that immediately made sense or set others to null.
  7. two issues remain related to size passed to the PG_KEYWORD macro
src/include/parser/kwlist.h:499:40: error: excess elements in array initializer 
PG_KEYWORD("whitespace", WHITESPACE_P, UNRESERVED_KEYWORD, BARE_LABEL)

src/include/parser/kwlist.h:499:60: error: excess elements in array initializer
PG_KEYWORD("whitespace", WHITESPACE_P, UNRESERVED_KEYWORD, BARE_LABEL)

UNRESERVED_KEYWORD and BARE_LABEL
These errors are left in a file provided called compile-errors.txt

I'm no expert at this stuff, and it was fun getting this far. I will need some guidance on some of the new 18_1 header defines, as well as these 2 issues.

@coffeebe4code
Copy link
Contributor Author

To keep everyone updated, if anyone is even looking at these :)

I found that I needed to copy the kwlist_d.h from postgres repo that was generated to the zig project. I now have a libpq.a that has been generated. I am now going to go through the rest of the configure variables, as they were output on the postgres repository when I ran configure. I will also do my best guess attempt for any others.

reuse previous logic to take OS into account for defines
HAVE_DECL_STRCHRNUL was renamed from HAVE_STRCHRNUL
same with DECL_MEMSET_S

Add the oauth source file, but without libcurl
@agagniere
Copy link
Member

Hi @coffeebe4code I managed to build the examples.
Can you test with your usecase ?

Also can you check if the other two headers added in this repo are up to date or also need to be replaced ?

@agagniere agagniere added the enhancement New feature or request label Dec 11, 2025
@agagniere agagniere force-pushed the master branch 3 times, most recently from c6721f3 to be5b98b Compare December 11, 2025 12:07
@coffeebe4code
Copy link
Contributor Author

Hi @coffeebe4code I managed to build the examples. Can you test with your usecase ?

Also can you check if the other two headers added in this repo are up to date or also need to be replaced ?

@agagniere
My use case was just the simple one. I just wanted to go through the exercise of learning how to do this with zig modules, and actually understand how to translate a cpp/c build process with configure and make/cmake to zig's. This was very helpful for all that.

The errcodes.h did need updating, but the other was just the preamble autotext.

@agagniere agagniere merged commit 6b76652 into allyourcodebase:master Dec 12, 2025
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants