From owner-freebsd-bugs@FreeBSD.ORG Fri Oct 25 11:40:00 2013 Return-Path: Delivered-To: freebsd-bugs@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id D7DD1AF7 for ; Fri, 25 Oct 2013 11:40:00 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 9F24F2FB7 for ; Fri, 25 Oct 2013 11:40:00 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.7/8.14.7) with ESMTP id r9PBe0TR088761 for ; Fri, 25 Oct 2013 11:40:00 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.7/8.14.7/Submit) id r9PBe0X4088760; Fri, 25 Oct 2013 11:40:00 GMT (envelope-from gnats) Resent-Date: Fri, 25 Oct 2013 11:40:00 GMT Resent-Message-Id: <201310251140.r9PBe0X4088760@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Harti Brandt Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 7249FADB for ; Fri, 25 Oct 2013 11:37:48 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from oldred.freebsd.org (oldred.freebsd.org [8.8.178.121]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 60A922FA6 for ; Fri, 25 Oct 2013 11:37:48 +0000 (UTC) Received: from oldred.freebsd.org ([127.0.1.6]) by oldred.freebsd.org (8.14.5/8.14.7) with ESMTP id r9PBbmQ2077544 for ; Fri, 25 Oct 2013 11:37:48 GMT (envelope-from nobody@oldred.freebsd.org) Received: (from nobody@localhost) by oldred.freebsd.org (8.14.5/8.14.5/Submit) id r9PBbmit077543; Fri, 25 Oct 2013 11:37:48 GMT (envelope-from nobody) Message-Id: <201310251137.r9PBbmit077543@oldred.freebsd.org> Date: Fri, 25 Oct 2013 11:37:48 GMT From: Harti Brandt To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Subject: bin/183297: cannot pass -stdlib=libc++ to linker X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2013 11:40:00 -0000 >Number: 183297 >Category: bin >Synopsis: cannot pass -stdlib=libc++ to linker >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Oct 25 11:40:00 UTC 2013 >Closed-Date: >Last-Modified: >Originator: Harti Brandt >Release: 10.0-current >Organization: DLR >Environment: FreeBSD FreeBSD10 10.0-CURRENT FreeBSD 10.0-CURRENT #1 r246551M: Fri Feb 8 20:56:00 CET 2013 harti@FreeBSD10:/usr/obj/usr/svn/sys/FreeBSD10 amd64 >Description: When building a C++ program both the compiler and link are identified as /usr/bin/CC. The compiling works fine - CC seems to be able to figure out the language from the extension. When linking, however, CC refuses the -stdlib=libc++ option. Looks like it doesn't know when parsing the command line. >How-To-Repeat: CMakeLists.txt: cmake_minimum_required(VERSION 2.8) project(test CXX) add_executable(test test.cc) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++ -std=c++11") test.cc: int main() { } Run cmake . make VERBOSE=1 and observe the warning message from the linker: CC: warning: argument unused during compilation: '-stdlib=libc++' >Fix: In analogy to Linux create a Platform/FreeBSD-CXX.cmake: if(NOT CMAKE_CXX_COMPILER_NAMES) set(CMAKE_CXX_COMPILER_NAMES c++) endif() This seems to make the default c++ compiler and linker /usr/bin/c++ and the problem disappears. >Release-Note: >Audit-Trail: >Unformatted: