Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#58211 closed defect (fixed)

qt56-qtbase @5.6.3_6 on Lion: error: no type named 'u16string' in namespace 'std'

Reported by: kencu (Ken) Owned by: MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)
Priority: Normal Milestone:
Component: ports Version:
Keywords: lion Cc:
Port: qt56-qtbase

Description

on the latest revbump of qt56-qtbase, I see this on Lion. It last built about a year ago without trouble, I notice. Looks like a c++ standard thing?

/opt/local/bin/clang++-mp-5.0 -c -D_GLIBCXX_USE_CXX11_ABI=0 -ffunction-sections -Os -fPIC -std=c++1z -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk -mmacosx-version-min=10.7 -fno-exceptions -Wall -W -DQT_NO_MTDEV -DQT_NO_LIBUDEV -DQT_NO_EVDEV -DQT_NO_TSLIB -DQT_NO_LIBINPUT -DQT_BOOTSTRAPPED -DQT_LITE_UNICODE -DQT_NO_CAST_TO_ASCII -DQT_NO_CODECS -DQT_NO_DATASTREAM -DQT_NO_LIBRARY -DQT_NO_QOBJECT -DQT_NO_SYSTEMLOCALE -DQT_NO_THREAD -DQT_NO_UNICODETABLES -DQT_NO_USING_NAMESPACE -DQT_NO_DEPRECATED -DQT_NO_TRANSLATION -DQT_CRYPTOGRAPHICHASH_ONLY_SHA1 -DQT_NO_CAST_FROM_ASCII -DQT_BUILD_BOOTSTRAP_LIB -DQT_BUILDING_QT -DQT_ASCII_CAST_WARNINGS -DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x050000 -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -I. -I../../../include -I../../../include/QtCore -I../../../include/QtCore/5.6.3 -I../../../include/QtCore/5.6.3/QtCore -I../../../include/QtXml -I../../../include/QtXml/5.6.3 -I../../../include/QtXml/5.6.3/QtXml -I/opt/local/include/openssl-1.0 -I../../../mkspecs/macx-clang -o .obj/qtextcodec.o ../../corelib/codecs/qtextcodec.cpp
In file included from ../../corelib/codecs/qlatincodec.cpp:34:
In file included from ../../corelib/codecs/qlatincodec_p.h:48:
In file included from ../../../include/QtCore/qtextcodec.h:1:
In file included from ../../../include/QtCore/../../src/corelib/codecs/qtextcodec.h:37:
In file included from ../../../include/QtCore/qstring.h:1:
../../../include/QtCore/../../src/corelib/tools/qstring.h:756:55: error: no type named 'u16string' in namespace 'std'
    static inline QString fromStdU16String(const std::u16string &s);
                                                 ~~~~~^
../../../include/QtCore/../../src/corelib/tools/qstring.h:757:17: error: no type named 'u16string' in namespace 'std'
    inline std::u16string toStdU16String() const;
           ~~~~~^
In file included from ../../corelib/codecs/qtextcodec.cpp:35:
In file included from ../../corelib/codecs/qtextcodec.h:37:
In file included from ../../../include/QtCore/qstring.h:1:
../../../include/QtCore/../../src/corelib/tools/qstring.h:756:55: error: no type named 'u16string' in namespace 'std'
    static inline QString fromStdU16String(const std::u16string &s);
                                                 ~~~~~^
../../../include/QtCore/../../src/corelib/tools/qstring.h:757:17: error: no type named 'u16string' in namespace 'std'
    inline std::u16string toStdU16String() const;
           ~~~~~^
../../../include/QtCore/../../src/corelib/tools/qstring.h:758:55: error: no type named 'u32string' in namespace 'std'
    static inline QString fromStdU32String(const std::u32string &s);
                                                 ~~~~~^
../../../include/QtCore/../../src/corelib/tools/qstring.h:759:17: error: no type named 'u32string' in namespace 'std'
    inline std::u32string toStdU32String() const;
           ~~~~~^
../../../include/QtCore/../../src/corelib/tools/qstring.h:1320:53: error: no type named 'u16string' in namespace 'std'
inline QString QString::fromStdU16String(const std::u16string &s)
                                               ~~~~~^
../../../include/QtCore/../../src/corelib/tools/qstring.h:1323:13: error: no type named 'u16string' in namespace 'std'
inline std::u16string QString::toStdU16String() const
       ~~~~~^
../../../include/QtCore/../../src/corelib/tools/qstring.h:1324:15: error: no member named 'u16string' in namespace 'std'
{ return std::u16string(reinterpret_cast<const char16_t*>(utf16()), length()); }
         ~~~~~^
../../../include/QtCore/../../src/corelib/tools/qstring.h:758:55: error: no type named 'u32string' in namespace 'std'
    static inline QString fromStdU32String(const std::u32string &s);
                                                 ~~~~~^
