Skip to content

Fix ZTS build for Alpine (musl libc) #8180

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

Closed
wants to merge 2 commits into from

Conversation

mvorisek
Copy link
Contributor

@mvorisek mvorisek commented Mar 7, 2022

fix #8160

credits go to @cmb69, thanks!

discussion 804420b#r68129969

@cmb69 cmb69 linked an issue Mar 7, 2022 that may be closed by this pull request
@mvorisek
Copy link
Contributor Author

mvorisek commented Mar 7, 2022

@cmb69 please see the 2nd commit

it seems the JIT/ASM code use _tsrm_ls_cache: initial-exec even initial-exec string is not directly mentioned as after the 1st commit, I was still getting:

 Warning: Failed loading Zend extension 'opcache.so' (tried: /usr/local/lib/php/extensions/no-debug-zts-20210902/opcache.so (Error relocating /usr/local/lib/php/extensions/no-debug-zts-20210902/opcache.so: _tsrm_ls_cache: initial-exec TLS resolves to dynamic definition in /usr/local/lib/php/extensions/no-debug-zts-20210902/opcache.so), /usr/local/lib/php/extensions/no-debug-zts-20210902/opcache.so.so (Error loading shared library /usr/local/lib/php/extensions/no-debug-zts-20210902/opcache.so.so: No such file or directory)) in Unknown on line 0

the 2nd commit fixes the ZTS build issues on Alpine, however if such fix is correct (I am not quite sure), then the condition must be exactly the same in all places which is not the case, compare:

#if !__has_attribute(tls_model) || defined(__FreeBSD__) || defined(__MUSL__) || defined(__HAIKU__)

and
#elif defined(__x86_64__) && defined(__GNUC__) && !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__MUSL__)

and
#if defined(__has_attribute) && __has_attribute(tls_model) && !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__MUSL__)

@mvorisek mvorisek marked this pull request as ready for review March 7, 2022 13:21
@mvorisek
Copy link
Contributor Author

mvorisek commented Mar 7, 2022

@dstogov, you are the author of TSRM/JIT code, can you please review this PR?

@mvorisek
Copy link
Contributor Author

mvorisek commented Mar 8, 2022

based on docker-library/php#1076 (comment) comment, this patch is tested to be working on Alpine/musl

@dstogov
Copy link
Member

dstogov commented Mar 11, 2022

Looks good. Please merge.

@cmb69 cmb69 closed this in 2b2aeb9 Mar 11, 2022
@mvorisek mvorisek deleted the fix_musl_define branch March 11, 2022 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ZTS support on Alpine is broken
2 participants