Can't build on macOS #74
Labels
No Label
IMAP
JMAP
Maildir
Retired
User Experience
User Interface
bsd
bug
contacts
currently worked on
documentation
duplicate
easy
enhancement
help wanted
invalid
linux-gnu
macos
mbox
notmuch
question
security
wishlist
wontfix
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: meli/meli#74
Loading…
Reference in New Issue
There is no content yet.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may exist for a short time before cleaning up, in most cases it CANNOT be undone. Continue?
macOS: 10.11
Rust: 1.44.1
Fails while building like this:
Thank you for your post! Unfortunately I don't have any access in any OSX machine in order to fix these things :/ If I manage to get an OSX vm running on qemu, I will look into it.
I also ran into this same exact problem trying to build meli from source on macOS. I have access to the platform and I have some rust experience. If you can give me some hints on where to start, I can try to look into it.
Here is my toolchain:
Hello,
The problem is that OSX lacks the POSIX timer extension. This can be bypassed by using async I/O timers which use OSX's kqueue mechanism
meli uses the smol runtime, which has an async timer type that from what it says works on OSX.
The POSIX timers issue a signal with the timer's id in the signal data. This is read in the signal handler in src/bin.rs. The signal handler uses the self-pipe trick: it writes a byte (the timer's id) in a pipe to inform a thread in a signal-safe way that a timer fired. That thread's job is firing a wakeup event every X milliseconds and also send timer/signal events to the main process. This is all necessary because UNIX signals are not a very safe interface, they can interrupt a process's execution at any time more or less.
Async tasks are spawned by the
spawn_
functions in the JobExecutor struct. An async timer could work by spawning it with a specialspawn_timer
function that spawns an async task that instead of sending aJobFinished
event, sends aTimer
event with the timer's id:This is how a regular job is spawned:
This is how a timer could be spawned:
The only unclear issue is re-arming the timer. Feel free to ask more questions, there are a lot of details that must be considered, but I think this is the only difficulty.
@benjaminfjones I was looking to day at timers again, and found this:
https://stackoverflow.com/a/44814430 I believe the dispatch interface can be called from rust, indeed there's a crate that does just that but doesn't implement the timer interfaces: https://docs.rs/dispatch/0.1.2/src/dispatch/ffi.rs.html
This means there's no need for async timers, the POSIX real time signal timer can be replaced with a timer event with Dispatch. There are two possible options here, implement it in meli (which will require defining the FFI function signatures in a rust module and call the API with unsafe) or implement it in the
dispatch
crate and contribute a patch there. Unfortunatelly I still don't have access to an OSX machine, but I'm 100% willing to help/mentor/assist anyone willing to look into this. Either post here, send an e-mail or come to#meli
on freenodeOh, and I guess a least effort solution is to spawn a new thread for each timer and do a
loop { sleep(); send_event(); }
Resource:
https://medium.com/programming-servo/programming-servo-the-incredibly-shrinking-timer-7283ae2a2669
Posix timers were removed in
6392904047
, I'm closing this issue but if OSX build still fails please reopen the issue.