Skip to content

FFmpeg build with Zig on macOS 15.2 (M1, aarch64) crashes on execution #20

Open
@7phs

Description

@7phs

I am building FFmpeg with Zig on macOS 15.2 (M1, aarch64) using Zig version 0.14.0-dev.3012 (but I also tried with earlier versions of Zig).

I fixed compilation errors and created a PR with the fixes: PR #19.

There are still linking errors related to Video4Linux (v4l2), such as:

error: undefined symbol: _ff_h263_v4l2m2m_decoder
    note: referenced by /Users/a/projects/zig/7phs/ffmpeg/.zig-cache/o/471050c645269de17013a79fb70abb5d/libffmpeg.a(allcodecs.o):_codec_list
error: undefined symbol: _ff_h263_v4l2m2m_encoder
    note: referenced by /Users/a/projects/zig/7phs/ffmpeg/.zig-cache/o/471050c645269de17013a79fb70abb5d/libffmpeg.a(allcodecs.o):_codec_list

I resolved these by filtering out the codecs during the build: Commit c809de8.

With this fix, the build completes without errors.

However, when I try to run the compiled executable (e.g., show_metadata_zig or show_metadata_c), it crashes with the following log:

{
    "value": 6484581168,
    "symbolLocation": 408,
    "symbol": "dyld3::MachOAnalyzer::forEachRebase_Opcodes(Diagnostics&, dyld3::MachOLoaded::LinkEditInfo const&, dyld3::MachOFile::SegmentInfo const*, void (char const*, dyld3::MachOLoaded::LinkEditInfo const&, dyld3::MachOFile::SegmentInfo const*, bool, unsigned int, unsigned char, unsigned long long, dyld3::MachOAnalyzer::Rebase, bool&) block_pointer) const"
},
{
    "value": 6484581020,
    "symbolLocation": 260,
    "symbol": "dyld3::MachOAnalyzer::forEachRebase_Opcodes(Diagnostics&, dyld3::MachOLoaded::LinkEditInfo const&, dyld3::MachOFile::SegmentInfo const*, void (char const*, dyld3::MachOLoaded::LinkEditInfo const&, dyld3::MachOFile::SegmentInfo const*, bool, unsigned int, unsigned char, unsigned long long, dyld3::MachOAnalyzer::Rebase, bool&) block_pointer) const"
},
{
    "value": 0
},
{
    "sourceLine": 399,
    "value": 4341349760,
    "sourceFile": "h264idct_neon.S",
    "symbol": "ff_h264_idct8_add4_neon",
    "symbolLocation": 96
},
{
    "value": 4353990968,
    "symbolLocation": 0,
    "symbol": "scan8"
},
...
"esr": {
    "value": 2449473615,
    "description": "(Data Abort) byte write Permission fault"
},

I tried different versions of Zig, but the result is always the same.

Do you have any insights into the cause of this crash?
Do you know how to debug such an issue?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions