Skip to content
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

Pistache work on mac? #1

Open
gmaisto opened this issue Apr 1, 2016 · 16 comments
Open

Pistache work on mac? #1

gmaisto opened this issue Apr 1, 2016 · 16 comments

Comments

@gmaisto
Copy link

gmaisto commented Apr 1, 2016

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

@oktal
Copy link
Collaborator

oktal commented Apr 1, 2016

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

@fsasieta
Copy link

fsasieta commented Sep 6, 2016

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?

@oktal
Copy link
Collaborator

oktal commented Oct 2, 2016

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 ?

@Thomspoon
Copy link

Thomspoon commented Apr 15, 2017

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.

@Marqin
Copy link

Marqin commented May 17, 2017

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

@codemaster
Copy link

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!

@berlinguyinca
Copy link

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

dennisjenkins75 added a commit that referenced this issue Sep 22, 2018
merge from oktal/pistache/master
@edidada edidada mentioned this issue Dec 3, 2018
@double-fault
Copy link

double-fault commented Jan 21, 2019

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

@dennisjenkins75
Copy link
Collaborator

No. Contributions are welcome!

dennisjenkins75 pushed a commit that referenced this issue Jan 31, 2019
…om-target-memcheck-test-valgrind

Added test_memcheck (memory leak check) custom target to build targets
@joalves
Copy link

joalves commented Apr 26, 2019

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

@hydratim
Copy link
Contributor

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

@kkhiama
Copy link

kkhiama commented Mar 26, 2020

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

@SmartArray
Copy link

SmartArray commented Apr 10, 2020

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

@hovgrig
Copy link

hovgrig commented Apr 19, 2020

I would love to see macOS support too.

@jie-chen
Copy link

jie-chen commented Dec 4, 2020

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.

@SmartArray
Copy link

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.

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

No branches or pull requests