Skip to content

Fix #112 (unconditional march=native causes illegal instructions when distributing binaries) by adding control over -march/-mtune compiler flags#123

Open
petergeneric wants to merge 1 commit intozmwangx:masterfrom
petergeneric:build-march-generic
Open

Fix #112 (unconditional march=native causes illegal instructions when distributing binaries) by adding control over -march/-mtune compiler flags#123
petergeneric wants to merge 1 commit intozmwangx:masterfrom
petergeneric:build-march-generic

Conversation

@petergeneric
Copy link

@petergeneric petergeneric commented Feb 18, 2026

build.rs currently unconditionally adds -march=native -mtune=native which breaks for CI systems, since the FFmpeg build is tuned for the CI runner's CPU capabilities, which are often more advanced than the target systems.

I've added the build-portable feature flag, and updated the unconditional logic as follows:

  1. FFMPEG_MARCH / FFMPEG_MTUNE env vars (highest priority) — use their values; empty string omits the corresponding flag
  2. build-march-generic feature — omits both flags entirely for a portable build
  3. Default — uses native (backward compatible - I don't think native should be the default, but backwards compatibility seems preferable...)

This would fix #112

…l -march=native -mtune=native with configurable options to prevent crashes when deploying to machines with different CPU capabilities than the build host.

Add FFMPEG_MARCH/FFMPEG_MTUNE env vars (highest priority) and build-portable feature flag for portable builds. Default behaviour is preserved for backwards compatibility.

Fixes zmwangx#112
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.

Overly aggressive compilation paramters can produce IllegalInstruction seg fault

1 participant