Bug 126325 - [GTK] Use libc++ for C++11 on darwin
Summary: [GTK] Use libc++ for C++11 on darwin
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Zan Dobersek
URL:
Keywords:
Depends on:
Blocks: 126492 126431
  Show dependency treegraph
 
Reported: 2013-12-30 21:15 PST by Jeremy Huddleston Sequoia
Modified: 2014-01-06 00:52 PST (History)
3 users (show)

See Also:


Attachments
Patch (1.74 KB, patch)
2014-01-05 01:39 PST, Zan Dobersek
no flags Details | Formatted Diff | Diff
Patch (1.73 KB, patch)
2014-01-05 05:07 PST, Zan Dobersek
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jeremy Huddleston Sequoia 2013-12-30 21:15:24 PST
webkit-gtk tries to use libstdc++ for C++11 even though OS X's libstdc++ doesn't support C++11.

What is the point of this?  The comment makes it look intentional.

# Use the C++11 standard. Do not warn about C++11 incompatibilities.
CXXFLAGS="$CXXFLAGS -pthread -std=c++11 -Wno-c++11-compat"

...

# libstdc++ is at the moment the only option as the C++ standard library when compiling with Clang.
# -Wno-c++11-extensions, currently only usable with Clang, suppresses warnings of C++11 extensions in use.
# Suppress unused arguments warnings for C++ files as well.
if test "$cxx_compiler" = "clang++"; then
   CXXFLAGS="$CXXFLAGS -stdlib=libstdc++ -Wno-c++11-extensions -Qunused-arguments"
fi

---

/usr/bin/clang++ -DHAVE_CONFIG_H -I. -Wall -W -Wcast-align -Wchar-subscripts -Wreturn-type -Wformat -Wformat-security -Wno-format-y2k -Wundef -Wmissing-format-attribute -Wpointer-arith -Wwrite-strings -Wno-unused-parameter -Wno-parentheses -fno-exceptions -DBUILDING_CAIRO__ -DBUILDING_GTK__ -I./Source -I./Source/WTF -I./Source/WTF/wtf -DGTEST_USE_OWN_TR1_TUPLE=1 -fno-rtti -fstrict-aliasing -O3 -D_REENTRANT -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local/include -I/opt/local/include -pipe -Os -Wno-c++11-extensions -arch x86_64 -pthread -std=c++11 -Wno-c++11-compat -stdlib=libstdc++ -Wno-c++11-extensions -Qunused-arguments -O2 -MT Source/WTF/wtf/libWTF_la-Compression.lo -MD -MP -MF Source/WTF/wtf/.deps/libWTF_la-Compression.Tpo -c Source/WTF/wtf/Compression.cpp  -fno-common -DPIC -o Source/WTF/wtf/.libs/libWTF_la-Compression.o
In file included from Source/WTF/wtf/Compression.cpp:28:
In file included from ./Source/WTF/wtf/Compression.h:30:
In file included from ./Source/WTF/wtf/Vector.h:31:
In file included from ./Source/WTF/wtf/VectorTraits.h:26:
./Source/WTF/wtf/RefPtr.h:149:27: error: no member named 'move' in namespace 'std'
       RefPtr ptr = std::move(o);
                    ~~~~~^
./Source/WTF/wtf/RefPtr.h:156:27: error: no member named 'move' in namespace 'std'
       RefPtr ptr = std::move(o);
                    ~~~~~^
2 errors generated.

$ sudo /usr/bin/clang++ -DHAVE_CONFIG_H -I. -Wall -W -Wcast-align -Wchar-subscripts -Wreturn-type -Wformat -Wformat-security -Wno-format-y2k -Wundef -Wmissing-format-attribute -Wpointer-arith -Wwrite-strings -Wno-unused-parameter -Wno-parentheses -fno-exceptions -DBUILDING_CAIRO__ -DBUILDING_GTK__ -I./Source -I./Source/WTF -I./Source/WTF/wtf -DGTEST_USE_OWN_TR1_TUPLE=1 -fno-rtti -fstrict-aliasing -O3 -D_REENTRANT -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local/include -I/opt/local/include -pipe -Os -Wno-c++11-extensions -arch x86_64 -pthread -std=c++11 -Wno-c++11-compat -stdlib=libc++ -Wno-c++11-extensions -Qunused-arguments -O2 -MT Source/WTF/wtf/libWTF_la-Compression.lo -MD -MP -MF Source/WTF/wtf/.deps/libWTF_la-Compression.Tpo -c Source/WTF/wtf/Compression.cpp  -fno-common -DPIC -o Source/WTF/wtf/.libs/libWTF_la-Compression.o

---

We're using libc++ for webkit-gtk-2.2.x in MacPorts without any issues reported.
Comment 1 Zan Dobersek 2013-12-31 01:22:20 PST
I think we can switch to libc++ on all platforms when compiling with Clang.
Comment 2 Michael Catanzaro 2013-12-31 08:38:42 PST
Some distributions (e.g. Fedora) ship Clang but not libc++.
Comment 3 Jeremy Huddleston Sequoia 2014-01-03 10:28:32 PST
Related to https://bugs.webkit.org/show_bug.cgi?id=126431
Comment 4 Zan Dobersek 2014-01-05 01:24:07 PST
I think we could default to libc++ on Darwin and stop passing the -stdlib option to the Clang compiler on other platforms. The option could still be enforced manually through the CXXFLAGS env.
Comment 5 Zan Dobersek 2014-01-05 01:39:54 PST
Created attachment 220392 [details]
Patch
Comment 6 Jeremy Huddleston Sequoia 2014-01-05 03:03:58 PST
My one suggestion is that you don't add -stdlib=libc++ if CXXFLAGS already contains "-stdlib="
Comment 7 Zan Dobersek 2014-01-05 05:07:21 PST
Created attachment 220396 [details]
Patch
Comment 8 Martin Robinson 2014-01-05 09:58:12 PST
Comment on attachment 220396 [details]
Patch

I'm actually a bit surprised we need the standard library.
Comment 9 Zan Dobersek 2014-01-06 00:52:51 PST
Comment on attachment 220396 [details]
Patch

Clearing flags on attachment: 220396

Committed r161333: <http://trac.webkit.org/changeset/161333>
Comment 10 Zan Dobersek 2014-01-06 00:52:57 PST
All reviewed patches have been landed.  Closing bug.