Skip to content
This repository has been archived by the owner on Jul 4, 2023. It is now read-only.

Latest htop src now compiles almost out-of-the-box on Mac - re: htop-osx.rb #45197

Closed
edrozenberg opened this issue Oct 20, 2015 · 16 comments
Closed

Comments

@edrozenberg
Copy link

Regarding htop-osx.rb

The htop author has put work into making htop work on the Mac. I compiled the latest github htop source and it worked fine, with a couple of fixes from hishamhm/htop#292 (comment) -> all credit to @skabashnyuk for figuring this out.

Specifically:

Patched darwin/Platform.h to add "SignalsPanel.h" headers:

#include "Action.h"
+#include "SignalsPanel.h"
#include "BatteryMeter.h"
#include "DarwinProcess.h"

Install ncurses from homebrew/dupes to support unicode (otherwise can pass --disable-unicode to configure):

brew tap homebrew/dupes
brew install ncurses

And then the htop compile for the github source:

git clone https://github.com/hishamhm/htop.git
cd htop
./autogen.sh
./configure CFLAGS="-I/usr/local/opt/ncurses/include" LDFLAGS="-L/usr/local/opt/ncurses/lib" CPPFLAGS="-I/usr/local/opt/ncurses/include"
make

I'm not a formula expert but could take a try at doing an htop formula for this recent source code, would it then be a new formula htop.rb rather than the htop-osx.rb which is very mac specific?

@dunn
Copy link
Contributor

dunn commented Oct 21, 2015

We don't allow formulae in core with mandatory (or even recommended) dependencies on taps, so --disable-unicode will have to be the default behavior.

would it then be a new formula htop.rb rather than the htop-osx.rb which is very mac specific?

Yep. You'd also want to remove the alias that currently points htop to htop-osx: https://github.com/Homebrew/homebrew/blob/master/Library/Aliases/htop

@StarDuster
Copy link

I tried this with ncurses installed and I get a error on 10.11:

make                  
make/Applications/Xcode.app/Contents/Developer/usr/bin/make  all-am
gcc -DHAVE_CONFIG_H -I.  -DNDEBUG -I/usr/local/opt/ncurses/include -pedantic -Wall -Wextra -std=c99 -D_XOPEN_SOURCE_EXTENDED -DSYSCONFDIR=\"/usr/local/etc\" -I"./darwin"  -I/usr/local/opt/ncurses/include -MT htop-AvailableMetersPanel.o -MD -MP -MF .deps/htop-AvailableMetersPanel.Tpo -c -o htop-AvailableMetersPanel.o `test -f 'AvailableMetersPanel.c' || echo './'`AvailableMetersPanel.c
In file included from AvailableMetersPanel.c:14:
./darwin/Platform.h:19:8: error: unknown type name 'SignalItem'
extern SignalItem Platform_signals[];
       ^
1 error generated.
make[1]: *** [htop-AvailableMetersPanel.o] Error 1
make: *** [all] Error 2

@edrozenberg
Copy link
Author

@StarDuster you forgot to patch darwin/Platform.h? It should look like this after you modify it:

#include "Action.h"
#include "SignalsPanel.h"
#include "CPUMeter.h"
#include "BatteryMeter.h"
#include "DarwinProcess.h"

@StarDuster
Copy link

@edrozenberg I'm sorry for my stupid mistake,it works now

@kaefer
Copy link

kaefer commented Oct 30, 2015

As the header files are autogenerated one should better patch darwin/Platform.c (the header definitions are in there). I already made a pullrequest to the htop repo with this fix.

@edrozenberg
Copy link
Author

@kaefer thanks for following up on that, the htop developer recently fixed the issue via hishamhm/htop@a7fcbba so patching Platform.c/.h is no longer necessary.

@mistydemeo
Copy link
Member

I think it should be possible to get unicode support enabled without a duplicate ncurses. OS X's ncurses does have wide-character support, even though it doesn't install an ncursesw; I see that htop's configure.ac just checks to see the library name, rather than for function availability, so it's mistakenly rejecting OS X's ncurses.

@edrozenberg
Copy link
Author

Thanks Misty, I created a new issue at the htop project based on your feedback. The Mac's ncurses is version 5.x, and homebrew ncurses is 6.x - I also mentioned this in the htop issue in case it's relevant.

@edrozenberg
Copy link
Author

@mistydemeo htop developer fixed the ncurses issue via recent commit hishamhm/htop@3471415

htop now compiles out-of-the-box on Mac with:

./autogen.sh
./configure --enable-unicode
make

I still need to put together a brew formula for this, should be easy since it doesn't need to do anything special now.

@MikeMcQuaid
Copy link
Member

@edrozenberg If you do: ask him for a new tag and then we can build a new release.

@edrozenberg
Copy link
Author

Note regarding building htop with default ncurses (version 5) from Mac OS X vs. ncurses (version 6) from homebrew:

  • Building htop with default Mac OS X ncurses, scrolling with mouse inside htop does not work properly and causes htop to quit.
  • Building with a homebrew-installed ncurses (using the configure line with CFLAGS and LDFLAGS as described at the top of this issue), scrolling works properly.

For reference see hishamhm/htop#322

@edrozenberg
Copy link
Author

@MikeMcQuaid Waiting on a release tag from htop, looks like will happen later this month (Jan 2016).

@MikeMcQuaid
Copy link
Member

@edrozenberg Great!

@hishamhm
Copy link

@MikeMcQuaid @edrozenberg As promised in FOSDEM, here's the release of htop 2.0!

http://hisham.hm/htop/releases/2.0.0/

Thank you for your patience! :)

@MikeMcQuaid
Copy link
Member

Thanks for letting us known @hishamhm!

@OJFord OJFord mentioned this issue Feb 11, 2016
@UniqMartin
Copy link
Contributor

Closing in favor of #49057.

MikeMcQuaid pushed a commit that referenced this issue Feb 12, 2016
htop now supports OS X. This replaces the alias to htop-osx.

Fixes #45197.
Fixes #49054.
Closes #49057.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
flier pushed a commit to flier/homebrew that referenced this issue Feb 17, 2016
htop now supports OS X. This replaces the alias to htop-osx.

Fixes Homebrew#45197.
Fixes Homebrew#49054.
Closes Homebrew#49057.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
@Homebrew Homebrew locked and limited conversation to collaborators Jul 10, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants