mrkite / TerraFirma

Mapping for Terraria
http://seancode.com/terrafirma
BSD 2-Clause "Simplified" License
278 stars 61 forks source link

OS X Compiling errors with qt5 from homebrew #30

Closed safetypins closed 8 years ago

safetypins commented 8 years ago

So, I originally had an issue running the qmake command, but after the inclusion of the icns file, that error has been resolved, and it is now replaced by:

/usr/local/Cellar/qt5/5.5.1_2/bin/uic mainwindow.ui -o ui_mainwindow.h
/usr/local/Cellar/qt5/5.5.1_2/bin/uic settingsdialog.ui -o ui_settingsdialog.h
/usr/local/Cellar/qt5/5.5.1_2/bin/uic infodialog.ui -o ui_infodialog.h
/usr/local/Cellar/qt5/5.5.1_2/bin/uic killdialog.ui -o ui_killdialog.h
/usr/local/Cellar/qt5/5.5.1_2/bin/uic chestview.ui -o ui_chestview.h
/usr/local/Cellar/qt5/5.5.1_2/bin/uic signview.ui -o ui_signview.h
/usr/local/Cellar/qt5/5.5.1_2/bin/uic findchests.ui -o ui_findchests.h
/usr/local/Cellar/qt5/5.5.1_2/bin/uic hilitedialog.ui -o ui_hilitedialog.h
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -c -pipe -std=c++11 -O2 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -mmacosx-version-min=10.7 -Wall -W -fPIC -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -I/usr/local/Cellar/qt5/5.5.1_2/lib/QtWidgets.framework/Headers -I/usr/local/Cellar/qt5/5.5.1_2/lib/QtGui.framework/Headers -I/usr/local/Cellar/qt5/5.5.1_2/lib/QtCore.framework/Headers -I. -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/OpenGL.framework/Headers -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/AGL.framework/Headers -I. -I/usr/local/Cellar/qt5/5.5.1_2/mkspecs/macx-clang -F/usr/local/Cellar/qt5/5.5.1_2/lib -o main.o main.cpp
In file included from main.cpp:7:
In file included from /usr/local/Cellar/qt5/5.5.1_2/lib/QtWidgets.framework/Headers/QApplication:1:
In file included from /usr/local/Cellar/qt5/5.5.1_2/lib/QtWidgets.framework/Headers/qapplication.h:37:
In file included from /usr/local/Cellar/qt5/5.5.1_2/lib/QtCore.framework/Headers/qcoreapplication.h:38:
/usr/local/Cellar/qt5/5.5.1_2/lib/QtCore.framework/Headers/qstring.h:739:55: error: no type named 'u16string' in namespace 'std'
    static inline QString fromStdU16String(const std::u16string &s);
                                                 ~~~~~^
/usr/local/Cellar/qt5/5.5.1_2/lib/QtCore.framework/Headers/qstring.h:740:17: error: no type named 'u16string' in namespace 'std'
    inline std::u16string toStdU16String() const;
           ~~~~~^
/usr/local/Cellar/qt5/5.5.1_2/lib/QtCore.framework/Headers/qstring.h:741:55: error: no type named 'u32string' in namespace 'std'
    static inline QString fromStdU32String(const std::u32string &s);
                                                 ~~~~~^
/usr/local/Cellar/qt5/5.5.1_2/lib/QtCore.framework/Headers/qstring.h:742:17: error: no type named 'u32string' in namespace 'std'
    inline std::u32string toStdU32String() const;
           ~~~~~^
/usr/local/Cellar/qt5/5.5.1_2/lib/QtCore.framework/Headers/qstring.h:1307:53: error: no type named 'u16string' in namespace 'std'
inline QString QString::fromStdU16String(const std::u16string &s)
                                               ~~~~~^
/usr/local/Cellar/qt5/5.5.1_2/lib/QtCore.framework/Headers/qstring.h:1310:13: error: no type named 'u16string' in namespace 'std'
inline std::u16string QString::toStdU16String() const
       ~~~~~^
/usr/local/Cellar/qt5/5.5.1_2/lib/QtCore.framework/Headers/qstring.h:1311:15: error: no member named 'u16string' in namespace 'std'
{ return std::u16string(reinterpret_cast<const char16_t*>(utf16()), length()); }
         ~~~~~^
/usr/local/Cellar/qt5/5.5.1_2/lib/QtCore.framework/Headers/qstring.h:1313:53: error: no type named 'u32string' in namespace 'std'
inline QString QString::fromStdU32String(const std::u32string &s)
                                               ~~~~~^
/usr/local/Cellar/qt5/5.5.1_2/lib/QtCore.framework/Headers/qstring.h:1316:13: error: no type named 'u32string' in namespace 'std'
inline std::u32string QString::toStdU32String() const
       ~~~~~^
