Bug 220188 - devel/qt5-script: disable usage of c++1z for JavaScriptCore
Summary: devel/qt5-script: disable usage of c++1z for JavaScriptCore
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: kde
URL:
Keywords:
Depends on:
Blocks: 219139
  Show dependency treegraph
 
Reported: 2017-06-21 17:02 UTC by Dimitry Andric
Modified: 2017-06-22 17:19 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (kde)


Attachments
Use -std=c++14 for devel/qt5-script to avoid errors in JavaScriptCore (1.05 KB, patch)
2017-06-21 17:02 UTC, Dimitry Andric
no flags Details | Diff
Use unique_ptr instead of auto_ptr (8.17 KB, patch)
2017-06-21 18:49 UTC, Tobias C. Berner
no flags Details | Diff
Fall back to not using c++1z (1.18 KB, patch)
2017-06-21 19:53 UTC, Tobias C. Berner
tcberner: maintainer-approval+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dimitry Andric freebsd_committer 2017-06-21 17:02:10 UTC
Created attachment 183678 [details]
Use -std=c++14 for devel/qt5-script to avoid errors in JavaScriptCore

During an exp-run for the projects/clang500-import branch (bug 219139), it turned out that devel/qt5-script does not build against libc++ 5.0.0 [1]:

In file included from ../3rdparty/javascriptcore/JavaScriptCore/pcre/pcre_exec.cpp:50:
In file included from ../3rdparty/javascriptcore/JavaScriptCore/wtf/Vector.h:27:
In file included from ../3rdparty/javascriptcore/JavaScriptCore/wtf/VectorTraits.h:24:
../3rdparty/javascriptcore/JavaScriptCore/wtf/OwnPtr.h:43:21: error: no template named 'auto_ptr' in namespace 'std'
        OwnPtr(std::auto_ptr<ValueType> autoPtr) : m_ptr(autoPtr.release()) { }
               ~~~~~^
../3rdparty/javascriptcore/JavaScriptCore/wtf/OwnPtr.h:61:25: error: no template named 'auto_ptr' in namespace 'std'
        void adopt(std::auto_ptr<ValueType> autoPtr) { ASSERT(!autoPtr.get() || m_ptr != autoPtr.get()); deleteOwnedPtr(m_ptr); m_ptr = autoPtr.release(); }
                   ~~~~~^
In file included from ../3rdparty/javascriptcore/JavaScriptCore/pcre/pcre_exec.cpp:50:
In file included from ../3rdparty/javascriptcore/JavaScriptCore/wtf/Vector.h:27:
../3rdparty/javascriptcore/JavaScriptCore/wtf/VectorTraits.h:84:30: error: no member named 'auto_ptr' in namespace 'std'
    struct VectorTraits<std::auto_ptr<P> > : SimpleClassVectorTraits { };
                        ~~~~~^
../3rdparty/javascriptcore/JavaScriptCore/wtf/VectorTraits.h:84:39: error: 'P' does not refer to a value
    struct VectorTraits<std::auto_ptr<P> > : SimpleClassVectorTraits { };
                                      ^
../3rdparty/javascriptcore/JavaScriptCore/wtf/VectorTraits.h:83:23: note: declared here
    template<typename P>
                      ^
4 errors generated.

This is because devel/qmake and/or devel/qt5-buildtools have detected -std=c++1z support, and are using it by default.  However, the JavaScriptCore parts of qt5-script are from a third party, and this source is *not* C++1z compatible.  For example, std::auto_ptr has long been deprecated, but is actually removed from C++1z now.

I tried various methods of convincing qmake to use a lower C++ standard, and the best I could come up with was adding a line:

QT_CONFIG -= c++1z

to src/3rdparty/javascriptcore/JavaScriptCore/JavaScriptCore.pri, as in the attached patch.  If there is a better way, I would be glad to hear it. :)

[1] http://package18.nyi.freebsd.org/data/headamd64PR219139-default/2017-05-22_13h01m42s/logs/errors/qt5-script-5.7.1.log
Comment 1 Tobias C. Berner freebsd_committer 2017-06-21 18:49:03 UTC
Created attachment 183686 [details]
Use unique_ptr instead of auto_ptr

annulen suggested in #qt to try to use unique_ptr -- could you give the attached patch a go?

mfg Tobias
Comment 2 Tobias C. Berner freebsd_committer 2017-06-21 19:53:17 UTC
Created attachment 183690 [details]
Fall back to not using c++1z

As JSC has no active upstream, the unique_ptr patch did not make any sense, unfortunately. So instead set CONFIG-=c++1z as you originally suggested.
Comment 3 commit-hook freebsd_committer 2017-06-21 21:25:33 UTC
A commit references this bug:

Author: dim
Date: Wed Jun 21 21:25:25 UTC 2017
New revision: 444079
URL: https://svnweb.freebsd.org/changeset/ports/444079

Log:
  Disable usage of c++1z (c++17) for qt5-script, as the third-party
  JavaScriptCore code is not fully compatible with it.  This is a
  requirement for using libc++ 5.0.0, which is more strict.

  Approved by:	tcberner (maintainer)
  PR:		220188
  MFH:		2017Q2

Changes:
  head/devel/qt5-script/files/patch-cr198221
Comment 4 Dimitry Andric freebsd_committer 2017-06-21 21:29:47 UTC
The alternative patch works fine too, thanks.
Comment 5 commit-hook freebsd_committer 2017-06-22 17:19:41 UTC
A commit references this bug:

Author: dim
Date: Thu Jun 22 17:19:08 UTC 2017
New revision: 444122
URL: https://svnweb.freebsd.org/changeset/ports/444122

Log:
  MFH: r444079

  Disable usage of c++1z (c++17) for qt5-script, as the third-party
  JavaScriptCore code is not fully compatible with it.  This is a
  requirement for using libc++ 5.0.0, which is more strict.

  Approved by:	portmgr (feld)
  PR:		220188

Changes:
_U  branches/2017Q2/
  branches/2017Q2/devel/qt5-script/files/patch-cr198221