[LLVMbugs] [Bug 19071] New: [cmake] check_cxx_compiler_flag test for -std=c++11 fails to use linker flags, unable to find nonstandard location of libc++

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Mar 6 16:06:59 PST 2014


http://llvm.org/bugs/show_bug.cgi?id=19071

            Bug ID: 19071
           Summary: [cmake] check_cxx_compiler_flag test for -std=c++11
                    fails to use linker flags, unable to find nonstandard
                    location of libc++
           Product: Build scripts
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: cmake
          Assignee: unassignedbugs at nondot.org
          Reporter: fang at csl.cornell.edu
                CC: geek4civic at gmail.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

On a system where libc++ is installed in a nonstandard location, the test for
-std=c++11 fails when trying to link the test executable, even when -L is
passed to linker flags:

-- Target triple: powerpc-apple-darwin8.11.0
-- Host OS X version: 10.4
-- Native target architecture is PowerPC
-- Threads enabled.
-- Doxygen disabled.
-- Building with -fPIC
CMake Error at cmake/modules/HandleLLVMOptions.cmake:298 (message):
  LLVM requires C++11 support but the '-std=c++11' flag isn't supported.
Call Stack (most recent call first):
  CMakeLists.txt:301 (include)


-- Configuring incomplete, errors occurred!
make: *** [cmake_check_build_system] Error 1

from CMakeFiles/CMakeError.log:
Performing C++ SOURCE FILE Test CXX_SUPPORTS_CXX11 failed with the following
output:
Change Dir:
/Users/fang/local/src/LLVM-svn/clang34-stage1-build/CMakeFiles/CMakeTmp

Run Build Command:/sw/bin/make "cmTryCompileExec1310359099/fast"
make[1]: Entering directory
`/Volumes/Isolde/builds/LLVM/clang34-stage1-build/CMakeFiles/CMakeTmp'
/sw/bin/make -f CMakeFiles/cmTryCompileExec1310359099.dir/build.make
CMakeFiles/cmTryCompileExec1310359099.dir/build
make[2]: Entering directory
`/Volumes/Isolde/builds/LLVM/clang34-stage1-build/CMakeFiles/CMakeTmp'
/Volumes/Mercedes2/sw/bin/cmake -E cmake_progress_report
/Users/fang/local/src/LLVM-svn/clang34-stage1-build/CMakeFiles/CMakeTmp/CMakeFiles
1
Building CXX object CMakeFiles/cmTryCompileExec1310359099.dir/src.cxx.o
/sw/opt/llvm-3.4/bin/clang++    -std=c++11 -stdlib=libc++ -cxx-isystem
/sw/include/c++/v1 -B/sw/lib/odcctools/bin -no-integrated-as -fPIC
-fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings
-Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default
-Wnon-virtual-dtor  -DCXX_SUPPORTS_CXX11   -std=c++11 -o
CMakeFiles/cmTryCompileExec1310359099.dir/src.cxx.o -c
/Users/fang/local/src/LLVM-svn/clang34-stage1-build/CMakeFiles/CMakeTmp/src.cxx
Linking CXX executable cmTryCompileExec1310359099
/Volumes/Mercedes2/sw/bin/cmake -E cmake_link_script
CMakeFiles/cmTryCompileExec1310359099.dir/link.txt --verbose=1
/sw/opt/llvm-3.4/bin/clang++    -std=c++11 -stdlib=libc++ -cxx-isystem
/sw/include/c++/v1 -B/sw/lib/odcctools/bin -no-integrated-as -fPIC
-fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings
-Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default
-Wnon-virtual-dtor  -DCXX_SUPPORTS_CXX11 -Wl,-search_paths_first
-Wl,-headerpad_max_install_names  
CMakeFiles/cmTryCompileExec1310359099.dir/src.cxx.o  -o
cmTryCompileExec1310359099  -lm
ld: library not found for -lc++
clang-3.4: error: linker command failed with exit code 1 (use -v to see
invocation)
make[2]: Leaving directory
`/Volumes/Isolde/builds/LLVM/clang34-stage1-build/CMakeFiles/CMakeTmp'
make[1]: Leaving directory
`/Volumes/Isolde/builds/LLVM/clang34-stage1-build/CMakeFiles/CMakeTmp'
make[2]: *** [cmTryCompileExec1310359099] Error 1
make[1]: *** [cmTryCompileExec1310359099/fast] Error 2


% grep LINKER_FLAGS CMakeCache.txt 
CMAKE_EXE_LINKER_FLAGS:STRING= -L/sw/lib/c++
CMAKE_EXE_LINKER_FLAGS_DEBUG:STRING=
CMAKE_EXE_LINKER_FLAGS_MINSIZEREL:STRING=
CMAKE_EXE_LINKER_FLAGS_RELEASE:STRING=
CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO:STRING=
CMAKE_MODULE_LINKER_FLAGS:STRING= -L/sw/lib/c++
CMAKE_MODULE_LINKER_FLAGS_DEBUG:STRING=
CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL:STRING=
CMAKE_MODULE_LINKER_FLAGS_RELEASE:STRING=
CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO:STRING=
CMAKE_SHARED_LINKER_FLAGS:STRING= -L/sw/lib/c++
CMAKE_SHARED_LINKER_FLAGS_DEBUG:STRING=
CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL:STRING=
CMAKE_SHARED_LINKER_FLAGS_RELEASE:STRING=
CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO:STRING=

and libc++ lives at /sw/lib/c++/libc++.dylib so that user may choose which
libc++ to use (vendor's vs. built).

Can the trivial executable test be fixed to account for linker flags?
Better yet would be if there were an equivalent option to -cxx-isystem for
linking.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140307/0f8c0702/attachment.html>


More information about the llvm-bugs mailing list