dannyedel / dspdfviewer

Dual-Screen PDF Viewer for latex-beamer
http://dspdfviewer.danny-edel.de
GNU General Public License v2.0
218 stars 27 forks source link

Fail to compile git head or 1.15 on OS X #174

Closed simplygood closed 8 years ago

simplygood commented 8 years ago

The current homebrew is v1.13.1 and I wanted to try the latest version. But I failed to compile git head and v1.15 on OS X El Capitan with latest qt5, boost, and poppler from homebrew. Is there any v1.15 binary available for OS X? Or, how can I compile on OS X?

$ export PATH=/usr/local/opt/qt5/bin:$PATH
$ export LDFLAGS=-L/usr/local/opt/qt5/lib
$ export CPPFLAGS=-I/usr/local/opt/qt5/include
$ tar zxf v1.15.tar.gz
$ cd dspdfviewer-1.15
$ mkdir build
$ cd build
$ cmake -DUseQtFive=ON ..
-- Compiling for system Darwin
-- Boost version: 1.60.0
-- Found the following Boost libraries:
--   program_options
--   unit_test_framework
-- Using Qt5 and libpoppler-qt5
-- Found Qt5 at /usr/local/opt/qt5/lib/cmake/Qt5Core
-- Checking for one of the modules 'poppler-qt5'
-- Clang++ detected.
-- Embedding version number 1.15. If you want to override this, for example to embed the git revision you built from, please pass -DDSPDFVIEWER_VERSION=1.2.3.4.5 t
o the cmake command.
-- Check if the system is big endian
-- Searching 16 bit integer
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of unsigned short
-- Check size of unsigned short - done
-- Using unsigned short
-- Check if the system is big endian - little endian
-- Building colored-rectangles.pdf from source.
-- Building images.pdf from source.
-- Building many-many-pages.pdf from source.
-- Configuring done
-- Generating done
-- Build files have been written to: ~/dspdfviewer-1.15/build

$ make
Scanning dependencies of target libdspdfviewer_automoc
[  2%] Automatic moc for target libdspdfviewer
Generating moc_dspdfviewer.cpp
Generating moc_hyperlinkarea.cpp
Generating moc_pdfrenderfactory.cpp
Generating moc_pdfviewerwindow.cpp
Generating moc_renderthread.cpp
Generating moc_runtimeconfiguration.cpp
[  2%] Built target libdspdfviewer_automoc
[  4%] Generating dspdfviewer_de.qm
Updating '~/dspdfviewer-1.15/build/dspdfviewer_de.qm'...
    Generated 78 translation(s) (78 finished and 0 unfinished)
[  6%] Generating ui_pdfviewerwindow.h
[  8%] Generating ui_keybindings.h
Scanning dependencies of target libdspdfviewer
[ 10%] Building CXX object CMakeFiles/libdspdfviewer.dir/adjustedlink.cpp.o
In file included from ~/dspdfviewer-1.15/adjustedlink.cpp:21:
In file included from ~/dspdfviewer-1.15/adjustedlink.h:23:
In file included from ~/dspdfviewer-1.15/renderingidentifier.h:24:
In file included from /usr/local/opt/qt5/lib/QtCore.framework/Headers/qglobal.h:1114:
/usr/local/opt/qt5/lib/QtCore.framework/Headers/qglobalstatic.h:126:45: error: no member named 'load' in 'QBasicAtomicInt'
    bool isDestroyed() const { return guard.load() <= QtGlobalStatic::Destroyed; }
                                      ~~~~~ ^
/usr/local/opt/qt5/lib/QtCore.framework/Headers/qglobalstatic.h:127:40: error: no member named 'load' in 'QBasicAtomicInt'
    bool exists() const { return guard.load() == QtGlobalStatic::Initialized; }
                                 ~~~~~ ^
