Closed svmrw closed 1 year ago
Okay that's pretty weird. A PECL package is just a XML manifest file + source code bundled into a compressed file format. Not sure why "building via pecl
doesn't work but phpize
does" since both tools should be doing approximately the same thing. Creating an extension is a slightly different process from deploying an extension, which can produce some strange bugs, but both of those tools (pecl and phpize) are deployment tools.
The -lrt
option is complicated. I'm not sure how to programmatically determine when it is or is not needed in the config.m4
. Maybe I can find another config file that handles it differently for different scenarios. Editing the extension's config.m4
file is probably better than editing the generated ./configure
file. Not that you should have to edit anything in the first place - just pointing out that the -lrt
option is probably easier to remove from the config.m4
file instead.
Seems like this is an exclusively Mac OSX problem. I'll dig my Mac OSX hardware out of storage and see if I can figure out what's going on.
That's right, phpize gave exactly the same errors as pecl. The point is that I wrote what I could do. I don't understand the syntax and features of the "C" language. First I tried installing with pecl, then with phpize - nothing worked. Then I started looking at what errors it gives, "shm_open() is not available on this platform" was the most noticeable, it was displayed immediately in the console. It was displayed by pecl and the ./configure command. Searching for this error turned up nothing for me. Then I saw the config.log file in the source folder (I attached it just in case), I found the following line there:
configure:4521: cc -o conftest -g -O2 conftest.c -pthread -lrt >&5
ld: library not found for -lrt
Started googling, found this thread.
Looking through the changes, I tried to remove this line from ./configure, repeated the command and it worked.
I don't know what I did right and what was wrong. Again, I don't understand the "C" language and its peculiarities. Tried what I could. If you need to test something, then I can help you with this.
on Windows PHP 8.2.6 x64 Non Thread Safe got some startup error:
Warning: PHP Startup: sync: Unable to initialize module
Module compiled with module API=20210902
PHP compiled with module API=20220829
These options need to match
in Unknown on line 0
classes aren't there:
Class "SyncEvent" not found
PHP 8.1.20 x64 Non Thread Safe - is fine
@determin1st Your issue/comment is unrelated to this issue. The automated PECL Windows DLL build system has been down since at least October of last year. PHP extensions have to be compiled for specific PHP versions or they won't load due to ABI/API compatibility issues. As a result, PECL Windows DLLs for PHP 8.2 are not available for ANY extension from the PECL website (i.e. not just this extension).
I started researching possible solutions to this issue last week and have a couple of options but haven't gotten further than that due to being busy on other projects. I'll get this on my priority list to address it this week.
I have a working fix for the problem but have discovered two new issues in the process.
All known issues fixed and a package has been released (v1.1.3). It could take up to a few hours to be deployed globally via PECL. You should be able to use 'pecl install sync' as usual to install on Mac OSX.
The underlying issue was that some (common) platforms require '-lrt' when specifying '-pthread' while others do not. The config.m4
file defines platform detection for the build. I added a fallback when the combination fails to just try '-pthread' by itself. That should, in theory, work on more systems than before. I've confirmed that the sync extension now builds cleanly on my Mac OSX hardware.
I'm going to close this issue as complete at this time. If you encounter any further difficulties, the issue can be reopened again.
Details here: https://stackoverflow.com/questions/63940828/sync-extension-php-shm-open-is-not-available-on-this-platform