I know the trees locked right now, but I thought I'd send this out now so it doesn't get lost.
Right now, clang++ tries to use libstdc++ from base (from g++ 4.2.1), but even incredibly trivial programs fail to compile with it (e.g., hello world using iostream). Using the libstdc++ from ports (i.e., g++ 4.2.4) seems to work much better. Anyway, the hacky diff below makes a few changes: 1. Searches for C++ header files from and links against ports libstdc++ instead of base libstdc++. (Also, FWIW, libstdc++ 4.2.4 appears to still be GPL2+, not GPL3+ like the rest of GCC 4.2.4; maybe worth investigating bringing into base.) 2. When linking with -pthread, pass -lpthread to ld(1) instead of -pthread. 3. Eliminates the -L/opt/gcc4/... patch hunk that only affected AuroraUX's driver code, not OpenBSD's. I expect the literal "/usr/local" strings will need to be fixed somehow, but not sure the best solution. Also, I feel weird about adding -L/usr/local/lib to the linker line, but eg++ already has this behavior, so maybe it's okay (and should be done by default, not just for C++ code). I can't yet build Chromium with this diff (weird segmentation faults in resulting executables that I haven't investigated yet), but it at least gets further than crashing on the very first C++ file. :) Index: patches/patch-tools_clang_lib_Driver_Tools_cpp =================================================================== RCS file: /cvs/ports/devel/llvm/patches/patch-tools_clang_lib_Driver_Tools_cpp,v retrieving revision 1.6 diff -N -u -p patches/patch-tools_clang_lib_Driver_Tools_cpp --- patches/patch-tools_clang_lib_Driver_Tools_cpp 13 Jan 2011 00:15:50 -0000 1.6 +++ patches/patch-tools_clang_lib_Driver_Tools_cpp 15 Feb 2011 18:50:21 -0000 @@ -1,12 +1,22 @@ $OpenBSD: patch-tools_clang_lib_Driver_Tools_cpp,v 1.6 2011/01/13 00:15:50 jeremy Exp $ --- tools/clang/lib/Driver/Tools.cpp.orig Thu Sep 2 16:59:25 2010 -+++ tools/clang/lib/Driver/Tools.cpp Thu Jan 6 11:29:39 2011 -@@ -2631,7 +2631,7 @@ void auroraux::Link::ConstructJob(Compilation &C, cons ++++ tools/clang/lib/Driver/Tools.cpp Mon Feb 14 17:32:05 2011 +@@ -2778,7 +2778,8 @@ + if (!Args.hasArg(options::OPT_nostdlib) && + !Args.hasArg(options::OPT_nodefaultlibs)) { + if (D.CCCIsCXX) { +- CmdArgs.push_back("-lstdc++"); ++ CmdArgs.push_back("-L/usr/local/lib"); ++ CmdArgs.push_back("-lestdc++"); + CmdArgs.push_back("-lm"); + } - CmdArgs.push_back(Args.MakeArgString("-L/opt/gcc4/lib/gcc/" - + getToolChain().getTripleString() -- + "/4.2.4")); -+ + "/4.2.1")); +@@ -2787,7 +2788,7 @@ + CmdArgs.push_back("-lgcc"); - Args.AddAllArgs(CmdArgs, options::OPT_L); - Args.AddAllArgs(CmdArgs, options::OPT_T_Group); + if (Args.hasArg(options::OPT_pthread)) +- CmdArgs.push_back("-pthread"); ++ CmdArgs.push_back("-lpthread"); + if (!Args.hasArg(options::OPT_shared)) + CmdArgs.push_back("-lc"); + CmdArgs.push_back("-lgcc"); Index: patches/patch-tools_clang_lib_Frontend_InitHeaderSearch_cpp =================================================================== RCS file: /cvs/ports/devel/llvm/patches/Attic/patch-tools_clang_lib_Frontend_InitHeaderSearch_cpp,v diff -N -u -p patches/patch-tools_clang_lib_Frontend_InitHeaderSearch_cpp --- /dev/null 15 Feb 2011 11:50:21 -0000 +++ patches/patch-tools_clang_lib_Frontend_InitHeaderSearch_cpp 15 Feb 2011 18:50:21 -0000 @@ -0,0 +1,12 @@ +$OpenBSD$ +--- tools/clang/lib/Frontend/InitHeaderSearch.cpp.orig Fri Sep 3 09:45:53 2010 ++++ tools/clang/lib/Frontend/InitHeaderSearch.cpp Mon Feb 14 16:27:35 2011 +@@ -751,7 +751,7 @@ + std::string t = triple.getTriple(); + if (t.substr(0, 6) == "x86_64") + t.replace(0, 6, "amd64"); +- AddGnuCPlusPlusIncludePaths("/usr/include/g++", ++ AddGnuCPlusPlusIncludePaths("/usr/local/include/c++/4.2.4", + t, "", "", triple); + break; + }