In file included from ~/dspdfviewer-1.15/adjustedlink.cpp:21:
In file included from ~/dspdfviewer-1.15/adjustedlink.h:23:
In file included from ~/dspdfviewer-1.15/renderingidentifier.h:26:
In file included from /usr/local/opt/qt5/lib/QtCore.framework/Headers/QString:1:
In file included from /usr/local/opt/qt5/lib/QtCore.framework/Headers/qstring.h:42:
/usr/local/include/QtCore/qbytearray.h:207:5: error: unknown type name 'QBool'
    QBool contains(char c) const;
    ^
/usr/local/include/QtCore/qbytearray.h:208:5: error: unknown type name 'QBool'
    QBool contains(const char *a) const;
    ^
/usr/local/include/QtCore/qbytearray.h:209:5: error: unknown type name 'QBool'
    QBool contains(const QByteArray &a) const;
    ^
/usr/local/include/QtCore/qbytearray.h:401:57: error: use of undeclared identifier 'qFree'
inline QByteArray::~QByteArray() { if (!d->ref.deref()) qFree(d); }
                                                        ^
/usr/local/include/QtCore/qbytearray.h:523:8: error: unknown type name 'QBool'
inline QBool QByteArray::contains(const QByteArray &a) const
       ^
/usr/local/include/QtCore/qbytearray.h:524:10: error: use of undeclared identifier 'QBool'
{ return QBool(indexOf(a) != -1); }
         ^
/usr/local/include/QtCore/qbytearray.h:525:8: error: unknown type name 'QBool'
inline QBool QByteArray::contains(char c) const
       ^
/usr/local/include/QtCore/qbytearray.h:526:10: error: use of undeclared identifier 'QBool'
{ return QBool(indexOf(c) != -1); }
         ^
/usr/local/include/QtCore/qbytearray.h:575:8: error: unknown type name 'QBool'
inline QBool QByteArray::contains(const char *c) const
       ^
/usr/local/include/QtCore/qbytearray.h:576:10: error: use of undeclared identifier 'QBool'
{ return QBool(indexOf(c) != -1); }
         ^
/usr/local/include/QtCore/qbytearray.h:611:1: error: redefinition of 'QTypeInfo<QByteArray>'
Q_DECLARE_SHARED(QByteArray)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/opt/qt5/lib/QtCore.framework/Headers/qtypeinfo.h:254:32: note: expanded from macro 'Q_DECLARE_SHARED'
#define Q_DECLARE_SHARED(TYPE) Q_DECLARE_SHARED_IMPL(TYPE, Q_MOVABLE_TYPE)
                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/opt/qt5/lib/QtCore.framework/Headers/qtypeinfo.h:249:44: note: expanded from macro 'Q_DECLARE_SHARED_IMPL'
#define Q_DECLARE_SHARED_IMPL(TYPE, FLAGS) \
                                           ^
/usr/local/opt/qt5/lib/QtCore.framework/Headers/qtypeinfo.h:225:12: note: expanded from macro '\
Q_DECLARE_TYPEINFO'
template<> \
           ^
/usr/local/opt/qt5/lib/QtCore.framework/Headers/qtypeinfo.h:208:7: note: expanded from macro '\
Q_DECLARE_TYPEINFO_BODY'
class QTypeInfo<TYPE > \
      ^~~~~~~~~~~~~~~~
/usr/local/include/QtCore/qbytearray.h:610:1: note: previous definition is here
Q_DECLARE_TYPEINFO(QByteArray, Q_MOVABLE_TYPE);
^
/usr/local/opt/qt5/lib/QtCore.framework/Headers/qtypeinfo.h:225:12: note: expanded from macro 'Q_DECLARE_TYPEINFO'
template<> \
           ^
/usr/local/opt/qt5/lib/QtCore.framework/Headers/qtypeinfo.h:208:7: note: expanded from macro '\
Q_DECLARE_TYPEINFO_BODY'
class QTypeInfo<TYPE > \
      ^
