pistache icon indicating copy to clipboard operation
pistache copied to clipboard

Pistache work on mac?

Open gmaisto opened this issue 10 years ago • 16 comments

Very nice project, but i was unable to install and use it on a mac (osx 10.11.x).

gmaisto avatar Apr 01 '16 16:04 gmaisto

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 :)

oktal avatar Apr 01 '16 17:04 oktal

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?

fsasieta avatar Sep 06 '16 17:09 fsasieta

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() since close() 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 ?

oktal avatar Oct 02 '16 09:10 oktal

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.

Thomspoon avatar Apr 15 '17 02:04 Thomspoon

@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?

Marqin avatar May 17 '17 15:05 Marqin

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!

codemaster avatar May 26 '17 05:05 codemaster

has been there any updates to this issue? We would love to use this api, but really need osx and linux support.

berlinguyinca avatar Jun 27 '17 16:06 berlinguyinca

Has the the shift to kqueue been made? I'd love some macOS support.

double-fault avatar Jan 21 '19 16:01 double-fault

No. Contributions are welcome!

dennisjenkins75 avatar Jan 22 '19 02:01 dennisjenkins75

Any changes to this? Would like to try it on OS X.

joalves avatar Apr 26 '19 14:04 joalves

Not yet I'm afraid, if anything we've moved in the other direction so far. PRs are welcome.

hydratim avatar Apr 26 '19 18:04 hydratim

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

kkhiama avatar Mar 26 '20 18:03 kkhiama

Working on it... 😎 @hyperxor I assume the make test call has 24/24 succeeded tests on Linux. Am I right?

SmartArray avatar Apr 10 '20 10:04 SmartArray

I would love to see macOS support too.

hovgrig avatar Apr 19 '20 18:04 hovgrig

Working on it... 😎 @hyperxor I assume the make test call 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.

jie-chen avatar Dec 04 '20 10:12 jie-chen

Working on it... 😎 @hyperxor I assume the make test call 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.

SmartArray avatar Dec 05 '20 10:12 SmartArray