Skip to content

embed SAPI: unable to link on Mac #8533

Closed
@dunglas

Description

@dunglas

Description

I compiled PHP with the following options:

./configure \
    --enable-zts \
    --enable-embed=shared \
    --with-iconv=/opt/homebrew/opt/libiconv/ \
    --without-pcre-jit \
    --enable-debug

When trying to link libphp.so on Mac with the following flags:

CFLAGS: -Wall -Wno-unused-variable
CFLAGS: -I/usr/local/include/php -I/usr/local/include/php/Zend -I/usr/local/include/php/TSRM -I/usr/local/include/php/main
LDFLAGS: -L/usr/local/lib -lphp

I get this error:

link: running clang failed: exit status 1
ld: can't link with bundle (MH_BUNDLE) only dylibs (MH_DYLIB) file '/usr/local/lib/libphp.so' for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

This looks related to this StackOverflow answer: https://stackoverflow.com/a/32765319/1352334

On Mac, it looks lile the -bundle flag passed to cc must be replaced by -dynamiclib.

PHP Version

PHP 8.1.5

Operating System

Mac OS X

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions