-
-
Notifications
You must be signed in to change notification settings - Fork 243
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
Compilation errors due to pthread stuff #1047
Comments
Hi, I currently never tried to compile on FreeBSD, so there might be many issues like that. I would likely merge patch fixing them! |
OK. I'm a bit occupied, so I'm afraid I don't have much time to dedicate to this, but I figured I'd at least try just adding in the First, I got other compilation errors saying that Everything compiled fine. Caddy started up fine, and worked with all my existing configuration (which has several different sites using several different things, e.g. proxies and file servers, but no PHP). I then made a Hello World-ish PHP site (just an
After restarting Caddy, all the preexisting stuff still worked fine, but the new PHP site didn't. When I tried to go to it, the browser hung for a while on the request, and eventually just silently gave no result. I then remembered having seen a
Restarted Caddy, which then went into a tight infinite loop, putting the following message out once and then the next message out very very rapidly until I force-killed the process. First message (once):
Next message (tight loop):
I figured maybe the ZTS thing from the first message might have something to do with the "unexpected termination" thing from the tight loop message, so I changed the number of worker threads to one, and restarted. The same thing happened (i.e. both the ZTS message once and the "unexpected termination" message in a tight loop). I'm sorry to say, again, that I don't have much time to dedicate to this. However, if you see something obvious that I'm doing incorrectly, or could try in some other way, I'd love to hear it. |
Oh, and it's been years since I've really used PHP, so while it doesn't seem likely to me that this is the cause, here's the
.... aaaaaaaaaaaaand, now I'm extremely embarrassed by ... oh no, and no |
Without seriously expecting it to help, I fixed the little errors in First, when I said this (regarding the first time when I tried without the
I don't think that's correct. This time, the browser hung indefinitely, and I had to force-kill the Caddy process. I'm guessing I had done so the first time too, but had forgotten that by the time I typed up my previous post. Second: This time, I also tried going to a nonexistent file in the same directory as the Hello World-ish I should also explicitly note a couple things (regarding this "without
|
You need to compile PHP with ZTS support (and some other options) to use FrankenPHP: https://frankenphp.dev/docs/compile/#linux These are Linux instructions, but they also work on FreeBSD. For Brotli, it's to support a modern HTTP compression format. It's currently not optional (but it's on my todo list to make this dependency optional), it's weird that you don't get an error. In your case, you don't have to create a worker (it's standard PHP code). You can remove this line. |
Thanks. When you say:
Do you mean "this line" specifically the Regarding brotli: I do have it installed on my machine (almost certainly due to it being a dependency of something, rather than being something that I installed knowingly). If I get a chance, I'll spend a little time looking into that -- maybe there's a build option for that to control whether header files are installed, for example. |
You need to keep the empty |
OK, I'm sorry, but to make any further progress, I would have to spend a lot more time than I have trying to learn various things with which I'm essentially completely unfamiliar. However, I did make some progress, so before giving up, I'd like to note it here in the hopes that it might help someone else wants to give it a shot: (1) I added (2) Before xcaddy compilation, I set the environment variable (3) All in all, in addition to the (4) I altered the build options for Please note that I did not enable or disable any options for the others given in those Linux instructions, i.e. Please also note that I did not enable or disable any for the extra ones given in the MacOS instructions (on the same page), i.e. I'm guessing that the MacOS instructions' (5) After making the changes mentioned above in (4) to the PHP build options, I recompiled every PHP-related port on my machine. Most of them compiled successfully, but I ran into errors with several. These errors were all very similar to this example which I got while trying to build
The tl/dr there is: (A) All in all I got this same sort of error in these packages for these
(6) As a stab in the dark, I then uninstalled all php83 stuff and tried with php82 instead, but wound up with the same sorts of errors (as shown above). (7) To verify that the PHP compilation problem is related to the config option change I made, I set them back to the defaults and recompiled. It all compiled fine (though of course this would still leave the "you need ZTS" problem). I'm sorry I will be unable to continue on this (at least for the foreseeable future), but like I said further progress by me would require spending a lot more time than I currently have in order to learn about a bunch of things that I have virtually no detailed knowledge of. I hope that what I've found so far might help someone else, though. |
Thanks for the feedback. Would you mind opening a PR to add the needed header include? IMHO, it will be easier to "manually" compile PHP from sources with ZTS enabled (and other extensions you need) using the "Linux" (actually, this should work on most UNIXes) instructions than recompiling all the ports. I'll give it a try at some point, supporting FreeBSD is on my todo list. The main "issue" is that it's not supported by GitHub actions so it will be hard to test support continuously as we do for Linux and macOS. |
Unfortunately, one of the things I need to learn (although I imagine this might be a lot easier than the rest of them) is using git and github for pretty much anything but adding comments and such 😛 |
I coincidentally ran into something in another project (completely unrelated) that I wanted to change, so I figured with two, count 'em, two git-related things to do at the same time, now's as good a time as any to try to figure out git and github. I have only been actively avoiding doing this for about two decades now, so I consider myself an early adopter. I have opened a pull request at #1058. I hope this helps, and I hope I didn't screw up somehow! |
What happened?
Building via xcaddy, I'm getting various compilation errors like this (by which I mean the same sort of thing for
pthread_detach
,pthread_join
, etc.):I know very little about pthreads, but I think I've sussed out the issue (or at least an issue). Frankenphp.c has the following:
I am compiling on FreeBSD. These functions (like
pthread_create
) are defined in pthread.h, not in pthread_np.h.To be clear, I don't mean to imply that
#include <pthread_np.h>
should be replaced by#include <pthread.h>
. I have not looked closely enough to figure out whether or not both are needed, and like I said I know very little about pthreads. All I'm saying is that it seems very likely to me that#include <pthread.h>
is needed.Thank you!
Build Type
Custom (tell us more in the description)
Worker Mode
No
Operating System
Other (tell us more in the description)
CPU Architecture
x86_64
PHP configuration
Relevant log output
The text was updated successfully, but these errors were encountered: