Looking for a seasoned C++/Linux developer to help me fix a bug in a PHP extension (.so).
The bug manifests itself as the following error message when the PHP interpreter is started:
free(): invalid pointer
Aborted (core dumped)
This only happens in the presence of other extensions, e.g. php-intl. With just my extension alone, PHP runs fine.
My extension is linked together with libgcc (using -static-libgcc). This is done so that the same binary (.so) can work on many Linux variants/versions. On the flip side of this, it seems that some libgcc symbols get duplicated when the .so is dynamically linked with PHP and other extensions. My guess is that the heap is also duplicated, resulting in the error message above.
I tried adding -fvisibility=hidden to every gcc call in the build scripts in the hopes to stop libgcc symbols from being exported from my shared library. That had no effect. Perhaphs I am missing something. Your help would be greatly appreciated.