Fix Lua Module Build For MacOS Compatibility#3123
Merged
Merged
Conversation
The Lua module build configuration has been updated to support macOS in addition to Linux. Two key changes were made to resolve build issues on Apple platforms. First, the valkeylua shared library now explicitly includes `sha1.c` and `rand.c` source files and links against the fpconv library, ensuring all required symbols are available at link time. Second, the --disable-new-dtags linker flag is now conditionally applied only on Unix systems excluding macOS, since this flag is not supported by the Apple linker. In addition, enable position independent code compilation for the fpconv static library by setting the `POSITION_INDEPENDENT_CODE` property. This allows the library to be linked into shared libraries and position-independent executables. Last, the Lua library filename definition was previously hardcoded to use the `.so` extension for all platforms. This change conditionally sets the library name based on the target platform: `.so` for Linux/Unix systems and `.dylib` for macOS (and other non-Linux Unix systems). This ensures that the correct dynamic library extension is used when loading the Lua module at runtime. ** Generated by CodeLite. ** Signed-off-by: Eran Ifrah <eifrah@amazon.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## unstable #3123 +/- ##
============================================
- Coverage 74.87% 74.68% -0.20%
============================================
Files 129 129
Lines 71199 71199
============================================
- Hits 53310 53172 -138
- Misses 17889 18027 +138 🚀 New features to boost your workflow:
|
Contributor
|
Is this build tested in our workflows? I assume not, since they were passing before this fix |
rjd15372
approved these changes
Jan 29, 2026
rjd15372
left a comment
Member
There was a problem hiding this comment.
Thanks for fixing this in CMake
Member
Yeah, we currently only test the makefile build in macos on our workflows. |
harrylin98
pushed a commit
to harrylin98/valkey_forked
that referenced
this pull request
Feb 19, 2026
This PR fixes various issues with Lua module built on macOS using CMake / Apple Clang. ## Summary of changes The Lua module build configuration has been updated to support macOS in addition to Linux. Two key changes were made to resolve build issues on Apple platforms. First, the valkeylua shared library now explicitly includes `sha1.c` and `rand.c` source files and links against the fpconv library, ensuring all required symbols are available at link time. Second, the --disable-new-dtags linker flag is now conditionally applied only on Unix systems excluding macOS, since this flag is not supported by the Apple linker. In addition, enable position independent code compilation for the fpconv static library by setting the `POSITION_INDEPENDENT_CODE` property. This allows the library to be linked into shared libraries and position-independent executables. Last, the Lua library filename definition was previously hardcoded to use the `.so` extension for all platforms. This change conditionally sets the library name based on the target platform: `.so` for Linux/Unix systems and `.dylib` for macOS (and other non-Linux Unix systems). This ensures that the correct dynamic library extension is used when loading the Lua module at runtime. ** Generated by CodeLite. ** Signed-off-by: Eran Ifrah <eifrah@amazon.com>
hpatro
pushed a commit
to hpatro/valkey
that referenced
this pull request
Mar 5, 2026
This PR fixes various issues with Lua module built on macOS using CMake / Apple Clang. ## Summary of changes The Lua module build configuration has been updated to support macOS in addition to Linux. Two key changes were made to resolve build issues on Apple platforms. First, the valkeylua shared library now explicitly includes `sha1.c` and `rand.c` source files and links against the fpconv library, ensuring all required symbols are available at link time. Second, the --disable-new-dtags linker flag is now conditionally applied only on Unix systems excluding macOS, since this flag is not supported by the Apple linker. In addition, enable position independent code compilation for the fpconv static library by setting the `POSITION_INDEPENDENT_CODE` property. This allows the library to be linked into shared libraries and position-independent executables. Last, the Lua library filename definition was previously hardcoded to use the `.so` extension for all platforms. This change conditionally sets the library name based on the target platform: `.so` for Linux/Unix systems and `.dylib` for macOS (and other non-Linux Unix systems). This ensures that the correct dynamic library extension is used when loading the Lua module at runtime. ** Generated by CodeLite. ** Signed-off-by: Eran Ifrah <eifrah@amazon.com> Signed-off-by: Harkrishn Patro <bunty.hari@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes various issues with Lua module built on macOS using CMake / Apple Clang.
Summary of changes
The Lua module build configuration has been updated to support macOS in addition to Linux. Two key changes were made to resolve build issues on Apple platforms.
First, the valkeylua shared library now explicitly includes
sha1.candrand.csource files and links against the fpconv library, ensuring all required symbols are available at link time.Second, the --disable-new-dtags linker flag is now conditionally applied only on Unix systems excluding macOS, since this flag is not supported by the Apple linker.
In addition, enable position independent code compilation for the fpconv static library by setting the
POSITION_INDEPENDENT_CODEproperty. This allows the library to be linked into shared libraries and position-independent executables.Last, the Lua library filename definition was previously hardcoded to use the
.soextension for all platforms. This change conditionally sets the library name based on the target platform:.sofor Linux/Unix systems and.dylibfor macOS (and other non-Linux Unix systems). This ensures that the correct dynamic library extension is used when loading the Lua module at runtime.** Generated by CodeLite. **