Skip to content

filesearch: building with media on macOS - #50

Merged
djthorpe merged 1 commit into
masterfrom
djt/1118/filesearch-media-macos
Nov 18, 2026
Merged

djthorpe merged 1 commit into
masterfrom
djt/1118/filesearch-media-macos

Conversation

@djthorpe

@djthorpe djthorpe commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

CGO_ENABLED=1 go install -tags media …/filesearch/cmd/filesearch@latest, and make filesearch MEDIA=1, failed on macOS with Homebrew's libraries.

  • FFmpeg wasn't found: Homebrew doesn't link ffmpeg@8 into its prefix, as it's a versioned formula, so pkg-config can't find libavcodec and the rest.
  • LibRaw's flags were rejected: Homebrew's LibRaw is built with OpenMP, and cgo rejects its -Xpreprocessor flag unless it's allowed.
  • Makefile: on macOS it adds $(brew --prefix ffmpeg@8)/lib/pkgconfig to PKG_CONFIG_PATH when it's installed, allows -Xpreprocessor, and quiets the linker's warning about duplicate libraries, as go-metadata's Makefile does.
  • README: the brew install and the two exports for go install, with why each is needed.

Tested: go install … -tags media of v1.0.1, with the exports, which reads videos' titles with FFmpeg, and make filesearch MEDIA=1 from an empty build cache, which failed (Package 'libswscale' not found) before the change. It only seemed to work before because the build cache held a build from earlier.

…s, in the Makefile and README

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings November 18, 2026 14:51
@github-actions

Copy link
Copy Markdown

Coverage for this change: 90.6%

@djthorpe djthorpe self-assigned this Nov 18, 2026
@djthorpe
djthorpe merged commit 3d69df2 into master Nov 18, 2026
3 checks passed
@djthorpe
djthorpe deleted the djt/1118/filesearch-media-macos branch November 18, 2026 14:54

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The global linker flag breaks older Apple linkers and macOS-to-Linux cross-builds, while Homebrew path injection can override configured or cross-target libraries.

4 open issues
What changed in this PR

Updates media-enabled filesearch builds to accommodate Homebrew’s native libraries on macOS.

Changes:

  • Adds automatic discovery of Homebrew’s keg-only FFmpeg 8.
  • Allows LibRaw’s cgo flags and suppresses duplicate-library linker warnings on macOS.
  • Documents Homebrew dependencies and environment settings for direct go install usage.
File Description
Makefile Configures FFmpeg discovery, cgo flag allowances, and macOS linker warning suppression.
filesearch/​README.md Adds Homebrew installation instructions and explains the required environment settings.

Review effort: Balanced

Comment thread Makefile
ifneq ($(BREW_FFMPEG),)
export PKG_CONFIG_PATH := $(BREW_FFMPEG)$(if $(PKG_CONFIG_PATH),:$(PKG_CONFIG_PATH))
endif
export CGO_LDFLAGS += -Wl,-no_warn_duplicate_libraries
Comment thread Makefile
# On macOS, Homebrew's ffmpeg@8, which is keg-only, so isn't found otherwise,
# when it's installed. The linker warns about the libraries which more than
# one of the C libraries link, which isn't a problem.
ifeq ($(OS),darwin)
Comment thread Makefile
BREW ?= $(shell command -v brew 2>/dev/null)
BREW_FFMPEG := $(if $(BREW),$(wildcard $(shell $(BREW) --prefix ffmpeg@8 2>/dev/null)/lib/pkgconfig))
ifneq ($(BREW_FFMPEG),)
export PKG_CONFIG_PATH := $(BREW_FFMPEG)$(if $(PKG_CONFIG_PATH),:$(PKG_CONFIG_PATH))
Comment thread filesearch/README.md
This needs go-metadata's C libraries: FFmpeg 8, libexif, libheif and LibRaw. On macOS, with Homebrew:

```bash
brew install ffmpeg@8 libexif libheif libraw
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.

2 participants