hishamhm / htop

htop is an interactive text-mode process viewer for Unix systems. It aims to be a better 'top'.
GNU General Public License v2.0
5.84k stars 581 forks source link

Unable to build on solaris #783

Open varunpatro opened 6 years ago

varunpatro commented 6 years ago

Hi @hishamhm!

I really love this tool and use this on every system I'm on.

My university for legacy reasons is using solaris and unfortunately, I'm stuck with it. I read that htop is now available for solaris? If yes, please help me out with this compile error I see.

Before that, here's the system info:

$ uname -a
SunOS sunfire0.comp.nus.edu.sg 5.10 Generic_Virtual sun4v sparc sun4v

And here's the make build error:

$ make
make  all-am
make[1]: Entering directory '/user/v/varun/downloads/htop'
depbase=`echo AvailableMetersPanel.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
gcc -DHAVE_CONFIG_H -I.  -DNDEBUG -I/home/v/varun/.local/include -pedantic -Wall -Wextra -std=c99 -D_XOPEN_SOURCE_EXTENDED -DSYSCONFDIR=\"/home/v/varun/.local/etc\" -I"./solaris"  -I/home/v/varun/.local/include/ncurses -I/home/v/varun/.local/include -g -O2 -MT AvailableMetersPanel.o -MD -MP -MF $depbase.Tpo -c -o AvailableMetersPanel.o AvailableMetersPanel.c &&\
mv -f $depbase.Tpo $depbase.Po
In file included from Object.h:13:0,
                 from Process.h:29,
                 from Settings.h:14,
                 from AvailableMetersPanel.h:12,
                 from AvailableMetersPanel.c:8:
XAlloc.h:10:17: fatal error: err.h: No such file or directory
 #include <err.h>
                 ^
compilation terminated.
make[1]: *** [Makefile:972: AvailableMetersPanel.o] Error 1
make[1]: Leaving directory '/user/v/varun/downloads/htop'
make: *** [Makefile:649: all] Error 2

Thanks for building this wonderful product!

By the way, I'm also interested in contributing to this project, so that I can learn more about system performance and also practice low level programming in C. Do you have any contributing guidelines or simple issues that I can help with?

varunpatro commented 6 years ago

After a lot more research, I believe htop is not supported on solaris 5.10. Correct me if I'm wrong here @gmbroome.

If that's the case, I believe the configure script should output a warning saying the platform is unsupported?

@gmbroome If you can get me started or provide some initial help, I would love to make htop work for solaris 5.10 (which unfortunately I'm stuck with for a few years from now)

ghost commented 6 years ago

@varunpatro This port of htop is untested on Solaris 10, as Solaris 10 entered the extended support phase (effectively making it a "legacy product") in January 2018, prior to @hishamhm doing the initial patch import.

That missing relates to the missing err() function, which was added to the Solaris mainline development code in 2006 via PSARC 2006/662. I'm unaware if that PSARC ever made it into a Solaris 10 update, or if it was limited to Solaris Express (ergo Solaris 11, OpenSolaris, and Illumos).

First off, I'd check if there's a patch for Solaris 10 available that covers PSARC 2006/662. If so, grab it. If not, then you're likely stuck implementing err() on your own.

Once you're past that issue, you'll likely run into another one very quickly: the need for ncurses6. For that, I recommend OpenCSW. After OpenCSW's pkgutil is installed on your system, as root (or pfexec with local admin privs): /opt/csw/bin/pkgutil -U /opt/csw/bin/pkgutil -y -i libncurses6 libncurses_dev pkgconfig

Then, back in your build environment: PATH=/opt/csw/bin:$PATH PKG_CONFIG_PATH=/opt/csw/lib/pkgconfig cd /path/to/your/source/htop ./configure make

Depending on your GCC version, you might need a more recent GCC from OpenCSW as well.

All of that aside, expect an uphill battle on a legacy OS. Meanwhile, I'll look into implementing a clean configure failure on Solaris 10.

ghost commented 6 years ago

@hishamhm This could be implemented as a specific warning about Solaris 10, a check for err.h, or both. Thoughts?

krytarowski commented 6 years ago

htop builds on SmartOS through pkgsrc.

ghost commented 6 years ago

Thanks, @krytarowski - Out of curiosity, was that on Triton cloud, or a local installation?

krytarowski commented 6 years ago

I use just use NetBSD, but I'm aware that they build for the SunOS family of systems.

ghost commented 6 years ago

Ah, @krytarowski - I think you're referring to htop-2.0.2 in pkgsrc. Though that version does indeed build on SmartOS, on native containers it's the dummy "unsupported" platform which just shows empty meters, no processes, etc.

Once pkgsrc bumps up its version of htop to 2.2.0 or later, SmartOS native containers should (hopefully) get a real, working htop implementation. SmartOS Linux containers already have the Linux version of htop, of course.

ghost commented 6 years ago

@hishamhm I recommend closing this. We've added in a config warning for unsupported Solaris versions, and my efforts to create a patchset for Solaris 10 compatibility have gone nowhere. Missing headers, ancient ncurses, broken unicode, etc. ad nauseam and none of it likely to ever be fixed, given the support status of S10.