In file included from ~/dspdfviewer-1.15/adjustedlink.cpp:21:
In file included from ~/dspdfviewer-1.15/adjustedlink.h:23:
In file included from ~/dspdfviewer-1.15/renderingidentifier.h:26:
In file included from /usr/local/opt/qt5/lib/QtCore.framework/Headers/QString:1:
In file included from /usr/local/opt/qt5/lib/QtCore.framework/Headers/qstring.h:43:
/usr/local/opt/qt5/lib/QtCore.framework/Headers/qrefcount.h:49:28: error: no member named 'load' in 'QBasicAtomicInt'
        int count = atomic.load();
                    ~~~~~~ ^
/usr/local/opt/qt5/lib/QtCore.framework/Headers/qrefcount.h:60:28: error: no member named 'load' in 'QBasicAtomicInt'
        int count = atomic.load();
                    ~~~~~~ ^
/usr/local/opt/qt5/lib/QtCore.framework/Headers/qrefcount.h:83:23: error: no member named 'load' in 'QBasicAtomicInt'
        return atomic.load() != 0;
               ~~~~~~ ^
/usr/local/opt/qt5/lib/QtCore.framework/Headers/qrefcount.h:90:23: error: no member named 'load' in 'QBasicAtomicInt'
        return atomic.load() == -1;
               ~~~~~~ ^
/usr/local/opt/qt5/lib/QtCore.framework/Headers/qrefcount.h:95:28: error: no member named 'load' in 'QBasicAtomicInt'
        int count = atomic.load();
                    ~~~~~~ ^
/usr/local/opt/qt5/lib/QtCore.framework/Headers/qrefcount.h:99:52: error: no member named 'store' in 'QBasicAtomicInt'
    void initializeOwned() Q_DECL_NOTHROW { atomic.store(1); }
                                            ~~~~~~ ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make[2]: *** [CMakeFiles/libdspdfviewer.dir/adjustedlink.cpp.o] Error 1
make[1]: *** [CMakeFiles/libdspdfviewer.dir/all] Error 2
make: *** [all] Error 2
$
dannyedel commented 8 years ago

Hi @simplygood, thank you for reporting this.

CCing @wwwdata, he's the homebrew formula maintainer.

Reading your build log's first error:

/usr/local/opt/qt5/lib/QtCore.framework/Headers/qglobalstatic.h:126:45: error: no member named 'load' in 'QBasicAtomicInt'

This sounds like a problem within the Qt installation. I don't have physical access to a mac right now, but I'll add osx/qt5 to the travis build matrix.

I don't think you should set LDFLAGS and such manually, cmake should™ take care of that. Just to see if it makes a difference, please try building with make VERBOSE=1 to see the full compiler invocations.

dannyedel commented 8 years ago

@simplygood I see the problem starts with detecting qt5. I'm looking into this and I think I have a solution. Will check by using travis and will report back here.

dannyedel commented 8 years ago

I think I have a solution.

Please delete your build directory and create a fresh one.

Setting LDFLAGS or CPPFLAGS directly is not neccessary, and seems to be the cause of the problem, confusing cmake into some qt5-half-detected state.

With travis, I saw that qt5's cmake configuration file is not in the default search path, since brew still prefers qt4 over qt5.

Please try a cmake command similar to this one:

cmake -DUseQtFive=ON -DCMAKE_PREFIX_PATH=$(brew --prefix qt5) ..

then the compilation should™ continue as usual.


If the compilation works for you, I'll close the ticket. If any problems should exist in operation, please report them as own tickets.

simplygood commented 8 years ago

Thanks for looking into this. I still cannot compile with your suggestion. FYI, my homebrew qt5 was bottle-poured, not compiled from source.

