Skip to content

Cross compile from macos m1 to x86_64-unknown-linux-gnu - error: unable to find libraries. #141

@andrew-rj

Description

@andrew-rj

Hello! Thank you for building this tool. I've found it immensely useful in simplifying my workflow.

I am having some trouble cross-compiling an application for x86_64-unknown-linux-gnu or x86_64-unknown-linux-musl from a Mac m1. The application I'm trying to cross-compile has dependencies for libpcap and libhwloc when being compiled for linux. This is the error that I'm getting:

error: linking with `/Users/andrew/Library/Caches/cargo-zigbuild/0.16.10/zigcc-x86_64-unknown-linux-gnu.sh` failed: exit status: 1
...
  = note: ld.lld: error: unable to find library -lpcap
          ld.lld: error: unable to find library -lhwloc

I'm trying to build with this command:

cargo zigbuild --target x86_64-unknown-linux-gnu

I have hwloc and libpcap installed via homebrew on my Mac, but I think that this is looking for the linux libraries, and I don't think those are anywhere for zigbuild to use. Is there a way to resolve dependencies like this for zigbuild? I'm sorry if I am just oblivious to this.

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