lharding / tasknc

ncurses wrapper around taskwarrior
MIT License
117 stars 18 forks source link

Install on a Mac #12

Open alberteddu opened 12 years ago

alberteddu commented 12 years ago

I would like to try tasknc on a Mac, but I'm getting an error with make.

clang: warning: -lncursesw: 'linker' input unused when '-c' is present
tasklist.c:343:43: warning: format string is not a string literal
      (potentially insecure) [-Wformat-security]
        statusbar_message(cfg.statusbar_timeout, reply);
                                                 ^~~~~
tasklist.c:408:44: warning: format string is not a string literal
      (potentially insecure) [-Wformat-security]
                statusbar_message(cfg.statusbar_timeout, success);
                                                         ^~~~~~~
tasklist.c:615:8: error: address expression must be an lvalue or a function
      designator
        ret = WEXITSTATUS(pclose(cmdout));
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/sys/wait.h:151:26: note: expanded from macro 'WEXITSTATUS'
#define WEXITSTATUS(x)  ((_W_INT(x) >> 8) & 0x000000ff)
                          ^
/usr/include/sys/wait.h:138:28: note: expanded from macro '_W_INT'
#define _W_INT(w)       (*(int *)&(w))  /* convert union wait to int */
                                 ^ ~
2 warnings and 1 error generated.
make: *** [tasklist.o] Error 1

Anyway, the idea is great, hope I can try it soon. :)

mjheagle8 commented 12 years ago

Hi, I'm sorry for the delay in my response. I have been very busy lately. I will look into this as soon as I can! I may need to contact you for testing as I do not have a Mac to test on. Thanks for trying tasknc! -mjheagle

alberteddu commented 12 years ago

Sure, I will obviously do the testing. Thanks to you for making tasknc. :-)

mjheagle8 commented 12 years ago

:) I just pushed my first attempt to fix this problem. When you get a chance, check it out and tell me if it works!

alberteddu commented 12 years ago

(Ouch, did I delete the comment?)

Thank you, that indeed fixed the bug. To install on Mountain Lion I had to also install ncurses (http://ftp.gnu.org/gnu/ncurses) after configuring with "--enable-widec".

There is also a problem with "sudo make install", because it fails because of the "-D" option. I'm not sure what it does, but without that option it worked.

"tasknc" hangs on first run while "configuring...", but because I can see you can't test/debug on a Mac, I'm going to debug it myself, if that's okay with you. I will let you know if I'm successful.

Again, thank you.

mjheagle8 commented 12 years ago

I'm glad that worked!

Would you be able to send me a git patch with the changes you needed to make to install? Then I can add some instructions in the README (I will credit you there too) for other people who want to install on Mac?

That sounds great to me! Feel free to contact me with any questions you have. -l 8 is your friend here too :)

itaiferber commented 12 years ago

Hey, any progress on this issue? I've been wanting to test out tasknc, and I've mostly been able to follow along here, but once I get it installed, it just hangs. Any idea on how to get it up and running, or what's going on? Running with the logging and debug flags doesn't give me any additional info...

alberteddu commented 12 years ago

Same here. Hoped to help @mjheagle8 out because it seems he doesn't have a Mac, but I really don't have a clue. :-(

mjheagle8 commented 12 years ago

Do you see a CPU spike when it hangs? What are the last few lines of the log file when tasknc is run with -l8? I will do my best to try to resolve this, I have not attempted to yet. Thanks! -mjheagle

mjheagle8 commented 12 years ago

Also helpful would be if you run tasknc in gdb, then abort using a ctrl-c or a kill signal, and run backtrace in gdb to see what the location in the code is when it hangs.

itaiferber commented 12 years ago

Running with -l8:

[2012-11-15 16:32:25] DEBUG: running gui
[2012-11-15 16:32:25] DEBUG: assigned color pair 1 to (4, 0)
[2012-11-15 16:32:25] DEBUG: assigned color pair 2 to (-1, -1)
[2012-11-15 16:32:25] DEBUG: assigned color pair 3 to (6, 0)
[2012-11-15 16:32:25] DEBUG: assigned color pair 4 to (1, -1)
[2012-11-15 16:32:25] DEBUG: configuring...
[2012-11-15 16:32:40] DEBUG: received SIGINT, exiting

Running through gdb:

tasknc v0.8
configuring...
Program received signal SIGINT, Interrupt.
0x00007fff86858d25 in __svfscanf_l ()
(gdb) bt
#0  0x00007fff86858d25 in __svfscanf_l ()
#1  0x00007fff8685398d in fscanf ()
#2  0x0000000100006430 in configure () at tasknc.c:211
#3  0x00000001000077f8 in main (argc=<value temporarily unavailable, due to optimizations>, argv=<value temporarily unavailable, due to optimizations>) at tasknc.c:887

Running through lldb:

tasknc v0.8
Process 48836 stopped
* thread #1: tid = 0x1c03, 0x00007fff868538c4 libsystem_c.dylib`fscanf, stop reason = signal SIGSTOP
    frame #0: 0x00007fff868538c4 libsystem_c.dylib`fscanf
libsystem_c.dylib`fscanf:
-> 0x7fff868538c4:  pushq  %rbp
   0x7fff868538c5:  movq   %rsp, %rbp
   0x7fff868538c8:  pushq  %r14
   0x7fff868538ca:  pushq  %rbx
(lldb) bt
* thread #1: tid = 0x1c03, 0x00007fff868538c4 libsystem_c.dylib`fscanf, stop reason = signal SIGSTOP
    frame #0: 0x00007fff868538c4 libsystem_c.dylib`fscanf
    frame #1: 0x0000000100006430 tasknc`configure + 192 at tasknc.c:211
    frame #2: 0x00000001000077f8 tasknc`main + 504 at tasknc.c:887
    frame #3: 0x00007fff83af57e1 libdyld.dylib`start + 1

Hope that helps! Let me know if you need any more info...

mjheagle8 commented 12 years ago

What is the output of task --version ? It seems tasknc is stuck in an infinite loop trying to parse this output.

itaiferber commented 12 years ago

Just 2.1.2...

ding444 commented 11 years ago

I'm having the same issue with it hanging on

tasknc v0.8  
configuring...

I'm also running version 1.9.3 of task

Update: I updated to 2.1.2 and tasknc would err out. After adding some tasks and rerunning it worked fine though.

charignon commented 8 years ago

I am having this issue with the latest tasknc and taskwarrior 2.5.0

mcrucifix commented 8 years ago

mjheagle8 @alberteddu @ding444, @garignon : The problem is that for some reason (POSIX 2008 compatibility ?) the mac does not process correctly the %m format specifier in the fscanf and sscanf. It is really bizarre, but clearly this is the problem. I had to change all these commands (e.g.: convert %ms into %s) and introduce a 'malloc' to make it to work. If you are interested, I made the changes and I am happy to push them. and also introduced support for "Urgency" and "Totalactivetime" + made some more edits for better processing start/stop, and also improve the formatting. It begins to work quite well, but will probably keep crafting this nice application to my own need. For example, I did not like the fact that 'add' was automatically launching an editor, and preferred to make it work like "modify".