From owner-freebsd-stable@FreeBSD.ORG Tue Jul 9 22:50:51 2013 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 6112B1FD for ; Tue, 9 Jul 2013 22:50:51 +0000 (UTC) (envelope-from jdavidlists@gmail.com) Received: from mail-ie0-x22f.google.com (mail-ie0-x22f.google.com [IPv6:2607:f8b0:4001:c03::22f]) by mx1.freebsd.org (Postfix) with ESMTP id 3900511FE for ; Tue, 9 Jul 2013 22:50:51 +0000 (UTC) Received: by mail-ie0-f175.google.com with SMTP id a11so6644247iee.6 for ; Tue, 09 Jul 2013 15:50:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:date:x-google-sender-auth:message-id:subject :from:to:content-type; bh=lSQwYofrlZiREFQ3JvkHFWtnUx7TXGLZ7pmQl1QvEmU=; b=RPC3Kd6zpQPPHZW6x898J5Qszn/L2yzr69hoCarKLZZu6N4arst6WmmC3upYm/LhGw gUpuq4CmdvhTEgPxyj7G8qojJNMukaTNz2+fg0xI7+bMcuUHD4UkS/q5PY9V7/oleMjh vWxUU1COtn3jVC3edVvn8lgJrHhM6AgukViEq1hT/5TzNDexTanSY8WbBfq1LkDLLsS1 SeuyKZyxyAybP5wEHwtcYzBkCRGozye8R01aRvY6dlJVEoieDCTcPvFBqZ4DrVtLkRiS tRPZjh9qOejftUZZxJueNRCea2Dv1poZjz23q1c+PTUuKe9iwOMGIjvnft4nwintZX0e evRw== MIME-Version: 1.0 X-Received: by 10.42.73.66 with SMTP id r2mr555702icj.9.1373410250485; Tue, 09 Jul 2013 15:50:50 -0700 (PDT) Sender: jdavidlists@gmail.com Received: by 10.42.114.73 with HTTP; Tue, 9 Jul 2013 15:50:50 -0700 (PDT) Date: Tue, 9 Jul 2013 18:50:50 -0400 X-Google-Sender-Auth: GOljlEcKHso9FVAjldEbFVKY49A Message-ID: Subject: Clang 3.3 libc++ problem on 9-STABLE From: J David To: freebsd-stable@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jul 2013 22:50:51 -0000 With SVN version r253119, we are seeing strange errors from iostream while attempting to use the new clang 3.3 with libc++ on 9-STABLE. This program: ------------------- start here ---------------------- #include int main() { std::cout << "This is a test." << std::endl; return 0; } ----------------- end here -------------------- Produces this output when compiled: $ clang++ -std=c++11 -stdlib=libc++ -v -o example example.cc FreeBSD clang version 3.3 (tags/RELEASE_33/final 183502) 20130610 Target: x86_64-unknown-freebsd9.1 Thread model: posix "/usr/bin/clang++" -cc1 -triple x86_64-unknown-freebsd9.1 -emit-obj -mrelax-all -disable-free -main-file-name example.cc -mrelocation-model static -mdisable-fp-elim -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64 -v -resource-dir /usr/bin/../lib/clang/3.3 -stdlib=libc++ -std=c++11 -fdeprecated-macro -fdebug-compilation-dir /data/jdw -ferror-limit 19 -fmessage-length 80 -mstackrealign -fobjc-runtime=gnustep -fobjc-default-synthesize-properties -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -backend-option -vectorize-loops -o /tmp/example-fet9b9.o -x c++ example.cc clang -cc1 version 3.3 based upon LLVM 3.3 default target x86_64-unknown-freebsd9.1 ignoring nonexistent directory "/usr/bin/../lib/clang/3.3/include" #include "..." search starts here: #include <...> search starts here: /usr/include/c++/v1 /usr/include/clang/3.3 /usr/include End of search list. "/usr/bin/ld" --eh-frame-hdr -dynamic-linker /libexec/ld-elf.so.1 --hash-style=both --enable-new-dtags -o example /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/crtbegin.o -L/usr/lib /tmp/example-fet9b9.o -lc++ -lm -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/crtend.o /usr/lib/crtn.o /tmp/example-fet9b9.o: In function `std::__1::basic_ostream >& std::__1::operator<< >(std::__1::basic_ostream >&, char const*)': example.cc:(.text._ZNSt3__1lsINS_11char_traitsIcEEEERNS_13basic_ostreamIcT_EES6_PKc[_ZNSt3__1lsINS_11char_traitsIcEEEERNS_13basic_ostreamIcT_EES6_PKc]+0x4b0): undefined reference to `.LBB1_29' clang++: error: linker command failed with exit code 1 (use -v to see invocation) Compiling with either -std=c++11 or -stdlib=libc++ but not both yields a ton of linker errors about the mismatches between the header files and library contents. (Expected.) Compiling with neither produces a working executable using the Gnu 4.2 headers and libstdc++. So the problem appears specific to libc++. It feels like the linker command line (shown with -v above) being generated by clang++ isn't right. I might expect to see libcxxrt.so.1 there. (It is present in /lib.) But manually adding that doesn't appear to help. What I'm less sure of is whether this is a clang issue or whether "-std=c++11 -stdlib=libc++" are simply not the right flags to be using here. (Although they are what we widely use on other platforms, e.g. Mac, and appear to be trying to get the right include files and library here, namely /usr/include/c++/v1 and /usr/lib/libc++.so.) The system is built with what I understand to be the full suite of clang/libc++ options in /etc/make.conf: # Use clang CC=clang CXX=clang++ CPP=clang-cpp WITH_LIBCPLUSPLUS=yes Thanks for any advice!