Skip to content
This repository has been archived by the owner on Sep 8, 2020. It is now read-only.

build error under Mac OS X 10.11 #292

Closed
StarDuster opened this issue Oct 17, 2015 · 10 comments
Closed

build error under Mac OS X 10.11 #292

StarDuster opened this issue Oct 17, 2015 · 10 comments

Comments

@StarDuster
Copy link

gcc -v                                       
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/c++/4.2.1
Apple LLVM version 7.0.0 (clang-700.0.72)
Target: x86_64-apple-darwin15.0.0
Thread model: posix

the source code is from git clone (git clone https://github.com/hishamhm/htop.git)

./configure --disable-unicode success(because it's hard to find libncursesw under osx),
but error occurred during make:

$ make                                     
/Applications/Xcode.app/Contents/Developer/usr/bin/make  all-am
gcc -DHAVE_CONFIG_H -I.  -DNDEBUG  -pedantic -Wall -Wextra -std=c99 -D_XOPEN_SOURCE_EXTENDED -DSYSCONFDIR=\"/usr/local/etc\" -I"./darwin"  -g -O2 -MT htop-SignalsPanel.o -MD -MP -MF .deps/htop-SignalsPanel.Tpo -c -o htop-SignalsPanel.o `test -f 'SignalsPanel.c' || echo './'`SignalsPanel.c
SignalsPanel.c:34:32: error: use of undeclared identifier 'Platform_numberOfSignals'; did you mean
      'Platform_numberOfFields'?
   for(unsigned int i = 0; i < Platform_numberOfSignals; i++) {
                               ^~~~~~~~~~~~~~~~~~~~~~~~
                               Platform_numberOfFields
./darwin/Platform.h:25:12: note: 'Platform_numberOfFields' declared here
extern int Platform_numberOfFields;
           ^
SignalsPanel.c:35:49: error: use of undeclared identifier 'Platform_signals'
      Panel_set(this, i, (Object*) ListItem_new(Platform_signals[i].name, Platform_signals[i...
                                                ^
SignalsPanel.c:35:75: error: use of undeclared identifier 'Platform_signals'
      Panel_set(this, i, (Object*) ListItem_new(Platform_signals[i].name, Platform_signals[i...
                                                                          ^
SignalsPanel.c:37:11: error: use of undeclared identifier 'Platform_signals'
      if (Platform_signals[i].number == defaultSignal) {
          ^
SignalsPanel.c:34:30: warning: comparison of integers of different signs: 'unsigned int' and 'int'
      [-Wsign-compare]
   for(unsigned int i = 0; i < Platform_numberOfSignals; i++) {
                           ~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~
1 warning and 4 errors generated.
make[1]: *** [htop-SignalsPanel.o] Error 1
make: *** [all] Error 2

I try ./configure --disable-unicodethen make on a Debian 7 server and there's nothing wrong, I'm not sure whether it's my mac's fault.

@edrozenberg
Copy link

I also get an error on 10.11, it might be related since it also mentions signals.

/Applications/Xcode.app/Contents/Developer/usr/bin/make  all-am
gcc -DHAVE_CONFIG_H -I.  -DNDEBUG  -pedantic -Wall -Wextra -std=c99 -D_XOPEN_SOURCE_EXTENDED -DSYSCONFDIR=\"/usr/local/etc\" -I"./darwin"  -g -O2 -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

@hishamhm
Copy link
Owner

@StarDuster @edrozenberg Please try again with the updated headers I commited today! Thank you for the feedback!

@edrozenberg
Copy link

Thanks for the changes! I'm still getting the same error (made sure to git clone the latest and I confirmed latest changes in darwin/Platform.h are present):

/Applications/Xcode.app/Contents/Developer/usr/bin/make  all-am
gcc -DHAVE_CONFIG_H -I.  -DNDEBUG  -pedantic -Wall -Wextra -std=c99 -D_XOPEN_SOURCE_EXTENDED -DSYSCONFDIR=\"/usr/local/etc\" -I"./darwin"  -g -O2 -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

@skabashnyuk
Copy link

git diff
diff --git a/darwin/Platform.h b/darwin/Platform.h
index af3a132..1aa9f2b 100644
--- a/darwin/Platform.h
+++ b/darwin/Platform.h
@@ -11,6 +11,7 @@ in the source distribution for its full text.
*/

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

HTH
BTW libncursesw can be installed from here https://github.com/Homebrew/homebrew-dupes/blob/master/ncurses.rb

brew tap homebrew/dupes
brew install ncurses
./configure CFLAGS="-I/usr/local/opt/ncurses/include" LDFLAGS="-L/usr/local/opt/ncurses/lib" CPPFLAGS="-I/usr/local/opt/ncurses/include"
make

@edrozenberg
Copy link

@skabashnyuk YBBTH (You Better Believe That Helped) :)
htop on Mac lives again!

@hishamhm in case it's helpful the following warnings show when compiling, app works fine though:

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 darwin/htop-Platform.o -MD -MP -MF darwin/.deps/htop-Platform.Tpo -c -o darwin/htop-Platform.o `test -f 'darwin/Platform.c' || echo './'`darwin/Platform.c
darwin/Platform.c:208:36: warning: unused parameter 'this' [-Wunused-parameter]
void Platform_setSwapValues(Meter* this) {
                                   ^
1 warning generated.
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 darwin/htop-DarwinProcessList.o -MD -MP -MF darwin/.deps/htop-DarwinProcessList.Tpo -c -o darwin/htop-DarwinProcessList.o `test -f 'darwin/DarwinProcessList.c' || echo './'`darwin/DarwinProcessList.c
darwin/DarwinProcessList.c:43:8: warning: implicit declaration of function 'err'
      is invalid in C99 [-Wimplicit-function-declaration]
       err(2, "Unable to retrieve host info\n");
       ^
darwin/DarwinProcessList.c:90:7: warning: implicit declaration of function
      'errx' is invalid in C99 [-Wimplicit-function-declaration]
      errx(6, "Out of memory for kproc_infos");
      ^
2 warnings generated.

@kaefer
Copy link
Contributor

kaefer commented Oct 28, 2015

PR #291 would address this, but @hishamhm closed it without really looking (I think).
+1 for the effort of making a new homebrew formula!

@hishamhm
Copy link
Owner

hishamhm commented Nov 2, 2015

@kaefer, sorry, I looked at it but the header regeneration added a bunch of #includes and I thought that got in.

Feel free to reopen if any problems remain!

@edrozenberg
Copy link

@hishamhm thanks, latest code configures/compiles fine on Mac now. Only one warning I saw on this latest code:

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 darwin/htop-DarwinProcessList.o -MD -MP -MF darwin/.deps/htop-DarwinProcessList.Tpo -c -o darwin/htop-DarwinProcessList.o `test -f 'darwin/DarwinProcessList.c' || echo './'`darwin/DarwinProcessList.c
darwin/DarwinProcessList.c:44:8: warning: implicit declaration of function
      'CRT_fatalError' is invalid in C99 [-Wimplicit-function-declaration]
       CRT_fatalError("Unable to retrieve host info\n");
       ^
1 warning generated.

@hishamhm
Copy link
Owner

hishamhm commented Nov 2, 2015

Thanks for testing! Pushed a fix. Does it build cleanly now?

@edrozenberg
Copy link

Builds totally clean now, thanks!

If I try really hard to find any other issue :) I can see:

$ ./autogen.sh 
aclocal: warning: couldn't open directory 'm4': No such file or directory

Probably just needs a mkdir m4 in autogen

hishamhm added a commit that referenced this issue Nov 3, 2015
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

5 participants