$ mkdir build
$ cd build
$ cmake -DUseQtFive=ON -DCMAKE_PREFIX_PATH=$(brew --prefix qt5) ..
-- The C compiler identification is AppleClang 7.3.0.7030031
-- The CXX compiler identification is AppleClang 7.3.0.7030031
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PkgConfig: /usr/local/bin/pkg-config (found version "0.29.1")
-- Compiling for system Darwin
-- Boost version: 1.60.0
-- Found the following Boost libraries:
--   program_options
--   unit_test_framework
-- Using Qt5 and libpoppler-qt5
-- Found Qt5 at /usr/local/opt/qt5/lib/cmake/Qt5Core
-- Checking for one of the modules 'poppler-qt5'
-- Clang++ detected.
-- Building from a git clone, using git describe for a version number.
-- Embedding version number v1.15-12-g68bae4f as defined by git-describe.
-- Check if the system is big endian
-- Searching 16 bit integer
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of unsigned short
-- Check size of unsigned short - done
-- Using unsigned short
-- Check if the system is big endian - little endian
-- Building colored-rectangles.pdf from source.
-- Building images.pdf from source.
-- Building many-many-pages.pdf from source.
-- Configuring done
-- Generating done
-- Build files have been written to: ~/.git/dspdfviewer/build

$ make
Scanning dependencies of target libdspdfviewer_automoc
[  2%] Automatic moc for target libdspdfviewer
Generating moc_dspdfviewer.cpp
Generating moc_hyperlinkarea.cpp
Generating moc_pdfrenderfactory.cpp
Generating moc_pdfviewerwindow.cpp
Generating moc_renderthread.cpp
Generating moc_runtimeconfiguration.cpp
[  2%] Built target libdspdfviewer_automoc
[  4%] Generating dspdfviewer_de.qm
Updating '~/.git/dspdfviewer/build/dspdfviewer_de.qm'...
    Generated 78 translation(s) (78 finished and 0 unfinished)
[  6%] Generating ui_pdfviewerwindow.h
[  8%] Generating ui_keybindings.h
Scanning dependencies of target libdspdfviewer
[ 10%] Building CXX object CMakeFiles/libdspdfviewer.dir/adjustedlink.cpp.o
In file included from ~/.git/dspdfviewer/adjustedlink.cpp:21:
In file included from ~/.git/dspdfviewer/adjustedlink.h:23:
In file included from ~/.git/dspdfviewer/renderingidentifier.h:24:
In file included from /usr/local/opt/qt5/lib/QtCore.framework/Headers/qglobal.h:1114:
/usr/local/opt/qt5/lib/QtCore.framework/Headers/qglobalstatic.h:126:45: error: no member named 'load' in 'QBasicAtomicInt'
    bool isDestroyed() const { return guard.load() <= QtGlobalStatic::Destroyed; }
                                      ~~~~~ ^
/usr/local/opt/qt5/lib/QtCore.framework/Headers/qglobalstatic.h:127:40: error: no member named 'load' in 'QBasicAtomicInt'
    bool exists() const { return guard.load() == QtGlobalStatic::Initialized; }
                                 ~~~~~ ^
In file included from ~/.git/dspdfviewer/adjustedlink.cpp:21:
In file included from ~/.git/dspdfviewer/adjustedlink.h:23:

In file included from ~/.git/dspdfviewer/renderingidentifier.h:26:
In file included from /usr/local/opt/qt5/lib/QtCore.framework/Headers/QString:1:
In file included from /usr/local/opt/qt5/lib/QtCore.framework/Headers/qstring.h:42:
/usr/local/include/QtCore/qbytearray.h:207:5: error: unknown type name 'QBool'
    QBool contains(char c) const;
    ^
/usr/local/include/QtCore/qbytearray.h:208:5: error: unknown type name 'QBool'
    QBool contains(const char *a) const;
    ^
/usr/local/include/QtCore/qbytearray.h:209:5: error: unknown type name 'QBool'
    QBool contains(const QByteArray &a) const;
    ^
