Skip to content

cargo-php 0.1.21 fails to link on macOS: undefined Zend symbols (Linux-only link flag in build.rs) #773

Description

@Goopil

Hi! cargo install cargo-php (0.1.21) fails on macOS — the build script only carries the Linux link flag.

$ cargo install cargo-php
error: linking with `cc` failed: exit status: 1
  = note: Undefined symbols for architecture arm64:
            "_zend_empty_string", referenced from: _ext_php_rs_zend_string_init in …-wrapper.o
            "_zend_hash_del", …
          clang: error: linker command failed with exit code 1

macOS links executables with -undefined error by default. The Zend symbols from wrapper.o can stay unresolved: cargo-php never calls those functions (stubs generation only dlopens the extension and reads its metadata).

Workaround:

$ RUSTFLAGS="-C link-arg=-Wl,-undefined,dynamic_lookup" cargo install cargo-php

Fix is one line in crates/cli/build.rs — PR to follow.

And thanks a lot for the project, it helps a lot! 🙇

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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