Skip to content

install.sh: fix native builds and libpcap detection on macOS - #48

Open
psycep wants to merge 1 commit into
mainfrom
fix-macos-install
Open

psycep wants to merge 1 commit into
mainfrom
fix-macos-install

Conversation

@psycep

@psycep psycep commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes native builds and installation on macOS (Intel and Apple Silicon):

  • Guard -static-libgcc to Linux native builds: Apple's clang linker rejects -static-libgcc (clang: error: unsupported option '-static-libgcc'), causing all 63 tools to fail to link on macOS.
  • Detect macOS SDK and keg-only Homebrew libpcap headers: Modern macOS ships pcap.h inside the Command Line Tools SDK (xcrun --show-sdk-path), and Homebrew marks libpcap as keg-only (/opt/homebrew/opt/libpcap/include/pcap.h on Apple Silicon, /usr/local/opt/libpcap/include/pcap.h on Intel). Probing these paths prevents sniff and split from being falsely skipped on macOS.
  • Create INSTALL_DIR if missing & add xcode-select hint: Fresh Apple Silicon macOS systems often do not have /usr/local/bin created yet; install_native now ensures INSTALL_DIR exists via mkdir -p before copying binaries.

Thanks to @m57 for identifying and fixing the -static-libgcc linker failure in #44!

Supersedes #44.

Running ./install.sh on macOS (Intel and Apple Silicon) hit several
platform issues in the native build and install path:

1. build_target unconditionally passed -extldflags "-static-libgcc"
   for native builds. That is a GNU/GCC linker flag; Apple's clang
   rejects it with "unsupported option '-static-libgcc'", failing all
   63 tool builds. Guard the flag with [ "$(uname -s)" = "Linux" ].
2. The libpcap header check only probed /usr/include and
   /opt/homebrew/include. Modern macOS (10.14+) places system headers
   inside the Command Line Tools SDK (xcrun --show-sdk-path), and
   Homebrew installs libpcap as keg-only under
   /opt/homebrew/opt/libpcap/include (Apple Silicon) or
   /usr/local/opt/libpcap/include (Intel), causing sniff and split to
   be falsely skipped on macOS.
3. Fresh Apple Silicon macOS installs often do not have /usr/local/bin
   created yet; ensure install_native runs mkdir -p on INSTALL_DIR
   before copying binaries, and mention xcode-select --install in the
   compiler check hint.

Thanks to @m57 for reporting and fixing the -static-libgcc linker
issue in #44.
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.

1 participant