/usr/local/include/QtCore/qbytearray.h:401:57: error: use of undeclared identifier 'qFree'
inline QByteArray::~QByteArray() { if (!d->ref.deref()) qFree(d); }
                                                        ^
/usr/local/include/QtCore/qbytearray.h:523:8: error: unknown type name 'QBool'
inline QBool QByteArray::contains(const QByteArray &a) const
       ^
/usr/local/include/QtCore/qbytearray.h:524:10: error: use of undeclared identifier 'QBool'
{ return QBool(indexOf(a) != -1); }
         ^
/usr/local/include/QtCore/qbytearray.h:525:8: error: unknown type name 'QBool'
inline QBool QByteArray::contains(char c) const
       ^
/usr/local/include/QtCore/qbytearray.h:526:10: error: use of undeclared identifier 'QBool'
{ return QBool(indexOf(c) != -1); }
         ^
/usr/local/include/QtCore/qbytearray.h:575:8: error: unknown type name 'QBool'
inline QBool QByteArray::contains(const char *c) const
       ^
/usr/local/include/QtCore/qbytearray.h:576:10: error: use of undeclared identifier 'QBool'
{ return QBool(indexOf(c) != -1); }
         ^
/usr/local/include/QtCore/qbytearray.h:611:1: error: redefinition of 'QTypeInfo<QByteArray>'
Q_DECLARE_SHARED(QByteArray)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/opt/qt5/lib/QtCore.framework/Headers/qtypeinfo.h:254:32: note: expanded from macro 'Q_DECLARE_SHARED'
#define Q_DECLARE_SHARED(TYPE) Q_DECLARE_SHARED_IMPL(TYPE, Q_MOVABLE_TYPE)
                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/opt/qt5/lib/QtCore.framework/Headers/qtypeinfo.h:249:44: note: expanded from macro 'Q_DECLARE_SHARED_IMPL'
#define Q_DECLARE_SHARED_IMPL(TYPE, FLAGS) \
                                           ^
/usr/local/opt/qt5/lib/QtCore.framework/Headers/qtypeinfo.h:225:12: note: expanded from macro '\
Q_DECLARE_TYPEINFO'
template<> \
           ^
/usr/local/opt/qt5/lib/QtCore.framework/Headers/qtypeinfo.h:208:7: note: expanded from macro '\
Q_DECLARE_TYPEINFO_BODY'
class QTypeInfo<TYPE > \
      ^~~~~~~~~~~~~~~~
/usr/local/include/QtCore/qbytearray.h:610:1: note: previous definition is here
Q_DECLARE_TYPEINFO(QByteArray, Q_MOVABLE_TYPE);
^
/usr/local/opt/qt5/lib/QtCore.framework/Headers/qtypeinfo.h:225:12: note: expanded from macro 'Q_DECLARE_TYPEINFO'
template<> \
           ^
/usr/local/opt/qt5/lib/QtCore.framework/Headers/qtypeinfo.h:208:7: note: expanded from macro '\
Q_DECLARE_TYPEINFO_BODY'
class QTypeInfo<TYPE > \
      ^
In file included from ~/.git/dspdfviewer/adjustedlink.cpp:21:
In file included from ~/.git/dspdfviewer/adjustedlink.h:23:
In file included from ~/.git/dspdfviewer/renderingidentifier.h:26:
In file included from /usr/local/opt/qt5/lib/QtCore.framework/Headers/QString:1:
In file included from /usr/local/opt/qt5/lib/QtCore.framework/Headers/qstring.h:43:
/usr/local/opt/qt5/lib/QtCore.framework/Headers/qrefcount.h:49:28: error: no member named 'load' in 'QBasicAtomicInt'
        int count = atomic.load();
                    ~~~~~~ ^
/usr/local/opt/qt5/lib/QtCore.framework/Headers/qrefcount.h:60:28: error: no member named 'load' in 'QBasicAtomicInt'
        int count = atomic.load();
                    ~~~~~~ ^
