Проблема с zlib при запуске make-файла MacOS sierra - PullRequest
0 голосов
/ 25 апреля 2019

Я пытаюсь запустить make-файл в MacOS sierra, но, похоже, возникают проблемы с заголовком Zlib (см. Ниже).

Я попытался установить отдельную версию с brew и passкаталог установки brew zlib в файле конфигурации.

./configure --prefix=/usr/local/etherlab --with-xml-prefix=/usr/local/opt/libxml2 --with-zlib-dir=/usr/local/opt/zlib CXXFLAGS=-std=c++11

Однако, когда я запускаю make, я получаю ошибку

$ make

/Applications/Xcode.app/Contents/Developer/usr/bin/make  all-recursive
Making all in proto
make[2]: Nothing to be done for `all'.
Making all in lib
Making all in LibDLS
make[3]: Nothing to be done for `all'.
/bin/sh ../libtool  --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I. -I..   -I/usr/local/etherlab/include -Wall -I/usr/local/include -I/usr/local/opt/zlib/include -I/usr/local/opt/libxml2/include/libxml2 -std=c++11 -MT libdls_la-ZLib.lo -MD -MP -MF .deps/libdls_la-ZLib.Tpo -c -o libdls_la-ZLib.lo `test -f 'ZLib.cpp' || echo './'`ZLib.cpp
libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I.. -I/usr/local/etherlab/include -Wall -I/usr/local/include -I/usr/local/opt/zlib/include -I/usr/local/opt/libxml2/include/libxml2 -std=c++11 -MT libdls_la-ZLib.lo -MD -MP -MF .deps/libdls_la-ZLib.Tpo -c ZLib.cpp  -fno-common -DPIC -o .libs/libdls_la-ZLib.o
ZLib.cpp:22:10: warning: non-portable path to file '<ZLib.h>'; specified path differs in case from file name on disk
      [-Wnonportable-include-path]
#include <zlib.h>
         ^~~~~~~~
         <ZLib.h>
In file included from ZLib.cpp:22:
./zlib.h:42:17: error: unknown type name 'string'; did you mean 'std::string'?
    EZLib(const string &pmsg) : Exception(pmsg) {};
                ^~~~~~
                std::string
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/iosfwd:194:65: note:
      'std::string' declared here
typedef basic_string<char, char_traits<char>, allocator<char> > string;
                                                                ^
ZLib.cpp:90:5: error: unknown type name 'uLongf'
    uLongf out_size;
    ^
ZLib.cpp:104:17: error: use of undeclared identifier 'uLongf'
    out_size = (uLongf) (src_size * 1.01 + 12 + 0.5);
                ^
ZLib.cpp:117:28: error: use of undeclared identifier 'Bytef'
    comp_ret = ::compress((Bytef *) _out_buf, &out_size,
                           ^
ZLib.cpp:117:35: error: expected expression
    comp_ret = ::compress((Bytef *) _out_buf, &out_size,
                                  ^
ZLib.cpp:118:34: error: unknown type name 'Bytef'
                          (const Bytef *) src, src_size);
                                 ^
ZLib.cpp:117:16: error: no member named 'compress' in the global namespace; did you mean simply 'compress'?
    comp_ret = ::compress((Bytef *) _out_buf, &out_size,
               ^~~~~~~~~~
               compress
ZLib.cpp:88:12: note: 'compress' declared here
void ZLib::compress(const char *src, unsigned int src_size)
           ^
ZLib.cpp:120:21: error: use of undeclared identifier 'Z_OK'
    if (comp_ret != Z_OK) // Fehler beim Komprimieren
                    ^
ZLib.cpp:123:25: error: use of undeclared identifier 'Z_BUF_ERROR'
        if (comp_ret == Z_BUF_ERROR) err << " (BUFFER ERROR)";
                        ^
ZLib.cpp:155:5: error: unknown type name 'uLongf'
    uLongf zlib_out_size = out_size;
    ^
ZLib.cpp:173:32: error: use of undeclared identifier 'Bytef'
    uncomp_ret = ::uncompress((Bytef *) _out_buf, &zlib_out_size,
                               ^
ZLib.cpp:173:39: error: expected expression
    uncomp_ret = ::uncompress((Bytef *) _out_buf, &zlib_out_size,
                                      ^
ZLib.cpp:174:38: error: unknown type name 'Bytef'
                              (const Bytef *) src, src_size);
                                     ^
ZLib.cpp:173:18: error: no member named 'uncompress' in the global namespace; did you mean simply 'uncompress'?
    uncomp_ret = ::uncompress((Bytef *) _out_buf, &zlib_out_size,
                 ^~~~~~~~~~~~
                 uncompress
ZLib.cpp:150:12: note: 'uncompress' declared here
void ZLib::uncompress(const char *src, unsigned int src_size,
           ^
ZLib.cpp:176:23: error: use of undeclared identifier 'Z_OK'
    if (uncomp_ret != Z_OK) // Fehler beim Dekomprimieren
                      ^
ZLib.cpp:179:27: error: use of undeclared identifier 'Z_BUF_ERROR'
        if (uncomp_ret == Z_BUF_ERROR) {
                          ^
1 warning and 16 errors generated.
make[3]: *** [libdls_la-ZLib.lo] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

Копая немного больше, я обнаружил, что яМожно попытаться добавить

#include <string>
#include <cstring>

к заголовку zlib.h, но это тоже не работает.

Что еще можно сделать, чтобы решить эту проблему?.

...