bin/183297: cannot pass -stdlib=libc++ to linker
Harti Brandt
harti at FreeBSD.org
Fri Oct 25 11:40:00 UTC 2013
>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 at 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:
More information about the freebsd-bugs
mailing list