rcaelers / workrave

Workrave is a program that assists in the recovery and prevention of Repetitive Strain Injury (RSI). The program frequently alerts you to take micro-pauses, rest breaks and restricts you to your daily limit.
https://www.workrave.org
GNU General Public License v3.0
1.57k stars 199 forks source link

compilation for Mac 10.12.6 #89

Closed ValentinChirikov closed 3 years ago

ValentinChirikov commented 6 years ago

Hello ! First of all - thanks for a great app !

I am trying to compile for Mac Sierra 10.12.6.

at compilation produces error : ` In file included from OSXGtkMenu.cc:31: ./OSXGtkMenu.hh:51:28: error: unknown type name 'GtkMacDock' static void dock_clicked(IgeMacDock dock, void data); ^ ./OSXGtkMenu.hh:35:20: note: expanded from macro 'IgeMacDock'

define IgeMacDock GtkMacDock

`

gtk-mac-integration installed using brew

MorganBauer commented 6 years ago

This is because the gtk-mac-integration library is 32 bit and all recent Mac's going back quite a ways are 64bit.

If we read the header file we can see that the structs contained within are only defined if x64 is NOT defined.

It looks like the requirements for the gtk gui will require working with some other library.

palfrey commented 6 years ago

I'm in the process of trying to fix the OS X build. #85 fixed a bunch of things, but it's still a WIP. https://github.com/palfrey/workrave/tree/os-x-fixes has my latest work, which certainly compiles and has a semi-working applet. Hopefully in the next few weeks I'll have enough to be merged into here again.

SCdF commented 6 years ago

@palfrey how is this going? Would you recommend cracking open your branch on MacOS, or is it still far from working?

palfrey commented 6 years ago

I keep being delayed and distracted on this, and there's enough things on my plate that I don't see that improving any time soon. If you've got time to look at it, starting from my branch is a good place to begin. It at least kinda works, but IIRC there's a stack of small stuff that needs working through that I haven't had the time or patience to deal with.

bjlkeng commented 5 years ago

Works great for me, compiles and installs without a hitch! I've been trying to randomly poke around the code to get it compiling with no avail for the last little while. Thanks @palfrey !

jjerome00 commented 5 years ago

@palfrey @bjlkeng I'm a big fan of workrave. I recently got a mac for work and I have been missing it. I tried to clone the repo and compile, but I must admit I wasn't sure what to do.

I think I got as far as the ./configure step, and it's complaining about configure: error: X11 required on Unix platform

Can someone provide more palatable compile instructions for mac?

EDIT: I found this site and got it installed! I just have to figure out how to configure it now. https://tonyflorida.com/workrave-mac/

BlueDrink9 commented 3 years ago

Using palfrey's fixes on branch os-x-fixes on his fork (now quite out of sync with this repo) occasionally works on Catalina, but there are memory access errors. For example it crashes on startup if I have more than a couple of things open after a reboot, but once open is usually stable. Sometimes, however, the first ever break it takes crashes it.

I'm taking a brief look at the crashes at the moment with lldb and valgrind. I'm going to note my findings in this comment, for posterity. To clarify, I'm building on 0959ef9b7ab16dd3edf6e9d8ba129cd3dd4b946f with --enable-debug

I'm struggling to get debugging symbols recognised, but valgrind runs and crashes, giving these errors:

UNKNOWN mach_msg unhandled MACH_SEND_TRAILER option
==27780==    by 0x101967338: gdk_quartz_display_class_intern_init (in /Users/user/Homebrew/Cellar/gtk+3/3.24.23/lib/libgdk-3.0.dylib)
==27780==    by 0x101E9B4A0: g_type_class_ref (in /Users/user/Homebrew/Cellar/glib/2.66.2_1/lib/libgobject-2.0.0.dylib)
==27780==    by 0x101E877FC: g_object_new (in /Users/user/Homebrew/Cellar/glib/2.66.2_1/lib/libgobject-2.0.0.dylib)
==27780==    by 0x101966E9A: _gdk_quartz_display_open (in /Users/user/Homebrew/Cellar/gtk+3/3.24.23/lib/libgdk-3.0.dylib)
==27780==    by 0x10193E077: gdk_display_manager_open_display (in /Users/user/Homebrew/Cellar/gtk+3/3.24.23/lib/libgdk-3.0.dylib)
==27780==    by 0x10132C562: gtk_init (in /Users/user/Homebrew/Cellar/gtk+3/3.24.23/lib/libgtk-3.0.dylib)
==27780==    by 0x100AE5720: Gtk::Application::Application(int&, char**&, Glib::ustring const&, Gio::ApplicationFlags) (in /Users/user/Homebrew/Cellar/gtkmm3/3.24.2_1/lib/libgtkmm-3.0.1.dylib)
==27780==    by 0x100AE5811: Gtk::Application::create(int&, char**&, Glib::ustring const&, Gio::ApplicationFlags) (in /Users/user/Homebrew/Cellar/gtkmm3/3.24.2_1/lib/libgtkmm-3.0.1.dylib)
==27780==    by 0x100017AA1: GUI::main() (GUI.cc:207)
==27780==    by 0x10003D022: main (WindowHints.cc:154)
client stack range: [0x104295000 0x104A94FFF] client SP: 0x104A91E28
valgrind stack range: [0x700000BB2000 0x700000CB1FFF] top usage: 9808 of 1048576

LLDB, when left to run, says the crash occurs in main+51, or GUI::main() + 51. Specifically:

13  libgio-2.0.0.dylib                  0x00000001014131a8 g_application_run + 408
    14  workrave                            0x0000000100017c33 _ZN3GUI4mainEv + 483
    15  workrave                            0x000000010003d023 main + 51
    16  libdyld.dylib                       0x00007fff67c0acc9 start + 1
    17  ???                                 0x0000000000000001 0x0 + 1
)
Process 27857 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=EXC_I386_GPFLT)
    frame #0: 0x00007fff66a55829 libobjc.A.dylib`objc_msgSend + 41
libobjc.A.dylib`objc_msgSend:
->  0x7fff66a55829 <+41>: cmpq   (%r11), %rsi
    0x7fff66a5582c <+44>: jne    0x7fff66a55838            ; <+56>

Edit 1: Debugging symbols partially working now. Needed to run dsymutil path/to/binary/workrave to generate them.

GUI::main()+51 translates as:

/Users/user/.local/packages/workrave/bin/workrave`GUI::main() + 23 at /Users/user/.local/src/workrave/frontend/gtkmm/src/GUI.cc:201:23
   196  void
   197  GUI::main()
   198  {
   199   TRACE_ENTER("GUI::main");
   200
-> 201   Glib::OptionContext option_ctx;
   202
   203  #ifdef PLATFORM_OS_UNIX
   204   XInitThreads();
   205  #endif

Edit 2:

Valgrind with debug info says this line is where the crash is occuring.

Since it's a BAD_ACCESS, I'm assuming windows[0] is out of range, therefore windows isn't being populated.

I'm running out of time to work on this though, and about to stop having access to a Mac, so that's probably the last I will do here.

palfrey commented 3 years ago

FYI I no longer have a Mac as my main machine, so odds of me fixing any of this are basically zero. If anyone wants to use the stuff from my branch to do their own work, please go ahead!

rcaelers commented 3 years ago

I have started a macOS port using Qt5 in the next branch. So it is very unlikely that I will spend time on fixing the macOS port that uses Gtk. So I will close this issue. Of course, I will accept pull requests to improve support for macOS using Gtk if someone willing to help.

Thanks everyone how helped in the past with the macOS port!