../../../include/QtCore/../../src/corelib/tools/qstring.h:759:17: error: no type named 'u32string' in namespace 'std'
    inline std::u32string toStdU32String() const;
           ~~~~~^
../../../include/QtCore/../../src/corelib/tools/qstring.h:1326:53: error: no type named 'u32string' in namespace 'std'
inline QString QString::fromStdU32String(const std::u32string &s)
                                               ~~~~~^
../../../include/QtCore/../../src/corelib/tools/qstring.h:1329:13: error: no type named 'u32string' in namespace 'std'
inline std::u32string QString::toStdU32String() const
       ~~~~~^
../../../include/QtCore/../../src/corelib/tools/qstring.h:1331:19: error: expected ';' after expression
    std::u32string u32str(length(), char32_t(0));
                  ^
                  ;
../../../include/QtCore/../../src/corelib/tools/qstring.h:1331:10: error: no member named 'u32string' in namespace 'std'
    std::u32string u32str(length(), char32_t(0));
    ~~~~~^
../../../include/QtCore/../../src/corelib/tools/qstring.h:1331:20: error: use of undeclared identifier 'u32str'
    std::u32string u32str(length(), char32_t(0));
                   ^
../../../include/QtCore/../../src/corelib/tools/qstring.h:1332:75: error: use of undeclared identifier 'u32str'
    int len = toUcs4_helper(d->data(), length(), reinterpret_cast<uint*>(&u32str[0]));
                                                                          ^
../../../include/QtCore/../../src/corelib/tools/qstring.h:1320:53: error: no type named 'u16string' in namespace 'std'
inline QString QString::fromStdU16String(const std::u16string &s)
                                               ~~~~~^
../../../include/QtCore/../../src/corelib/tools/qstring.h:1333:5: error: use of undeclared identifier 'u32str'
    u32str.resize(len);
    ^
../../../include/QtCore/../../src/corelib/tools/qstring.h:1334:12: error: use of undeclared identifier 'u32str'
    return u32str;
           ^
../../../include/QtCore/../../src/corelib/tools/qstring.h:1323:13: error: no type named 'u16string' in namespace 'std'
inline std::u16string QString::toStdU16String() const
       ~~~~~^
../../../include/QtCore/../../src/corelib/tools/qstring.h:1324:15: error: no member named 'u16string' in namespace 'std'
{ return std::u16string(reinterpret_cast<const char16_t*>(utf16()), length()); }
         ~~~~~^
../../../include/QtCore/../../src/corelib/tools/qstring.h:1326:53: error: no type named 'u32string' in namespace 'std'
inline QString QString::fromStdU32String(const std::u32string &s)
                                               ~~~~~^
../../../include/QtCore/../../src/corelib/tools/qstring.h:1329:13: error: no type named 'u32string' in namespace 'std'
inline std::u32string QString::toStdU32String() const
       ~~~~~^
../../../include/QtCore/../../src/corelib/tools/qstring.h:1331:19: error: expected ';' after expression
    std::u32string u32str(length(), char32_t(0));
                  ^
                  ;
../../../include/QtCore/../../src/corelib/tools/qstring.h:1331:10: error: no member named 'u32string' in namespace 'std'
    std::u32string u32str(length(), char32_t(0));
    ~~~~~^

Attachments (2)

qt56fail.log (407.5 KB) - added by kencu (Ken) 5 years ago.
qt56-nocxx11PG-fail.log (3.6 MB) - added by kencu (Ken) 5 years ago.
an attempt to build it on 10.7 without the cxx11 PG fails

Change History (10)

Changed 5 years ago by kencu (Ken)

Attachment: qt56fail.log added

comment:1 Changed 5 years ago by kencu (Ken)

Looks like trying to build it without c++11 isn't possible any longer:

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -c -pipe -stdlib=libstdc++ -arch x86_64 -Os -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk -mmacosx-version-min=10.7 -fvisibility=hidden -fvisibility-inlines-hidden -fno-exceptions -Wall -W -fPIC -DQT_NO_MTDEV -DQT_NO_LIBUDEV -DQT_NO_EVDEV -DQT_NO_TSLIB -DQT_NO_LIBINPUT -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_PLUGIN -DQT_PLATFORMSUPPORT_LIB -DQT_PRINTSUPPORT_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -I../../../../include -I../../../../include/QtPlatformSupport -I../../../../include/QtPlatformSupport/5.6.3 -I../../../../include/QtPlatformSupport/5.6.3/QtPlatformSupport -I../../../../include/QtPrintSupport/5.6.3 -I../../../../include/QtPrintSupport/5.6.3/QtPrintSupport -I../../../../include/QtWidgets/5.6.3 -I../../../../include/QtWidgets/5.6.3/QtWidgets -I../../../../include/QtGui/5.6.3 -I../../../../include/QtGui/5.6.3/QtGui -I../../../../include/QtPrintSupport -I../../../../include/QtWidgets -I../../../../include/QtGui -I../../../../include/QtCore/5.6.3 -I../../../../include/QtCore/5.6.3/QtCore -I../../../../include/QtCore -I.moc -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/OpenGL.framework/Headers -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/AGL.framework/Headers -isystem /opt/local/include/openssl-1.0 -I../../../../mkspecs/macx-clang -F/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_aqua_qt56/qt56-qtbase/work/qtbase-opensource-src-5.6.3/lib -o .obj/qcocoawindow.o qcocoawindow.mm