/usr/local/Cellar/qt5/5.5.1_2/lib/QtCore.framework/Headers/qstring.h:1318:19: error: expected ';' after expression
    std::u32string u32str(length(), char32_t(0));
                  ^
                  ;
/usr/local/Cellar/qt5/5.5.1_2/lib/QtCore.framework/Headers/qstring.h:1318:10: error: no member named 'u32string' in namespace 'std'
    std::u32string u32str(length(), char32_t(0));
    ~~~~~^
/usr/local/Cellar/qt5/5.5.1_2/lib/QtCore.framework/Headers/qstring.h:1318:20: error: use of undeclared identifier 'u32str'
    std::u32string u32str(length(), char32_t(0));
                   ^
/usr/local/Cellar/qt5/5.5.1_2/lib/QtCore.framework/Headers/qstring.h:1319:75: error: use of undeclared identifier 'u32str'
    int len = toUcs4_helper(d->data(), length(), reinterpret_cast<uint*>(&u32str[0]));
                                                                          ^
/usr/local/Cellar/qt5/5.5.1_2/lib/QtCore.framework/Headers/qstring.h:1320:5: error: use of undeclared identifier 'u32str'
    u32str.resize(len);
    ^
/usr/local/Cellar/qt5/5.5.1_2/lib/QtCore.framework/Headers/qstring.h:1321:12: error: use of undeclared identifier 'u32str'
    return u32str;
           ^
In file included from main.cpp:7:
In file included from /usr/local/Cellar/qt5/5.5.1_2/lib/QtWidgets.framework/Headers/QApplication:1:
In file included from /usr/local/Cellar/qt5/5.5.1_2/lib/QtWidgets.framework/Headers/qapplication.h:45:
In file included from /usr/local/Cellar/qt5/5.5.1_2/lib/QtGui.framework/Headers/qguiapplication.h:40:
In file included from /usr/local/Cellar/qt5/5.5.1_2/lib/QtCore.framework/Headers/qlocale.h:37:
In file included from /usr/local/Cellar/qt5/5.5.1_2/lib/QtCore.framework/Headers/qvariant.h:41:
In file included from /usr/local/Cellar/qt5/5.5.1_2/lib/QtCore.framework/Headers/qmap.h:40:
/usr/local/Cellar/qt5/5.5.1_2/lib/QtCore.framework/Headers/qpair.h:62:44: error: no member named 'declval' in namespace 'std'
        Q_DECL_NOEXCEPT_EXPR(noexcept(std::declval<T1&>() = p.first) && noexcept(std::declval<T2&>() = p.second))
                                      ~~~~~^
/usr/local/Cellar/qt5/5.5.1_2/lib/QtCore.framework/Headers/qcompilerdetection.h:1027:43: note: expanded from macro 'Q_DECL_NOEXCEPT_EXPR'
# define Q_DECL_NOEXCEPT_EXPR(x) noexcept(x)
                                          ^
In file included from main.cpp:7:
In file included from /usr/local/Cellar/qt5/5.5.1_2/lib/QtWidgets.framework/Headers/QApplication:1:
In file included from /usr/local/Cellar/qt5/5.5.1_2/lib/QtWidgets.framework/Headers/qapplication.h:45:
In file included from /usr/local/Cellar/qt5/5.5.1_2/lib/QtGui.framework/Headers/qguiapplication.h:40:
In file included from /usr/local/Cellar/qt5/5.5.1_2/lib/QtCore.framework/Headers/qlocale.h:37:
In file included from /usr/local/Cellar/qt5/5.5.1_2/lib/QtCore.framework/Headers/qvariant.h:41:
In file included from /usr/local/Cellar/qt5/5.5.1_2/lib/QtCore.framework/Headers/qmap.h:40:
/usr/local/Cellar/qt5/5.5.1_2/lib/QtCore.framework/Headers/qpair.h:62:52: error: 'T1' does not refer to a value
        Q_DECL_NOEXCEPT_EXPR(noexcept(std::declval<T1&>() = p.first) && noexcept(std::declval<T2&>() = p.second))
                                                   ^
/usr/local/Cellar/qt5/5.5.1_2/lib/QtCore.framework/Headers/qcompilerdetection.h:1027:43: note: expanded from macro 'Q_DECL_NOEXCEPT_EXPR'
# define Q_DECL_NOEXCEPT_EXPR(x) noexcept(x)
                                          ^
/usr/local/Cellar/qt5/5.5.1_2/lib/QtCore.framework/Headers/qpair.h:42:17: note: declared here
template <class T1, class T2>
                ^