/usr/local/opt/qt5/lib/QtCore.framework/Headers/qrefcount.h:83:23: error: no member named 'load' in 'QBasicAtomicInt'
        return atomic.load() != 0;
               ~~~~~~ ^
/usr/local/opt/qt5/lib/QtCore.framework/Headers/qrefcount.h:90:23: error: no member named 'load' in 'QBasicAtomicInt'
        return atomic.load() == -1;
               ~~~~~~ ^
/usr/local/opt/qt5/lib/QtCore.framework/Headers/qrefcount.h:95:28: error: no member named 'load' in 'QBasicAtomicInt'
        int count = atomic.load();
                    ~~~~~~ ^
/usr/local/opt/qt5/lib/QtCore.framework/Headers/qrefcount.h:99:52: error: no member named 'store' in 'QBasicAtomicInt'
    void initializeOwned() Q_DECL_NOTHROW { atomic.store(1); }
                                            ~~~~~~ ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make[2]: *** [CMakeFiles/libdspdfviewer.dir/adjustedlink.cpp.o] Error 1
make[1]: *** [CMakeFiles/libdspdfviewer.dir/all] Error 2
make: *** [all] Error 2
$
wwwdata commented 8 years ago

hm, the pre-compiled dspdfviewer version in homebrew was compiled with qt4 afaik. I also didn't properly get it running with qt5. But I can try to compile it as well and maybe we can then finally upgrade the homebrew formula to a qt5 and pre-compiled (bottled) qt5 version.

dannyedel commented 8 years ago

On travis-ci, current master builds against qt5 without issues.

There, the qt5 is also from a bottle, the only thing actually compiled is poppler, because that gets installed with a --with-qt5 flag, which in turn disables bottles.

Maybe this is compiler version specific? On Travis, it uses /usr/bin/clang++ which identifies as AppleClang 6.0.0.6000054, while in your build it says /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ and AppleClang 7.3.0.7030031.

In essense, the commands used are

brew install poppler --with-qt5
mkdir build
cd build
cmake -DRunDualScreenTests=OFF -DUseQtFive=ON -DCMAKE_PREFIX_PATH=$(brew --prefix qt5) ..
make
ctest --output-on-failure --timeout 60

On travis, brew --prefix qt5 results in /usr/local/opt/qt5.

dannyedel commented 8 years ago

@wwwdata I think you can use this syntax to let the user specify whether to build against qt4 or qt5. You can choose better than me which should be the default on OS X, but I'm planning to drop qt4 support in one of the next releases, and it is now considered deprecated.

dannyedel commented 8 years ago

@wwwdata try this as a starting point https://github.com/dannyedel/formula-dspdf/blob/master/dspdfviewer.rb -- it compiles in travis' default Mac OS image. You may need to backport https://github.com/dannyedel/dspdfviewer/commit/4092d6e20f9a0c79739c5131e1e1c38a413f734f.patch from #176 for elcapitan.

@simplygood I can now reproduce a compile error (although not the exact one you have), when I ask travis to use xcode7.3, which runs on OS X 10.11 and has the exact same compiler version as you. See #176 for details. Lets hope this fixes things, or at least helps @wwwdata to refresh the prebuilt binary to v1.15.

wwwdata commented 8 years ago

thanks for the headstart formula @dannyedel I could actually compile dspdfviewer with qt5 on my OS X 10.11 without any problems. It was just necessary to set the correct args that you did. I'll try to go through the official update process in homebrew so we can officially merge the newer version in.

wwwdata commented 8 years ago

I opened a PR with the updated formular that build on my local machine. Let's see if homebrews tests do all pass as well.

simplygood commented 8 years ago

Even with the #176 patch from @wwwdata, I still can't.

simplygood commented 8 years ago

I found that homebrew has a bottle (prebuilt binary) now. Thanks!