qcocoawindow.mm:275:38: error: use of undeclared identifier 'nullptr'
    NSEnumerator *windowEnumerator = nullptr;
                                     ^
qcocoawindow.mm:316:73: error: expected '>'
            QCocoaWindow *cocoaWindow = static_cast<id<QNSWindowProtocol>>(window).helper.platformWindow;
                                                                        ^
qcocoawindow.mm:316:73: error: expected '>'
            QCocoaWindow *cocoaWindow = static_cast<id<QNSWindowProtocol>>(window).helper.platformWindow;
                                                                        ^
                                                                        >
qcocoawindow.mm:316:52: note: to match this '<'
            QCocoaWindow *cocoaWindow = static_cast<id<QNSWindowProtocol>>(window).helper.platformWindow;
                                                   ^
qcocoawindow.mm:316:84: error: property 'helper' not found on object of type 'NSWindow *'
            QCocoaWindow *cocoaWindow = static_cast<id<QNSWindowProtocol>>(window).helper.platformWindow;
                                                                                   ^

Changed 5 years ago by kencu (Ken)

Attachment: qt56-nocxx11PG-fail.log added

an attempt to build it on 10.7 without the cxx11 PG fails

comment:2 Changed 5 years ago by kencu (Ken)

It appears to affect also 10.8 and 10.9 <http://packages.macports.org/qt56-qtbase/>.

I wonder if the qcc8 headers have changed in some way to cause these std:: functions from being exposed now...

comment:3 Changed 5 years ago by kencu (Ken)

This little test:

#include<iostream>
#include<string>

int main ()
{
  char16_t x[] = { 'a', 'b', 'c', 0 };
  std::u16string arr = x;

  std::cout << "arr.length = " << arr.length() << std::endl;
  for(auto i : arr)
    std::cout << i << "\n";
}

seems to compile with no troubles with these build lines, so ... ?

clang++ -std=c++11 -stdlib=macports-libstdc++ -c test.cpp
clang++ -std=c++11 -D_GLIBCXX_USE_CXX11_ABI=0 -stdlib=macports-libstdc++ -c test.cpp
clang++ -std=c++1z -D_GLIBCXX_USE_CXX11_ABI=0 -stdlib=macports-libstdc++ -c test.cpp

comment:4 Changed 5 years ago by kencu (Ken)

Ah, found it. There is no -stdlib=macports-libstdc++ in the build lines that fail. So it's just that -- we have to get that stdlib set in there somehow.

comment:5 Changed 5 years ago by kencu (Ken)

I won't claim it's the elegant fix, but in mkspecs/qmodule.pri (which seems to be generated during configure and is available post-configure) changing this line seems to get past these errors -- change:

QMAKE_CXXFLAGS = -D_GLIBCXX_USE_CXX11_ABI=0

to

QMAKE_CXXFLAGS = -stdlib=macports-libstdc++ -D_GLIBCXX_USE_CXX11_ABI=0 -arch x86_64

Let you know for sure in a few hours when qtbase is finished building on this 10.7 system. Obviously the right fix is to see how qmodule.pri is generated in the first place and fix that, but at the moment I don't know how that is done. Funny that it is already picking up the D_GLIBCXX_USE_CXX11_ABI part from somewhere, but not the stdlib bit.

comment:6 Changed 5 years ago by kencu (Ken)

That was enough to "fix" it.

$ port -v installed qt56-qtbase
The following ports are currently installed:
  qt56-qtbase @5.6.3_5+openssl platform='darwin 11' archs='x86_64' date='2018-07-21T15:01:23-0500'
  qt56-qtbase @5.6.3_6+openssl (active) platform='darwin 11' archs='x86_64' date='2019-03-20T11:16:01-0600'

I don't know exactly how Marcus would want to handle this -- fix the real issue somehow, or hack it in with a post-configure reinplace. So I'll leave this breadcrumb here for prospectors for now.

comment:7 Changed 5 years ago by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)

Resolution: fixed
Status: assignedclosed

comment:8 Changed 5 years ago by kencu (Ken)

Thanks!

Note: See TracTickets for help on using tickets.