Skip to content

[#555] fix: macos compatibility - #561

Merged
jesperpedersen merged 1 commit into
pgmoneta:mainfrom
botirkhaltaev:main
Apr 2, 2025
Merged

jesperpedersen merged 1 commit into
pgmoneta:mainfrom
botirkhaltaev:main

Conversation

@botirkhaltaev

@botirkhaltaev botirkhaltaev commented Apr 2, 2025 •

Copy link
Copy Markdown
Contributor

fixes #555

@botirkhaltaev

botirkhaltaev commented Apr 2, 2025 •

Copy link
Copy Markdown
Contributor Author

Raising draft because can't run macos ci locally to diagnose the issue.

@jesperpedersen
jesperpedersen self-requested a review April 2, 2025 10:06
@jesperpedersen jesperpedersen added the enhancement Improvement to an existing feature label Apr 2, 2025
@botirkhaltaev botirkhaltaev changed the title chore(ci): update CI workflow to include macOS build steps [#555] chore(ci): update CI workflow to include macOS build steps Apr 2, 2025
@botirkhaltaev
botirkhaltaev force-pushed the main branch 2 times, most recently from 5c89e20 to c98c41d Compare April 2, 2025 10:56
@botirkhaltaev botirkhaltaev changed the title [#555] chore(ci): update CI workflow to include macOS build steps [#555] fix: macos ci Apr 2, 2025
@botirkhaltaev botirkhaltaev changed the title [#555] fix: macos ci [#555] fix: macos compatibility Apr 2, 2025
@botirkhaltaev
botirkhaltaev force-pushed the main branch 2 times, most recently from 4faf887 to 7533410 Compare April 2, 2025 11:16
@botirkhaltaev
botirkhaltaev marked this pull request as ready for review April 2, 2025 11:16
@botirkhaltaev

botirkhaltaev commented Apr 2, 2025 •

Copy link
Copy Markdown
Contributor Author

Raising draft because can't run macos ci locally to diagnose the issue.

Unecessary files were modified as a result of uncrustify formatting so I believe I should keep those formatting changes so we can keep it consistent. Additionally macos ci passes now @jesperpedersen .

@jesperpedersen

Copy link
Copy Markdown
Member

I ran uncrustify, so you can rebase now

Comment thread src/libpgmoneta/utils.c Resolved
Comment thread src/libpgmoneta/utils.c Resolved
@botirkhaltaev

Copy link
Copy Markdown
Contributor Author

I ran uncrustify, so you can rebase now

Great rebased.

Comment thread src/libpgmoneta/utils.c Resolved
Comment thread src/libpgmoneta/utils.c Resolved
Comment thread src/libpgmoneta/utils.c Resolved
Comment thread test/testsuite.sh Resolved
@botirkhaltaev
botirkhaltaev force-pushed the main branch 2 times, most recently from b4b15ec to 6bdfaf8 Compare April 2, 2025 15:58
@jesperpedersen

Copy link
Copy Markdown
Member

Try and rebase

@botirkhaltaev

Copy link
Copy Markdown
Contributor Author

Try and rebase

Done.

@jesperpedersen

Copy link
Copy Markdown
Member

@botirk38 How is it failing ? Its C17+

@botirkhaltaev

botirkhaltaev commented Apr 2, 2025 •

Copy link
Copy Markdown
Contributor Author

@botirk38 How is it failing ? Its C17+

maybe not supported on clang macos, let me see its working locally only failing CI. I think github uses intel mac image

@jesperpedersen

Copy link
Copy Markdown
Member

Squash

@jesperpedersen

Copy link
Copy Markdown
Member

You are going up in commits... git rebase -i HEAD~3

@botirkhaltaev

Copy link
Copy Markdown
Contributor Author

You are going up in commits... git rebase -i HEAD~3

Is there a fix for this, sorry didn't see I am trying to diagnose the issue

@jesperpedersen

Copy link
Copy Markdown
Member

One PR == one commit

@botirkhaltaev

botirkhaltaev commented Apr 2, 2025 •

Copy link
Copy Markdown
Contributor Author

One PR == one commit

I will rebase when I fix is that ok? I found out github use clang15.0.0 for macos images

@jesperpedersen

Copy link
Copy Markdown
Member

@jesperpedersen

Copy link
Copy Markdown
Member

Solution ?

@botirkhaltaev

Copy link
Copy Markdown
Contributor Author

Solution ?

1 min running ci on my fork, i removed maybe unused not needed.

@jesperpedersen

Copy link
Copy Markdown
Member

Absolutely not - you are breaking FreeBSD

@jesperpedersen

Copy link
Copy Markdown
Member

Create Rocky Linux 9 and FreeBSD 14.2 VMs and do testing there as well

@jesperpedersen

Copy link
Copy Markdown
Member

Is there a way to upgrade clang on runs-on: macos-latest ?

@jesperpedersen

Copy link
Copy Markdown
Member

@Mohab96 Cc:

@botirkhaltaev
botirkhaltaev force-pushed the main branch 2 times, most recently from 464440b to 65d36aa Compare April 2, 2025 19:50
@Mohab96

Mohab96 commented Apr 2, 2025

Copy link
Copy Markdown
Collaborator

@Mohab96 Cc:

?

@botirkhaltaev
botirkhaltaev force-pushed the main branch 2 times, most recently from 075e5af to a8a9c22 Compare April 2, 2025 20:15
@botirkhaltaev

botirkhaltaev commented Apr 2, 2025 •

Copy link
Copy Markdown
Contributor Author

@Mohab96 Cc:

can we use attribute(unused) its widely supported as well also GCC is a symlink to clang on macos, that is stupid,

MacOS clang doesn't support [[maybe]], that's why clang builds because I symlinked clang to homebrew installation from llvm while gcc is symlinked to MacOS clang, what should be my approach @jesperpedersen.

I think the best solution is something like below

#ifdef HAVE_DARWIN
#define MAYBE __attribute__(unused)
#elif HAVE_BSD || HAVE_LINUX
#define MAYBE [[maybe]]

@jesperpedersen

Copy link
Copy Markdown
Member

Yes, you can change it if it works better on Mac

- Refactor macOS build workflow for better readability
- Consolidate dependency installation and use environment variables
- Update shell execution from /bin/sh to bash for compatibility
- Improve code readability in utils.c and remove unnecessary blank lines
- Enhance testsuite.sh with platform-independent functions and better error handling
- Add PostgreSQL dependency checks to ensure proper test setup

refactor(utils.c): remove conditional compilation for Linux and improve format specifiers for better portability and readability

chore(testsuite.sh): refactor comments and formatting for improved readability and consistency in the test suite script

style(testsuite.sh): format code for better readability and consistency by adjusting indentation and spacing throughout the script

style(testsuite.sh): format shell script for consistent indentation and spacing to improve readability

build(CMake): set CMAKE_C_FLAGS to use GNU17 standard for C compilation to ensure compatibility with modern C features

fix(CMakeLists.txt): change C standard from gnu17 to gnu11 to ensure compatibility with older compilers

chore(ci): format YAML file for consistency and readability by adjusting indentation and removing unnecessary spaces
feat(ci): add step to check compiler version to ensure the correct version is used during the CI process

chore(ci): specify compiler commands in CI workflow for clarity and consistency

build(CMakeLists.txt): update CMake configuration to use C standard gnu17 and suppress C++11 extension warnings for better compatibility

feat(CMakeLists.txt): remove unnecessary CFLAGS for gnu17 and C++11 extensions to simplify build configuration
feat(security.c): implement ARM-specific CRC32C calculation function for improved performance on aarch64 architecture

chore(utils.c): remove unused attribute [[maybe_unused]] from calculate_offset function to clean up code

refactor(security.c): remove unused pgmoneta_crc32c_arm function to clean up code
refactor(utils.c): add [[maybe_unused]] attribute to unused functions and improve snprintf format specifiers for better compatibility

build(CMake): add compiler flags to suppress warnings for C++17 extensions on macOS to ensure compatibility with older codebases

chore(ci): add LLVM to PATH in CI workflow to ensure proper build environment

fix(CMakeLists.txt): update CMAKE_C_FLAGS to use gnu-11 standard for better compatibility with C++ features

chore(ci): remove LLVM from PATH setup in CI workflow to streamline environment configuration

style(security.c, utils.c): replace [[maybe_unused]] with __attribute__((unused)) for better compatibility with compilers

chore(CMakeLists.txt): remove deprecated CMAKE_C_FLAGS for gnu-11 to clean up the build configuration

chore(ci): remove compiler version check step to streamline CI workflow

chore(ci): clean up CI workflow by removing GCC build steps and using xcrun to find clang

This change simplifies the CI process by focusing on Clang for builds and tests, improving maintainability and reducing complexity.
@botirkhaltaev

Copy link
Copy Markdown
Contributor Author

Yes, you can change it if it works better on Mac

Done.

@jesperpedersen
jesperpedersen merged commit 4a68c70 into pgmoneta:main Apr 2, 2025
@jesperpedersen

Copy link
Copy Markdown
Member

Merged.

Thanks for your contribution !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Improvement to an existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add MacOS Compatibility tracking

4 participants