Skip to content

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

Closed
petergeneric wants to merge 2 commits intozmwangx:masterfrom
petergeneric:master
Closed

Fix #112 (unconditional march=native causes illegal instructions when distributing binaries) by adding control over -march/-mtune compiler flags#122
petergeneric wants to merge 2 commits intozmwangx:masterfrom
petergeneric:master

Conversation

@petergeneric
Copy link
Copy Markdown

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-march-generic 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 for both (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-march-generic feature flag for portable builds. Default behaviour is preserved for backwards compatibility.

Fixes zmwangx#112
@petergeneric
Copy link
Copy Markdown
Author

Re-raised as #123 against a feature branch

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