/usr/local/Cellar/qt5/5.5.1_2/lib/QtCore.framework/Headers/qpair.h:62:55: error: expected expression
        Q_DECL_NOEXCEPT_EXPR(noexcept(std::declval<T1&>() = p.first) && noexcept(std::declval<T2&>() = p.second))
                                                      ^
/usr/local/Cellar/qt5/5.5.1_2/lib/QtCore.framework/Headers/qcompilerdetection.h:1027:43: note: expanded from macro 'Q_DECL_NOEXCEPT_EXPR'
# define Q_DECL_NOEXCEPT_EXPR(x) noexcept(x)
                                          ^
In file included from main.cpp:7:
In file included from /usr/local/Cellar/qt5/5.5.1_2/lib/QtWidgets.framework/Headers/QApplication:1:
In file included from /usr/local/Cellar/qt5/5.5.1_2/lib/QtWidgets.framework/Headers/qapplication.h:45:
In file included from /usr/local/Cellar/qt5/5.5.1_2/lib/QtGui.framework/Headers/qguiapplication.h:40:
In file included from /usr/local/Cellar/qt5/5.5.1_2/lib/QtCore.framework/Headers/qlocale.h:37:
In file included from /usr/local/Cellar/qt5/5.5.1_2/lib/QtCore.framework/Headers/qvariant.h:41:
In file included from /usr/local/Cellar/qt5/5.5.1_2/lib/QtCore.framework/Headers/qmap.h:40:
/usr/local/Cellar/qt5/5.5.1_2/lib/QtCore.framework/Headers/qpair.h:62:57: error: expected expression
        Q_DECL_NOEXCEPT_EXPR(noexcept(std::declval<T1&>() = p.first) && noexcept(std::declval<T2&>() = p.second))
                                                        ^
/usr/local/Cellar/qt5/5.5.1_2/lib/QtCore.framework/Headers/qcompilerdetection.h:1027:43: note: expanded from macro 'Q_DECL_NOEXCEPT_EXPR'
# define Q_DECL_NOEXCEPT_EXPR(x) noexcept(x)
                                          ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [main.o] Error 1

So, as I said in the title, I installed qmake via homebrew instead of the recommended way of compiling it myself. Can you tell from this error message if that is the problem?

paul commented 8 years ago

I got the same error, I had to re-install qt5 from homebrew with the -static flag set, and then it got a little further, now its complaining about:

glmap.cpp:454:33: error: use of undeclared identifier 'floor'
  scale = qMin(width, height) / floor(zoom);
mojotx commented 8 years ago

The way to fix the glmap.cpp issue is to add an include for cmath. I also had to make some tweaks to the TerraFirma.pro file to get it to compile under El Capitan.

I have the application so that it compiles and runs, but it's not working. I get a grey screen with no graphics whatsoever. Feel free to see my forked repository, and look in the "mjarvis-osx-fixes" branch.

diff --git a/glmap.cpp b/glmap.cpp
index f8c789e..603c79e 100644
--- a/glmap.cpp
+++ b/glmap.cpp
@@ -12,6 +12,7 @@
 #include <QSettings>
 #include <QSurfaceFormat>
 #include "./uvrules.h"
+#include <cmath>

 /*
  * Drawing order:
mojotx commented 8 years ago

Here's my full diff of what I've changed so far. Note that you will need to install to /usr/local instead of /usr, because of System Integrity Protection in OS X El Capitan. That's generally a best practice for Linux as well, IMHO. I also had to tell qmake to add the c++11 flag.

diff --git a/Terrafirma.pro b/Terrafirma.pro
index 4e7e238..169e2b5 100644
--- a/Terrafirma.pro
+++ b/Terrafirma.pro
@@ -1,4 +1,5 @@
 QT       += core gui
+CONFIG += c++11

 greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

@@ -86,9 +87,9 @@ RESOURCES += \
 DISTFILES +=

-desktopfile.path = /usr/share/applications
+desktopfile.path = /usr/local/share/applications
 desktopfile.files = terrafirma.desktop
-pixmapfile.path = /usr/share/pixmaps
+pixmapfile.path = /usr/local/share/pixmaps
 pixmapfile.files = terrafirma.png
-target.path = /usr/bin
+target.path = /usr/local/bin
 INSTALLS += desktopfile pixmapfile target
diff --git a/glmap.cpp b/glmap.cpp
index f8c789e..603c79e 100644
--- a/glmap.cpp
+++ b/glmap.cpp
@@ -12,6 +12,7 @@
 #include <QSettings>
 #include <QSurfaceFormat>
 #include "./uvrules.h"
+#include <cmath>

 /*
  * Drawing order:
mrkite commented 8 years ago

All changes have been merged.. and I went ahead and made a binary for El Capitan, it's on the website.