Pistache work on mac?
Very nice project, but i was unable to install and use it on a mac (osx 10.11.x).
Hello and thanks :)
Unfortunately, it does not support osx for now as it's using the epoll() system call underneath for I/O notification. To make it work on osx, I would have to use kqueue instead of epoll. If you're interested in contributing, I could guide through the process of updating the code to support kqueue instead of epoll :)
I am interested in working on this and contributing to the project. I have taken a look at the os.cc file and found where the epoll is used. Could you give more help or pointers on this?
Hello,
Sorry for the late response, I've been quite busy these last days.
Anyway, thanks for your interest in the project. Like you said, I implemented a tiny C++ wrapper around epoll() in the os.cc source file. Now, to make it work on OSX, it would have to use kqueue() or select() instead of epoll(). That being said, I did not bother making an abstraction around the polling system yet.
That being said, you could start creating an "interface" around the polling system (currently epoll). For example, such interface could support multiple operations:
- Adding an FD to the interest list
- Modifying / rearming an FD
- Removing an FD (no-op with
epoll()sinceclose()automatically removes the fd from the interest list) - Polling the list for a set of ready fds.
Then, the polling system would have multiple implementations of this interface. We would then have:
-
Polling::Epoll -
Polling::Select -
Polling::Kqueue - ...
The implementation would look something along those lines:
namespace Polling {
// Interface
class Poller {
public:
virtual ~Poller() = default;
// ...
};
// Implementation
class Epoll : public Poller {
};
class Kqueue : public Poller {
};
class Select : public Poller {
};
Then, at runtime, depending on the OS and maybe a configuration parameter (we could start with an environment variable), it would automatically detect and choose either of these polling systems.
Makes sense ?
It seems that it's not as simple as just wrapping kqueue() for os.h/c, as http, transport and probably a few others use POSIX extensions. The transport layer is probably going to be the most intensive.
@oktal what is cpu_set_t CpuSet::toPosix() used for? It's conflicting with Mac build (by using cpu_set_t), but I cannot find any usage of this method inside pistache code. Can it be removed?
Any updates on this front?
@Marqin I noticed that the toPosix() function was never being called. I was able to remove it and compile with no complaints. Perhaps it's vestigial?
@oktal It looks like @Thomspoon is correct - the epoll specifics expand outside of the Polling namespace. I am happy to work on creating new implementations via select or kqueue, but epoll spills into mailbox.h, etc.
This is likely due to how the Epoll class handles new FDs: it simply accepts externally created FDs. Instead, it should create them internally or with a helper so that it can be abstracted. (ie - a virtual function called create or the like). @oktal would you be able to help kick this off? Happy to carry the torch on if we have some assistance with corralling functionality pieces.
Thanks!
has been there any updates to this issue? We would love to use this api, but really need osx and linux support.
Has the the shift to kqueue been made? I'd love some macOS support.
No. Contributions are welcome!
Any changes to this? Would like to try it on OS X.
Not yet I'm afraid, if anything we've moved in the other direction so far. PRs are welcome.
Very nice project, but i was unable to install and use it on a mac (osx 10.11.x).
I ve the same issue, unfortunately
Working on it... 😎
@hyperxor I assume the make test call has 24/24 succeeded tests on Linux. Am I right?
I would love to see macOS support too.
Working on it... 😎 @hyperxor I assume the
make testcall has 24/24 succeeded tests on Linux. Am I right?
Thanks a lot! Clone your branch and now I can install it on OSX! Switched to m1 macbook today, could not find any workaround for Linux as no virtual machines or docker are supported yet.
Working on it... 😎 @hyperxor I assume the
make testcall has 24/24 succeeded tests on Linux. Am I right?Thanks a lot! Clone your branch and now I can install it on OSX! Switched to m1 macbook today, could not find any workaround for Linux as no virtual machines or docker are supported yet.
Please do not use my develop branch. I just managed it to compile, but all the timer stuff etc. wasn't working at all due to lack of support from the community. Feel free to fix the source code in order to pass the test coverage. You may get it to work but I doubt someone ever will, unless we alter the complete logical structure.