Skip to content

When trying to build on macOS (I have libzim installed), I get an error #4

Closed

Description

@jdcaballerov

FYI, when trying to build on macOS (I have libzim installed), I get an error

Need to check this. Whats the compiler on your Mac ? I guess is related to the virtual destructor or some missing virtual.

clang called as gcc (default macOS setup)

Activity

  1. changed the title [-]> > FYI, when trying to build on macOS (I have libzim installed), I get an error[/-] [+]When trying to build on macOS (I have libzim installed), I get an error[/+] on Apr 9, 2020
  2. jdcaballerov commented on Apr 10, 2020

    @jdcaballerov
    ContributorAuthor

    @rgaudin virtual keywords missing in some member functions and a C++ ZimArticle destructor.

    Please confirm if commit fixes it to close.

    Commit:
    51e348c

  3. rgaudin commented on Apr 11, 2020

    @rgaudin
    Member

    No, it doesn't

    In file included from pyzim/pyzim.cpp:651:
    pyzim/wrappers.cpp:22:13: error: exception specification of overriding function is more lax than base version
        virtual ~ZimArticle() = default;
                ^
    

    Here's the full log with the other (related?) warnings:

    ./rebuild.sh
    rm: pyzim.so: No such file or directory
    Compiling pyzim/pyzim.pyx because it changed.
    [1/1] Cythonizing pyzim/pyzim.pyx
    running build_ext
    building 'pyzim' extension
    creating build
    creating build/temp.macosx-10.9-x86_64-3.6
    creating build/temp.macosx-10.9-x86_64-3.6/pyzim
    gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -I/Users/reg/src/prefix/include -I/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c pyzim/pyzim.cpp -o build/temp.macosx-10.9-x86_64-3.6/pyzim/pyzim.o
    In file included from pyzim/pyzim.cpp:651:
    In file included from pyzim/wrappers.cpp:7:
    /Users/reg/src/prefix/include/zim/writer/article.h:50:30: warning: defaulted function definitions are a C++11 extension [-Wc++11-extensions]
            virtual ~Article() = default;
                                 ^
    /Users/reg/src/prefix/include/zim/writer/article.h:62:31: warning: defaulted function definitions are a C++11 extension [-Wc++11-extensions]
            virtual ~Category() = default;
                                  ^
    /Users/reg/src/prefix/include/zim/writer/article.h:76:36: warning: defaulted function definitions are a C++11 extension [-Wc++11-extensions]
            virtual ~ArticleSource() = default;
                                       ^
    In file included from pyzim/pyzim.cpp:651:
    In file included from pyzim/wrappers.cpp:10:
    In file included from /Users/reg/src/prefix/include/zim/search.h:23:
    /Users/reg/src/prefix/include/zim/search_iterator.h:37:40: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
            search_iterator(search_iterator&& it);
                                           ^
    /Users/reg/src/prefix/include/zim/search_iterator.h:38:51: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
            search_iterator& operator=(search_iterator&& it);
                                                      ^
    In file included from pyzim/pyzim.cpp:651:
    In file included from pyzim/wrappers.cpp:10:
    /Users/reg/src/prefix/include/zim/search.h:43:22: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
            Search(Search&& it);
                         ^
    /Users/reg/src/prefix/include/zim/search.h:44:33: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
            Search& operator=(Search&& it);
                                    ^
    In file included from pyzim/pyzim.cpp:651:
    In file included from pyzim/wrappers.cpp:12:
    /Users/reg/src/prefix/include/zim/writer/creator.h:56:24: warning: in-class initialization of non-static data member is a C++11 extension [-Wc++11-extensions]
            bool withIndex = false;
                           ^
    /Users/reg/src/prefix/include/zim/writer/creator.h:57:29: warning: in-class initialization of non-static data member is a C++11 extension [-Wc++11-extensions]
            size_t minChunkSize = 1024-64;
                                ^
    /Users/reg/src/prefix/include/zim/writer/creator.h:59:37: warning: in-class initialization of non-static data member is a C++11 extension [-Wc++11-extensions]
            unsigned compressionThreads = 4;
                                        ^
    In file included from pyzim/pyzim.cpp:651:
    pyzim/wrappers.cpp:22:13: error: exception specification of overriding function is more lax than base version
        virtual ~ZimArticle() = default;
                ^
    /Users/reg/src/prefix/include/zim/writer/article.h:50:17: note: overridden virtual function is here
            virtual ~Article() = default;
                    ^
    In file included from pyzim/pyzim.cpp:651:
    pyzim/wrappers.cpp:22:29: warning: defaulted function definitions are a C++11 extension [-Wc++11-extensions]
        virtual ~ZimArticle() = default;
                                ^
    pyzim/wrappers.cpp:100:13: warning: 'auto' type specifier is a C++11 extension [-Wc++11-extensions]
                auto redirectArticle = Ar.getRedirectArticle();
                ^
    pyzim/wrappers.cpp:101:51: warning: adding 'char' to a string does not append to the string [-Wstring-plus-int]
                return redirectArticle.getNamespace() + "/" + redirectArticle.getUrl();
                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
    pyzim/wrappers.cpp:101:51: note: use array indexing to silence this warning
    pyzim/wrappers.cpp:155:9: warning: 'auto' type specifier is a C++11 extension [-Wc++11-extensions]
            auto search = _reader->suggestions(query, 0, 10);
            ^
    pyzim/wrappers.cpp:156:14: warning: 'auto' type specifier is a C++11 extension [-Wc++11-extensions]
            for (auto it = search->begin(); it != search->end(); it++)
                 ^
    pyzim/wrappers.cpp:166:9: warning: 'auto' type specifier is a C++11 extension [-Wc++11-extensions]
            auto search = _reader->search(query, 0, 10);
            ^
    pyzim/wrappers.cpp:167:14: warning: 'auto' type specifier is a C++11 extension [-Wc++11-extensions]
            for (auto it = search->begin(); it != search->end(); it++)
                 ^
    pyzim/wrappers.cpp:186:30: warning: 'OverriddenZimCreator::getMainUrl' hides overloaded virtual function [-Woverloaded-virtual]
        virtual zim::writer::Url getMainUrl()
                                 ^
    /Users/reg/src/prefix/include/zim/writer/creator.h:49:21: note: hidden overloaded virtual function 'zim::writer::Creator::getMainUrl' declared here: different qualifiers (const vs none)
            virtual Url getMainUrl() const { return Url(); }
                        ^
    18 warnings and 1 error generated.
    error: command 'gcc' failed with exit status 1
    
  4. jdcaballerov commented on Apr 11, 2020

    @jdcaballerov
    ContributorAuthor
  5. jdcaballerov commented on Apr 11, 2020

    @jdcaballerov
    ContributorAuthor

    The error is coming from a violation in the specification enforced strictly by clang. Will think about a better solution than declaring noexcept.

  6. rgaudin commented on Apr 11, 2020

    @rgaudin
    Member

    Works !!

    FYI, here's the difference with linux version

    $ ls -lh
    -rwxr-xr-x  1 reg  staff   210K Apr 11 15:40 pyzim.cpython-36m-darwin.so
    -rwxr-xr-x  1 reg  staff   1.3M Apr 10 14:41 pyzim.cpython-36m-x86_64-linux-gnu.so
    
    $ otool -L pyzim.cpython-36m-darwin.so
    pyzim.cpython-36m-darwin.so:
        /Users/runner/BUILD_native_dyn/INSTALL/lib/libzim.6.dylib (compatibility version 6.0.0, current version 6.0.0)
        /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 800.7.0)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1281.0.0)
  7. jdcaballerov commented on Apr 11, 2020

    @jdcaballerov
    ContributorAuthor

    Excellent, so activating the c++11 features was enough. I can not control much of the compilation since it's done by cython and setup.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions