Skip to content

fix compilation errors on Cygwin #16568

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 1 commit into from
Closed

Conversation

matyhtf
Copy link
Contributor

@matyhtf matyhtf commented Oct 24, 2024

compilation errors when using the --enable-opcache, --disable-opcache-jit, and --enable-zts configure options on Cygwin.

The tsrm_get_ls_cache_tcb_offset function is used exclusively in JIT. When JIT is disabled, this function should also be disabled.

Error

/usr/lib/gcc/x86_64-pc-cygwin/12/../../../../x86_64-pc-cygwin/bin/ld: warning: --export-dynamic is not supported for PE+ targets, did you mean --export-all-symbols?
/usr/lib/gcc/x86_64-pc-cygwin/12/../../../../x86_64-pc-cygwin/bin/ld: TSRM/TSRM.o: in function `tsrm_get_ls_cache_tcb_offset':
/cygdrive/d/a/swoole-cli/swoole-cli/TSRM/TSRM.c:769:(.text+0xc23): undefined reference to `_tsrm_ls_cache@gottpoff'
collect2: error: ld returned 1 exit status
make: *** [Makefile:291: bin/swoole-cli] Error 1

…ache-jit --enable-zts` configure options on Cygwin
@Girgias Girgias requested a review from cmb69 November 3, 2024 13:55
Copy link
Member

@cmb69 cmb69 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't look right. A proper fix would likely be something like 4bb0dd4. Maybe

 TSRM/TSRM.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/TSRM/TSRM.c b/TSRM/TSRM.c
index 81136bee4d..e99993204b 100644
--- a/TSRM/TSRM.c
+++ b/TSRM/TSRM.c
@@ -778,7 +778,7 @@ TSRM_API size_t tsrm_get_ls_cache_tcb_offset(void)
 	return 0;
 #elif defined(__x86_64__) && defined(__GNUC__) && !defined(__FreeBSD__) && \
 	!defined(__NetBSD__) && !defined(__OpenBSD__) && !defined(__MUSL__) && \
-	!defined(__HAIKU__)
+	!defined(__HAIKU__) && !defined(__CYGWIN__)
 	size_t ret;
 
 	asm ("movq _tsrm_ls_cache@gottpoff(%%rip),%0"
@@ -786,7 +786,7 @@ TSRM_API size_t tsrm_get_ls_cache_tcb_offset(void)
 	return ret;
 #elif defined(__i386__) && defined(__GNUC__) && !defined(__FreeBSD__) && \
 	!defined(__NetBSD__) && !defined(__OpenBSD__) && !defined(__MUSL__) && \
-	!defined(__HAIKU__)
+	!defined(__HAIKU__) && !defined(__CYGWIN__)
 	size_t ret;
 
 	asm ("leal _tsrm_ls_cache@ntpoff,%0"

Note that I do not have a Cygwin environment set up.

cc @devnexen

@devnexen
Copy link
Member

devnexen commented Nov 3, 2024

@cmb69 fix looks good to me would it be possible for you to test it locally @matyhtf ?

@jingjingxyk
Copy link

  sed -i.backup 's/!defined(__HAIKU__)/!defined(__HAIKU__) \&\& !defined(__CYGWIN__)/' TSRM/TSRM.c

@cmb69
Copy link
Member

cmb69 commented Nov 24, 2024

Can anybody confirm that the patch from #16568 (review) actually works for Cygwin builds?

@devnexen
Copy link
Member

If nobody is into it, I ll try to install cygwin in my windows laptop and gives it a go tonight.

@cmb69
Copy link
Member

cmb69 commented Nov 24, 2024

See #16920. I think we can close this PR.

@cmb69
Copy link
Member

cmb69 commented Nov 24, 2024

The actual problem with this patch is that you can no longer build OPcache/JIT via phpize, because then tsrm_get_ls_cache_tcb_offset() would not be available. I'm not sure how to properly solve the build error, but I'm closing this PR in favor of #16920.

@cmb69 cmb69 closed this Nov 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants