Fix macOS build compatibility and compilation warnings#4
Open
rajamukerji wants to merge 9 commits intoExtraHop:masterfrom
Open
Fix macOS build compatibility and compilation warnings#4rajamukerji wants to merge 9 commits intoExtraHop:masterfrom
rajamukerji wants to merge 9 commits intoExtraHop:masterfrom
Conversation
## Changes Made ### Build System Fixes - Update macOS SDK version from 10.8 to current SDK - Fix Makefile to properly define OSXTARGET and OSXLIB variables - Use xcrun clang instead of specific SDK version ### Header Guards - Add missing header guards to gencode.h to prevent redefinition errors ### Compilation Fixes - Fix pointer sign conversion warnings in daemon.c and pcap-remote.c - Fix socklen_t type mismatch in getsockopt call - Remove tautological pointer comparisons for array variables - Fix varargs warning in rpcap_checkmsg function - Guard INT_MAX macro redefinition in inet.c ### Function Prototypes - Update deprecated K&R style function definitions to modern C prototypes - Fix functions in scanner.l, inet.c, nametoaddr.c, and bpf_image.c ### Missing Symbols - Add missing pcap_parse and pcap_strcasecmp function definitions - Include required source files (gencode.c, nametoaddr.c, etc.) in build ## Result - rpcapd now builds successfully on macOS with only legacy warnings - All functional compilation errors eliminated - Binary tested and working on macOS
Add _U_ macro definition to pcap-int.h to resolve compilation errors. The _U_ macro is used for unused variable attributes but was not defined, causing build failures on macOS.
Add platform-specific build instructions for Linux, macOS, and Windows. Include the PLATFORM=osx flag required for macOS builds.
- Add -Wno-deprecated-non-prototype to suppress K&R style function warnings - Add -Wno-return-type to suppress missing return value warnings - Add -Wl,-w to suppress linker warnings - Enables clean builds on macOS without affecting functionality
The port parameter can be NULL, so we need to check for this condition before dereferencing it to prevent potential segmentation faults.
The ctrlport parameter can be NULL, so we need to check for this condition before dereferencing it to prevent potential segmentation faults.
Remove NULL checks for array pointers in pcap-new.c and pcap-remote.c as arrays can never be NULL. This fixes compiler warnings on macOS.
- Add missing stdlib.h include in fileconf.c for atoi function - Replace _U_ macro with __attribute__((unused)) in rcsid declarations - Add missing pcap.c and savefile.c to Makefile sources - Fix sys_nerr type declaration to match system headers These fixes resolve compilation errors that prevented the build from completing successfully on macOS with modern compilers.
- Add platform detection for macOS/Darwin in Makefile - Add Solaris platform support to the Makefile - Fix yacc and lex commands to use pcap_ prefix for generated symbols - This resolves linking errors for pcap_parse, pcap_lval, and pcap_lex
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 pull request adds comprehensive macOS build support and fixes compilation warnings throughout the codebase.
Changes Made
macOS Build Support
vars.mkto remove outdated macOS SDK specificationMakefilewith proper macOS compiler flags and library pathsCompilation Fixes
_U_macro definition for macOS compatibilityCode Quality Improvements
Testing
Builds successfully on macOS with
make PLATFORM=osxafter installing libpcap via Homebrew.Files Modified
This maintains backward compatibility while enabling clean compilation on modern macOS systems.