Skip to content

Fix build for MacOS#508

Open
artemgavrilov wants to merge 8 commits intomainfrom
macos
Open

Fix build for MacOS#508
artemgavrilov wants to merge 8 commits intomainfrom
macos

Conversation

@artemgavrilov
Copy link
Collaborator

@artemgavrilov artemgavrilov commented Jan 30, 2026

Changes made:

  1. Forward linker/compiler flags from global makefile
  2. Fix tmp filesystem location for archive/resotre commands on MacOS
  3. Fix existing CI scripts to support MacOS
  4. Setup dedicated CI workflow
  5. Add MacOS specific output for key provider test

@codecov-commenter
Copy link

codecov-commenter commented Jan 30, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 59.70%. Comparing base (25c83a9) to head (eafb20f).

❌ Your project status has failed because the head coverage (59.70%) is below the target coverage (90.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #508   +/-   ##
=======================================
  Coverage   59.70%   59.70%           
=======================================
  Files          67       67           
  Lines       10487    10487           
  Branches     1803     1803           
=======================================
  Hits         6261     6261           
  Misses       3531     3531           
  Partials      695      695           
Components Coverage Δ
access 84.89% <ø> (ø)
catalog 87.93% <ø> (ø)
common 77.77% <ø> (ø)
encryption 71.56% <ø> (ø)
keyring 74.00% <ø> (ø)
src 94.20% <ø> (ø)
smgr 94.06% <ø> (ø)
transam ∅ <ø> (∅)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@artemgavrilov artemgavrilov force-pushed the macos branch 2 times, most recently from 00ebb28 to d549677 Compare February 2, 2026 18:17
@artemgavrilov artemgavrilov marked this pull request as ready for review February 2, 2026 20:19
Comment on lines +13 to +15
#ifdef __APPLE__
#define TMPFS_DIRECTORY "/tmp"
#else
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thing to discuss: It seems that we should check this in runtime, as /dev/shm may be unavailable in some linux distros.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I am not sure about what we should do here.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One option would be to make it a CLI argument. The issue is that there is no standardized location for temporary files on UNIX which is guaranteed to be in-momory.

build:
name: Build
runs-on: ${{ inputs.os }}
timeout-minutes: 10
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this necessary? The commit message should tell us why or a comment should.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a good practice. During debug I faced hanged tests that consumed a lot of CI time, so timeout here is just a fuse.

name: Test PSP with TDE enabled by default
runs-on: ${{ inputs.os }}
needs: build
timeout-minutes: 30
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow ... this is a long timeout.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some reason tests much slower on MacOS, I assume because of different hardware.

if [[ "$OSTYPE" == "linux-gnu"* ]]; then
ARGS+=" --with-liburing"
NCPU=$(nproc)
elif [[ "$OSTYPE" == "darwin"* ]]; then
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be explained in a comment, or commit message. I assume this is because Mac's version of make does not support automatic selection of worker pool.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure that GNU Make has auto selection as well, at least they don't mention this in docs: https://www.gnu.org/software/make/manual/make.html

Comment on lines +13 to +15
#ifdef __APPLE__
#define TMPFS_DIRECTORY "/tmp"
#else
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I am not sure about what we should do here.

SHLIB_LINK = -lcurl -lcrypto -lssl
LDFLAGS_EX = -Lsrc/fe_utils -lcurl -lcrypto -lssl -lz -lzstd -llz4 -lpgfeutils $(libpq_pgport)
SHLIB_LINK += -lcurl -lcrypto -lssl
LDFLAGS_EX += -Lsrc/fe_utils -lcurl -lcrypto -lssl -lz -lzstd -llz4 -lpgfeutils $(libpq_pgport)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These things were intentional, but it is possible that I was wrong. So can you explain in a commit message why this change was necessary?

Copy link
Collaborator Author

@artemgavrilov artemgavrilov Feb 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added. Long story short for MacOS extension built as a bundle and linker expects --bundle-loader flag that specifies executable that will load bundle to check symbols against it. Global makefile provides this flag and as I understood it's expected that flags from global makefile are forwarded to extension.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW macos problem was cause just by SHLIB_LINK, so I can limit change only with this varable. But what was the reason to not forward flags from global makefile?

Global makefile provides system spevific falgs. For example for MacOS it
provides -bundle_loader flag for linker that speicfies executable that
will load an extension. Without that flag linker fails as it cannot
check defined symbols.
The liburing in linux specific library, so include it only for linux
tartget builds.
Without such limit make will spawn as much jobs as possible. It can harm
perfomance and hit proccess number limit in CI environment.
MacOS by default goes with bash 3.x while -v supported since version 4.2.
MacOS doesn't have /dev/shm, so fallback to /tmp instead.
MacOS has different error message for write attempt without permission.
While linux says "Permission denied", MacOS says "Read-only file
system".
Setup build and test CI workflows for MacOS. These workflows are needed
only to be sure that this project builds/works in development
environments. So we can omit different build variations.
Reasonable timeouts help to save CI time when some steps hung.
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

Successfully merging this pull request may close these issues.

3 participants