-
Notifications
You must be signed in to change notification settings - Fork 7.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
embed SAPI: unable to link on Mac #8533
Comments
I'm able to link by adding this target to the
I use the following configuration:
However, if I add the
|
Had the same issue and the target above worked for me, though I had to also specify the install name otherwise the linker kept ignoring it even when the path was explicitly set in linker flags. |
Can you tell me where you put the name? My target isn't working either |
libphp.dylib: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS)
- $(LIBTOOL) --mode=link $(CC) -dynamiclib $(LIBPHP_CFLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) -rpath $(phptempdir) $(EXTRA_LDFLAGS) $(LDFLAGS) $(PHP_RPATHS) $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS) $(EXTRA_LIBS) $(ZEND_EXTRA_LIBS) -o $@
+ $(LIBTOOL) --mode=link $(CC) -dynamiclib $(LIBPHP_CFLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) -rpath $(phptempdir) -install_name $(phptempdir)/$@ $(EXTRA_LDFLAGS) $(LDFLAGS) $(PHP_RPATHS) $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS) $(EXTRA_LIBS) $(ZEND_EXTRA_LIBS) -o $@
-@$(LIBTOOL) --silent --mode=install cp $@ $(phptempdir)/$@ >/dev/null 2>&1 This makes me able to link it, but the path seems to be hardcoded so I can't move the CFLAGS=-I/Users/samuel/php-src -I/Users/samuel/php-src/main -I/Users/samuel/php-src/TSRM -I/Users/samuel/php-src/Zend
LDFLAGS=-Wl,-rpath,/Users/samuel/php-src/libs -L/Users/samuel/php-src/libs -lphp #include <sapi/embed/php_embed.h>
int main(int argc, char **argv) {
php_embed_init(argc, argv);
zend_eval_string("echo 'Hello from PHP!\n';", NULL, "Embedded PHP code");
php_embed_shutdown();
return 0;
} |
|
I proposed a fix in this PR: #17183 |
Description
I compiled PHP with the following options:
When trying to link
libphp.so
on Mac with the following flags:I get this error:
This looks related to this StackOverflow answer: https://stackoverflow.com/a/32765319/1352334
On Mac, it looks lile the
-bundle
flag passed tocc
must be replaced by-dynamiclib
.PHP Version
PHP 8.1.5
Operating System
Mac OS X
The text was updated successfully, but these errors were encountered: