AxelLavielle / BabelFish

BabelFish is a log system that have for purpose to be logging from all languages and to be reading & rotating & parsing logs. Next step will also be to monitor the processes that logs something.
4 stars 0 forks source link

Can't compile with clang under macOS 10.12.6 #1

Closed huguespoiget closed 7 years ago

huguespoiget commented 7 years ago

Here the trace I have when I try to make BabelFish:

macbook-pro:log hugues$ make
g++ -W -Wextra -Wall -g -pthread --std=c++11   -c -o Core.o Core.cpp
g++ -W -Wextra -Wall -g -pthread --std=c++11   -c -o LogParser.o LogParser.cpp
g++ -W -Wextra -Wall -g -pthread --std=c++11   -c -o Rotator.o Rotator.cpp
g++ -W -Wextra -Wall -g -pthread --std=c++11   -c -o AViewer.o AViewer.cpp
g++ -W -Wextra -Wall -g -pthread --std=c++11   -c -o TermViewer.o TermViewer.cpp
g++ -W -Wextra -Wall -g -pthread --std=c++11   -c -o CursesViewer.o CursesViewer.cpp
CursesViewer.cpp:32:42: error: member access into incomplete type '::WINDOW' (aka '_win_st')
  _scroll = LINENUMBER - _logBorderWindow->_maxy + 1;
                                         ^
/usr/include/ncurses.h:322:16: note: forward declaration of '_win_st'
typedef struct _win_st WINDOW;
               ^
CursesViewer.cpp:126:61: error: member access into incomplete type '::WINDOW' (aka '_win_st')
  _missingLines += (oss.str().size() + column) / (_logWindow->_maxx + 2);
                                                            ^
/usr/include/ncurses.h:322:16: note: forward declaration of '_win_st'
typedef struct _win_st WINDOW;
               ^
CursesViewer.cpp:131:15: error: member access into incomplete type 'WINDOW' (aka '_win_st')
  if (::stdscr->_maxy + 1 != _endY || ::stdscr->_maxx + 1 != _endX)
              ^
/usr/include/ncurses.h:322:16: note: forward declaration of '_win_st'
typedef struct _win_st WINDOW;
               ^
CursesViewer.cpp:133:26: error: member access into incomplete type 'WINDOW' (aka '_win_st')
      _scroll -= ::stdscr->_maxy + 1 - _endY;
                         ^
/usr/include/ncurses.h:322:16: note: forward declaration of '_win_st'
typedef struct _win_st WINDOW;
               ^
CursesViewer.cpp:230:76: error: member access into incomplete type '::WINDOW' (aka '_win_st')
  ::prefresh(_logWindow, _scroll + _missingLines, 0, 4, 1, _logBorderWindow->_maxy + 2, 10000);
                                                                           ^
/usr/include/ncurses.h:322:16: note: forward declaration of '_win_st'
typedef struct _win_st WINDOW;
               ^
CursesViewer.cpp:250:48: error: member access into incomplete type '::WINDOW' (aka '_win_st')
  if (_scroll > _lineNumber - (_logBorderWindow->_maxy - 1))
                                               ^
/usr/include/ncurses.h:322:16: note: forward declaration of '_win_st'
typedef struct _win_st WINDOW;
               ^
CursesViewer.cpp:252:48: error: member access into incomplete type '::WINDOW' (aka '_win_st')
      _scroll = _lineNumber - (_logBorderWindow->_maxy - 1);
                                               ^
/usr/include/ncurses.h:322:16: note: forward declaration of '_win_st'
typedef struct _win_st WINDOW;
               ^
CursesViewer.cpp:290:72: error: member access into incomplete type '::WINDOW' (aka '_win_st')
                  if (_scroll < _lineNumber + _missingLines - (_logBorderWindow->_maxy - 1))
                                                                               ^
/usr/include/ncurses.h:322:16: note: forward declaration of '_win_st'
typedef struct _win_st WINDOW;
               ^
CursesViewer.cpp:341:59: error: member access into incomplete type '::WINDOW' (aka '_win_st')
                      if (_scroll < _lineNumber - _logBorderWindow->_maxy + 1)
                                                                  ^
/usr/include/ncurses.h:322:16: note: forward declaration of '_win_st'
typedef struct _win_st WINDOW;
               ^
9 errors generated.
make: *** [CursesViewer.o] Error 1
AxelLavielle commented 7 years ago

Added to my to do list, probably fixed today or tomorrow.

AxelLavielle commented 7 years ago
clang++ -W -Wextra -Wall -Werror -ansi -pedantic -pthread --std=c++11 -Iincludes -Ilibs/c++   -c -o sources/LogParser.o sources/LogParser.cpp
clang++ -W -Wextra -Wall -Werror -ansi -pedantic -pthread --std=c++11 -Iincludes -Ilibs/c++   -c -o sources/Rotator.o sources/Rotator.cpp
clang++ -W -Wextra -Wall -Werror -ansi -pedantic -pthread --std=c++11 -Iincludes -Ilibs/c++   -c -o sources/AViewer.o sources/AViewer.cpp
clang++ -W -Wextra -Wall -Werror -ansi -pedantic -pthread --std=c++11 -Iincludes -Ilibs/c++   -c -o sources/TermViewer.o sources/TermViewer.cpp
clang++ -W -Wextra -Wall -Werror -ansi -pedantic -pthread --std=c++11 -Iincludes -Ilibs/c++   -c -o sources/CursesViewer.o sources/CursesViewer.cpp
clang++ -W -Wextra -Wall -Werror -ansi -pedantic -pthread --std=c++11 -Iincludes -Ilibs/c++   -c -o sources/main.o sources/main.cpp
clang++ sources/Core.o sources/LogParser.o sources/Rotator.o sources/AViewer.o sources/TermViewer.o sources/CursesViewer.o sources/main.o -o BabelFish -lncurses

I have no issue compiling with clang++, could you be more precise with the version of clang++ you're currently using ? Mine is clang 3.5.0-10.

huguespoiget commented 7 years ago

Seems to be a special version of clang (LLVM) that is installed on macOS by default.

$ g++ -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 8.1.0 (clang-802.0.42)
Target: x86_64-apple-darwin16.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
AxelLavielle commented 7 years ago

I am currently trying to install on my computer the same version of clang than you.

AxelLavielle commented 7 years ago

Finally found that @huguespoiget hadn't got the last version of ncurses on his mac. Please don't forget to install version 5.0 or more and to link it correctly so the program can compile.

huguespoiget commented 7 years ago

In order to fix my issue I installed last version of ncurses with brew:

brew install ncurses

Then I changed several lines of the Makefile:

CXXFLAGS    +=  -W -Wextra -Wall -Werror -ansi -pedantic
CXXFLAGS    +=  -pthread --std=c++11 -Iincludes -Ilibs/c++
LDFLAGS     +=  -lncurses

by the following:

CXXFLAGS    +=  -W -Wextra -Wall -Werror -ansi -pedantic                                                                                                                         
CXXFLAGS    +=  -pthread --std=c++11 -Iincludes -Ilibs/c++ -I/usr/local/opt/ncurses/include
LDFLAGS     +=  -lncurses -L/usr/local/opt/ncurses/lib