libcxx.llvm.org linux build instructions unclear

The instructions on:
   http://libcxx.llvm.org/
say:
    We can now run CMake:

     CC=clang CXX=clang++ cmake -G "Unix Makefiles" -DLIBCXX_CXX_ABI=libstdc++ -DLIBCXX_LIBSUPCXX_INCLUDE_PATHS="/usr/include/c++/4.7/;/usr/include/c++/4.7/x86_64-linux-gnu/" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr <libc++-source-dir>

however, it does not say what to put for <libc++-source-dir>
or in which directory this command is to be run. One might
guess this command is to be run inb the directory where the buildit
script is located, because that's what the earlier instructions
(for Mac OS) were run from; however, that's not at all clear.

Any help appreciated.

-regards,
Larry

CMake encourages out of source build.

You run CMake in your build directory and you point it to your source diectory (the one with CMakeLists.txt).

E.g.:

/libcxx_build
/libcxx
    /include
    CMakeLists.txt

cd /libcxx/build
CMake ../libcxx

Or:
/libcxx
    /build
    /include
    CMakeLists.txt

cd /libcxx/build
CMake ..

Ben

I would be happy to commit better instructions to the web site (aka “patches welcome”)

This is how I build libc++ with cmake (on Mac OS, not Linux)

LLVM_BUILD is a directory where my builds go

LIBCXX is where libc++ is checked out

Set up cmake build

cd $LLVM_BUILD
rm -rf libcxx-cmake-build ; mkdir libcxx-cmake-build ; cd libcxx-cmake-build
TRIPLE=-apple- CXX=$LLVM_BIN/clang++ CXX=$LLVM_BIN/clang++ cmake -DCMAKE_BUILD_TYPE=Release $LIBCXX

build libcxx with CMake

cd $LLVM_BUILD/libcxx-cmake-build
make -j 4

Where is LLVM_BIN? Would it be /usr/bin or /usr/local/bin/?

I assume it's whatever directory appears when:

   which clang++

is entered on the command line. However, if it wasn't
installed there, then wherever the instructions here:

   http://clang.llvm.org/get_started.html

would place it, which is, in the default configure case, is in the:

   Release+Asserts/bin

directory below whatever build directory where you ran the configure
script( See

   6. Build LLVM and Clang:

in the aforementioned get_started.html file).

OTOH, if you did do a `make install` after step 6, the default location
would be in /usr/local/bin (at least that's where it ended up after I
ran `make install`).

HTH.

-regards,
Larry

Thanks Ben.

I tried the 2nd directory hierarchy:

   /home/evansl/dwnlds/llvm/svn/libcxx:
   total used in directory 144 available 242951424
   drwxrwxr-x 10 evansl evansl 4096 Jul 10 11:07 .
   drwxrwxr-x 4 evansl evansl 4096 Jul 8 13:14 ..
   -rw-rw-r-- 1 evansl evansl 76 Jul 8 13:14 .arcconfig
   drwxrwxr-x 8 evansl evansl 4096 Jul 10 11:13 build
   drwxrwxr-x 3 evansl evansl 4096 Jul 8 13:14 cmake
   -rw-rw-r-- 1 evansl evansl 10316 Jul 8 13:14 CMakeLists.txt
   -rw-rw-r-- 1 evansl evansl 363 Jul 8 13:34 cmake.sh
   -rw-rw-r-- 1 evansl evansl 245 Jul 8 13:22 cmake.sh~
   -rw-rw-r-- 1 evansl evansl 2643 Jul 8 13:14 CREDITS.TXT
   drwxrwxr-x 5 evansl evansl 16384 Jul 8 13:14 include
   drwxrwxr-x 2 evansl evansl 4096 Jul 8 13:14 lib
   -rw-rw-r-- 1 evansl evansl 3493 Jul 8 13:14 LICENSE.TXT
   -rw-rw-r-- 1 evansl evansl 1425 Jul 8 13:14 Makefile
   drwxrwxr-x 3 evansl evansl 4096 Jul 8 13:14 src
   drwxrwxr-x 4 evansl evansl 4096 Jul 8 13:14 .svn
   drwxrwxr-x 19 evansl evansl 4096 Jul 8 13:14 test
   drwxrwxr-x 2 evansl evansl 4096 Jul 8 13:14 www

Then tried the Cmake command; however, it failed because some
function body was unavailable for inlining, as shown by:

Welcome to the Emacs shell

~/dwnlds/llvm/svn/libcxx/build $ which CMake
which: no CMake in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games)
~/dwnlds/llvm/svn/libcxx/build $ which cmake
/usr/bin/cmake
~/dwnlds/llvm/svn/libcxx/build $ cmake ..
-- The CXX compiler identification is GNU 4.9.0
-- The C compiler identification is GNU 4.9.0
-- Check for working CXX compiler: /usr/local/bin/c++
-- Check for working CXX compiler: /usr/local/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working C compiler: /usr/local/bin/gcc
-- Check for working C compiler: /usr/local/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Host triple: x86_64-pc-linux
-- Target triple: x86_64-pc-linux
-- Performing Test LIBCXX_HAS_STDCXX0X_FLAG
-- Performing Test LIBCXX_HAS_STDCXX0X_FLAG - Success
-- Performing Test LIBCXX_HAS_FPIC_FLAG
-- Performing Test LIBCXX_HAS_FPIC_FLAG - Success
-- Performing Test LIBCXX_HAS_NODEFAULTLIBS_FLAG
-- Performing Test LIBCXX_HAS_NODEFAULTLIBS_FLAG - Success
-- Performing Test LIBCXX_HAS_NOSTDINCXX_FLAG
-- Performing Test LIBCXX_HAS_NOSTDINCXX_FLAG - Success
-- Performing Test LIBCXX_HAS_WALL_FLAG
-- Performing Test LIBCXX_HAS_WALL_FLAG - Success
-- Performing Test LIBCXX_HAS_W_FLAG
-- Performing Test LIBCXX_HAS_W_FLAG - Success
-- Performing Test LIBCXX_HAS_WNO_UNUSED_PARAMETER_FLAG
-- Performing Test LIBCXX_HAS_WNO_UNUSED_PARAMETER_FLAG - Success
-- Performing Test LIBCXX_HAS_WWRITE_STRINGS_FLAG
-- Performing Test LIBCXX_HAS_WWRITE_STRINGS_FLAG - Success
-- Performing Test LIBCXX_HAS_WNO_LONG_LONG_FLAG
-- Performing Test LIBCXX_HAS_WNO_LONG_LONG_FLAG - Success
-- Performing Test LIBCXX_HAS_PEDANTIC_FLAG
-- Performing Test LIBCXX_HAS_PEDANTIC_FLAG - Success
-- Performing Test LIBCXX_HAS_WERROR_FLAG
-- Performing Test LIBCXX_HAS_WERROR_FLAG - Success
-- Performing Test LIBCXX_HAS_WNO_ERROR_FLAG
-- Performing Test LIBCXX_HAS_WNO_ERROR_FLAG - Success
-- Performing Test LIBCXX_HAS_FNO_EXCEPTIONS_FLAG
-- Performing Test LIBCXX_HAS_FNO_EXCEPTIONS_FLAG - Success
-- Performing Test LIBCXX_HAS_FNO_RTTI_FLAG
-- Performing Test LIBCXX_HAS_FNO_RTTI_FLAG - Success
-- Performing Test LIBCXX_HAS_WX_FLAG
-- Performing Test LIBCXX_HAS_WX_FLAG - Failed
-- Performing Test LIBCXX_HAS_NO_WX_FLAG
-- Performing Test LIBCXX_HAS_NO_WX_FLAG - Failed
-- Performing Test LIBCXX_HAS_EHSC_FLAG
-- Performing Test LIBCXX_HAS_EHSC_FLAG - Failed
-- Performing Test LIBCXX_HAS_NO_EHS_FLAG
-- Performing Test LIBCXX_HAS_NO_EHS_FLAG - Failed
-- Performing Test LIBCXX_HAS_NO_EHA_FLAG
-- Performing Test LIBCXX_HAS_NO_EHA_FLAG - Failed
-- Performing Test LIBCXX_HAS_NO_GR_FLAG
-- Performing Test LIBCXX_HAS_NO_GR_FLAG - Failed
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Looking for printf in c
-- Looking for printf in c - found
-- Looking for ccos in m
-- Looking for ccos in m - found
-- Looking for clock_gettime in rt
-- Looking for clock_gettime in rt - found
-- Looking for __gcc_personality_v0 in gcc_s
-- Looking for __gcc_personality_v0 in gcc_s - found
-- Found PythonInterp: /usr/bin/python (found version "2.7.6")
-- Configuring done
-- Generating done
-- Build files have been written to: /home/evansl/dwnlds/llvm/svn/libcxx/build
~/dwnlds/llvm/svn/libcxx/build $ make -j 4
Scanning dependencies of target cxx
[ 3%] [ 7%] [ 11%] [ 15%] Building CXX object lib/CMakeFiles/cxx.dir/__/src/stdexcept.cpp.o
Building CXX object lib/CMakeFiles/cxx.dir/__/src/strstream.cpp.o
Building CXX object lib/CMakeFiles/cxx.dir/__/src/mutex.cpp.o
Building CXX object lib/CMakeFiles/cxx.dir/__/src/thread.cpp.o
[ 19%] Building CXX object lib/CMakeFiles/cxx.dir/__/src/debug.cpp.o
[ 23%] Building CXX object lib/CMakeFiles/cxx.dir/__/src/regex.cpp.o
[ 26%] Building CXX object lib/CMakeFiles/cxx.dir/__/src/utility.cpp.o
[ 30%] Building CXX object lib/CMakeFiles/cxx.dir/__/src/exception.cpp.o
[ 34%] Building CXX object lib/CMakeFiles/cxx.dir/__/src/locale.cpp.o
/home/evansl/dwnlds/llvm/svn/libcxx/src/exception.cpp:118:9: warning: #warning is a GCC extension
  # warning uncaught_exception not yet implemented
          ^
/home/evansl/dwnlds/llvm/svn/libcxx/src/exception.cpp:118:9: warning: #warning uncaught_exception not yet implemented [-Wcpp]
/home/evansl/dwnlds/llvm/svn/libcxx/src/exception.cpp:191:9: warning: #warning is a GCC extension
  # warning exception_ptr not yet implemented
          ^
/home/evansl/dwnlds/llvm/svn/libcxx/src/exception.cpp:191:9: warning: #warning exception_ptr not yet implemented [-Wcpp]
/home/evansl/dwnlds/llvm/svn/libcxx/src/exception.cpp:210:9: warning: #warning is a GCC extension
  # warning exception_ptr not yet implemented
          ^
/home/evansl/dwnlds/llvm/svn/libcxx/src/exception.cpp:210:9: warning: #warning exception_ptr not yet implemented [-Wcpp]
/home/evansl/dwnlds/llvm/svn/libcxx/src/exception.cpp:235:9: warning: #warning is a GCC extension
  # warning exception_ptr not yet implemented
          ^
/home/evansl/dwnlds/llvm/svn/libcxx/src/exception.cpp:235:9: warning: #warning exception_ptr not yet implemented [-Wcpp]
/home/evansl/dwnlds/llvm/svn/libcxx/src/exception.cpp:279:9: warning: #warning is a GCC extension
  # warning exception_ptr not yet implemented
          ^
/home/evansl/dwnlds/llvm/svn/libcxx/src/exception.cpp:279:9: warning: #warning exception_ptr not yet implemented [-Wcpp]
/home/evansl/dwnlds/llvm/svn/libcxx/src/exception.cpp:301:9: warning: #warning is a GCC extension
  # warning exception_ptr not yet implemented
          ^
/home/evansl/dwnlds/llvm/svn/libcxx/src/exception.cpp:301:9: warning: #warning exception_ptr not yet implemented [-Wcpp]
[ 38%] Building CXX object lib/CMakeFiles/cxx.dir/__/src/memory.cpp.o
[ 42%] Building CXX object lib/CMakeFiles/cxx.dir/__/src/typeinfo.cpp.o
[ 46%] [ 50%] Building CXX object lib/CMakeFiles/cxx.dir/__/src/condition_variable.cpp.o
Building CXX object lib/CMakeFiles/cxx.dir/__/src/new.cpp.o
[ 53%] Building CXX object lib/CMakeFiles/cxx.dir/__/src/random.cpp.o
[ 57%] Building CXX object lib/CMakeFiles/cxx.dir/__/src/future.cpp.o
[ 61%] Building CXX object lib/CMakeFiles/cxx.dir/__/src/iostream.cpp.o
[ 65%] Building CXX object lib/CMakeFiles/cxx.dir/__/src/shared_mutex.cpp.o
[ 69%] Building CXX object lib/CMakeFiles/cxx.dir/__/src/valarray.cpp.o
In file included from /home/evansl/dwnlds/llvm/svn/libcxx/src/locale.cpp:18:0:
/home/evansl/dwnlds/llvm/svn/libcxx/include/string: In constructor ‘std::__1::numpunct<char>::numpunct(size_t)’:
/home/evansl/dwnlds/llvm/svn/libcxx/include/string:1978:1: error: inlining failed in call to always_inline ‘std::__1::basic_string<_CharT, _Traits, _Allocator>::basic_string() [with _CharT = char; _Traits = std::__1::char_traits<char>; _Allocator = std::__1::allocator<char>]’: function body not available
  basic_string<_CharT, _Traits, _Allocator>::basic_string()
  ^
/home/evansl/dwnlds/llvm/svn/libcxx/src/locale.cpp:4173:27: error: called from here
        __thousands_sep_(',')
                            ^
[ 73%] Building CXX object lib/CMakeFiles/cxx.dir/__/src/hash.cpp.o
make[2]: *** [lib/CMakeFiles/cxx.dir/__/src/locale.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [lib/CMakeFiles/cxx.dir/all] Error 2
make: *** [all] Error 2
~/dwnlds/llvm/svn/libcxx/build $

Any ideas how to resolve this issue?

TIA.

-regards,
Larry

The instructions on:
   http://libcxx.llvm.org/
say:
    We can now run CMake:

     CC=clang CXX=clang++ cmake -G "Unix Makefiles"
-DLIBCXX_CXX_ABI=libstdc++
-DLIBCXX_LIBSUPCXX_INCLUDE_PATHS="/usr/include/c++/4.7/;/usr/include/c++/4.7/x86_64-linux-gnu/"

-DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr
<libc++-source-dir>

however, it does not say what to put for <libc++-source-dir>
or in which directory this command is to be run. One might
guess this command is to be run inb the directory where the buildit
script is located, because that's what the earlier instructions
(for Mac OS) were run from; however, that's not at all clear.

CMake encourages out of source build.

You run CMake in your build directory and you point it to your source
diectory (the one with CMakeLists.txt).

E.g.:

/libcxx_build
/libcxx
    /include
    CMakeLists.txt

cd /libcxx/build
CMake ../libcxx

Or:
/libcxx
    /build
    /include
    CMakeLists.txt

cd /libcxx/build
CMake ..

Ben

Thanks Ben.

I tried the 2nd directory hierarchy:

   /home/evansl/dwnlds/llvm/svn/libcxx:
   total used in directory 144 available 242951424
   drwxrwxr-x 10 evansl evansl 4096 Jul 10 11:07 .
   drwxrwxr-x 4 evansl evansl 4096 Jul 8 13:14 ..
   -rw-rw-r-- 1 evansl evansl 76 Jul 8 13:14 .arcconfig
   drwxrwxr-x 8 evansl evansl 4096 Jul 10 11:13 build
   drwxrwxr-x 3 evansl evansl 4096 Jul 8 13:14 cmake
   -rw-rw-r-- 1 evansl evansl 10316 Jul 8 13:14 CMakeLists.txt
   -rw-rw-r-- 1 evansl evansl 363 Jul 8 13:34 cmake.sh

[snip]

std::__1::char_traits<char>; _Allocator = std::__1::allocator<char>]’:
function body not available
  basic_string<_CharT, _Traits, _Allocator>::basic_string()
  ^
/home/evansl/dwnlds/llvm/svn/libcxx/src/locale.cpp:4173:27: error:
called from here
        __thousands_sep_(',')
                            ^
[ 73%] Building CXX object lib/CMakeFiles/cxx.dir/__/src/hash.cpp.o
make[2]: *** [lib/CMakeFiles/cxx.dir/__/src/locale.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [lib/CMakeFiles/cxx.dir/all] Error 2
make: *** [all] Error 2
~/dwnlds/llvm/svn/libcxx/build $

Any ideas how to resolve this issue?

[snip]
Then, based on Marshall's suggestion, specified CXX, and it worked:

Welcome to the Emacs shell

~/dwnlds/llvm/svn/libcxx/build $ ls
logs
~/dwnlds/llvm/svn/libcxx/build $ CXX=clang++ cmake -DCMAKE_BUILD_TYPE=Release ..
-- The CXX compiler identification is Clang 3.5.0
-- The C compiler identification is GNU 4.9.0
-- Check for working CXX compiler: /usr/local/bin/clang++
-- Check for working CXX compiler: /usr/local/bin/clang++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working C compiler: /usr/local/bin/gcc
-- Check for working C compiler: /usr/local/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Host triple: x86_64-pc-linux
-- Target triple: x86_64-pc-linux
-- Performing Test LIBCXX_HAS_STDCXX0X_FLAG
-- Performing Test LIBCXX_HAS_STDCXX0X_FLAG - Success
-- Performing Test LIBCXX_HAS_FPIC_FLAG
-- Performing Test LIBCXX_HAS_FPIC_FLAG - Success
-- Performing Test LIBCXX_HAS_NODEFAULTLIBS_FLAG
-- Performing Test LIBCXX_HAS_NODEFAULTLIBS_FLAG - Success
-- Performing Test LIBCXX_HAS_NOSTDINCXX_FLAG
-- Performing Test LIBCXX_HAS_NOSTDINCXX_FLAG - Success
-- Performing Test LIBCXX_HAS_WALL_FLAG
-- Performing Test LIBCXX_HAS_WALL_FLAG - Success
-- Performing Test LIBCXX_HAS_W_FLAG
-- Performing Test LIBCXX_HAS_W_FLAG - Success
-- Performing Test LIBCXX_HAS_WNO_UNUSED_PARAMETER_FLAG
-- Performing Test LIBCXX_HAS_WNO_UNUSED_PARAMETER_FLAG - Success
-- Performing Test LIBCXX_HAS_WWRITE_STRINGS_FLAG
-- Performing Test LIBCXX_HAS_WWRITE_STRINGS_FLAG - Success
-- Performing Test LIBCXX_HAS_WNO_LONG_LONG_FLAG
-- Performing Test LIBCXX_HAS_WNO_LONG_LONG_FLAG - Success
-- Performing Test LIBCXX_HAS_PEDANTIC_FLAG
-- Performing Test LIBCXX_HAS_PEDANTIC_FLAG - Success
-- Performing Test LIBCXX_HAS_WERROR_FLAG
-- Performing Test LIBCXX_HAS_WERROR_FLAG - Success
-- Performing Test LIBCXX_HAS_WNO_ERROR_FLAG
-- Performing Test LIBCXX_HAS_WNO_ERROR_FLAG - Success
-- Performing Test LIBCXX_HAS_FNO_EXCEPTIONS_FLAG
-- Performing Test LIBCXX_HAS_FNO_EXCEPTIONS_FLAG - Success
-- Performing Test LIBCXX_HAS_FNO_RTTI_FLAG
-- Performing Test LIBCXX_HAS_FNO_RTTI_FLAG - Success
-- Performing Test LIBCXX_HAS_WX_FLAG
-- Performing Test LIBCXX_HAS_WX_FLAG - Failed
-- Performing Test LIBCXX_HAS_NO_WX_FLAG
-- Performing Test LIBCXX_HAS_NO_WX_FLAG - Failed
-- Performing Test LIBCXX_HAS_EHSC_FLAG
-- Performing Test LIBCXX_HAS_EHSC_FLAG - Failed
-- Performing Test LIBCXX_HAS_NO_EHS_FLAG
-- Performing Test LIBCXX_HAS_NO_EHS_FLAG - Failed
-- Performing Test LIBCXX_HAS_NO_EHA_FLAG
-- Performing Test LIBCXX_HAS_NO_EHA_FLAG - Failed
-- Performing Test LIBCXX_HAS_NO_GR_FLAG
-- Performing Test LIBCXX_HAS_NO_GR_FLAG - Failed
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Looking for printf in c
-- Looking for printf in c - found
-- Looking for ccos in m
-- Looking for ccos in m - found
-- Looking for clock_gettime in rt
-- Looking for clock_gettime in rt - found
-- Looking for __gcc_personality_v0 in gcc_s
-- Looking for __gcc_personality_v0 in gcc_s - found
-- Found PythonInterp: /usr/bin/python (found version "2.7.6")
-- Configuring done
-- Generating done
-- Build files have been written to: /home/evansl/dwnlds/llvm/svn/libcxx/build
~/dwnlds/llvm/svn/libcxx/build $ ls
CMakeCache.txt CMakeFiles Makefile cmake_install.cmake include lib logs test
~/dwnlds/llvm/svn/libcxx/build $ make -j 4
Scanning dependencies of target cxx
[ 7%] [ 7%] [ 11%] [ 15%] Building CXX object lib/CMakeFiles/cxx.dir/__/src/stdexcept.cpp.o
Building CXX object lib/CMakeFiles/cxx.dir/__/src/mutex.cpp.o
Building CXX object lib/CMakeFiles/cxx.dir/__/src/thread.cpp.o
Building CXX object lib/CMakeFiles/cxx.dir/__/src/strstream.cpp.o
[ 19%] [ 23%] [ 26%] Building CXX object lib/CMakeFiles/cxx.dir/__/src/debug.cpp.o
Building CXX object lib/CMakeFiles/cxx.dir/__/src/regex.cpp.o
Building CXX object lib/CMakeFiles/cxx.dir/__/src/utility.cpp.o
[ 30%] Building CXX object lib/CMakeFiles/cxx.dir/__/src/exception.cpp.o
[ 34%] Building CXX object lib/CMakeFiles/cxx.dir/__/src/locale.cpp.o
/home/evansl/dwnlds/llvm/svn/libcxx/src/exception.cpp:118:9: warning: #warning is a language extension [-Wpedantic]
# warning uncaught_exception not yet implemented
         ^
/home/evansl/dwnlds/llvm/svn/libcxx/src/exception.cpp:118:9: warning: uncaught_exception not yet implemented [-W#warnings]
/home/evansl/dwnlds/llvm/svn/libcxx/src/exception.cpp:191:9: warning: #warning is a language extension [-Wpedantic]
# warning exception_ptr not yet implemented
         ^
/home/evansl/dwnlds/llvm/svn/libcxx/src/exception.cpp:191:9: warning: exception_ptr not yet implemented [-W#warnings]
/home/evansl/dwnlds/llvm/svn/libcxx/src/exception.cpp:210:9: warning: #warning is a language extension [-Wpedantic]
# warning exception_ptr not yet implemented
         ^
/home/evansl/dwnlds/llvm/svn/libcxx/src/exception.cpp:210:9: warning: exception_ptr not yet implemented [-W#warnings]
/home/evansl/dwnlds/llvm/svn/libcxx/src/exception.cpp:235:9: warning: #warning is a language extension [-Wpedantic]
# warning exception_ptr not yet implemented
         ^
/home/evansl/dwnlds/llvm/svn/libcxx/src/exception.cpp:235:9: warning: exception_ptr not yet implemented [-W#warnings]
/home/evansl/dwnlds/llvm/svn/libcxx/src/exception.cpp:279:9: warning: #warning is a language extension [-Wpedantic]
# warning exception_ptr not yet implemented
         ^
/home/evansl/dwnlds/llvm/svn/libcxx/src/exception.cpp:279:9: warning: exception_ptr not yet implemented [-W#warnings]
/home/evansl/dwnlds/llvm/svn/libcxx/src/exception.cpp:301:9: warning: #warning is a language extension [-Wpedantic]
# warning exception_ptr not yet implemented
         ^
/home/evansl/dwnlds/llvm/svn/libcxx/src/exception.cpp:301:9: warning: exception_ptr not yet implemented [-W#warnings]
12 warnings generated.
[ 38%] Building CXX object lib/CMakeFiles/cxx.dir/__/src/memory.cpp.o
[ 42%] Building CXX object lib/CMakeFiles/cxx.dir/__/src/typeinfo.cpp.o
[ 46%] Building CXX object lib/CMakeFiles/cxx.dir/__/src/condition_variable.cpp.o
[ 50%] Building CXX object lib/CMakeFiles/cxx.dir/__/src/new.cpp.o
[ 53%] Building CXX object lib/CMakeFiles/cxx.dir/__/src/random.cpp.o
[ 57%] Building CXX object lib/CMakeFiles/cxx.dir/__/src/future.cpp.o
[ 61%] Building CXX object lib/CMakeFiles/cxx.dir/__/src/iostream.cpp.o
[ 65%] Building CXX object lib/CMakeFiles/cxx.dir/__/src/shared_mutex.cpp.o
[ 69%] Building CXX object lib/CMakeFiles/cxx.dir/__/src/valarray.cpp.o
[ 73%] Building CXX object lib/CMakeFiles/cxx.dir/__/src/hash.cpp.o
[ 76%] Building CXX object lib/CMakeFiles/cxx.dir/__/src/optional.cpp.o
[ 80%] Building CXX object lib/CMakeFiles/cxx.dir/__/src/chrono.cpp.o
[ 84%] Building CXX object lib/CMakeFiles/cxx.dir/__/src/string.cpp.o
[ 88%] Building CXX object lib/CMakeFiles/cxx.dir/__/src/ios.cpp.o
[ 92%] Building CXX object lib/CMakeFiles/cxx.dir/__/src/bind.cpp.o
[ 96%] Building CXX object lib/CMakeFiles/cxx.dir/__/src/algorithm.cpp.o
[100%] Building CXX object lib/CMakeFiles/cxx.dir/__/src/system_error.cpp.o
Linking CXX shared library libc++.so
clang: warning: argument unused during compilation: '-nostdinc++'
[100%] Built target cxx
~/dwnlds/llvm/svn/libcxx/build $

Thanks Marshall :frowning:

-regards,
Larry

The instructions on:
   http://libcxx.llvm.org/
say:
    We can now run CMake:

     CC=clang CXX=clang++ cmake -G "Unix Makefiles"
-DLIBCXX_CXX_ABI=libstdc++
-DLIBCXX_LIBSUPCXX_INCLUDE_PATHS="/usr/include/c++/4.7/;/usr/include/c++/4.7/x86_64-linux-gnu/"

-DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr
<libc++-source-dir>

however, it does not say what to put for <libc++-source-dir>
or in which directory this command is to be run. One might
guess this command is to be run inb the directory where the buildit
script is located, because that's what the earlier instructions
(for Mac OS) were run from; however, that's not at all clear.

CMake encourages out of source build.

You run CMake in your build directory and you point it to your source
diectory (the one with CMakeLists.txt).

E.g.:

/libcxx_build
/libcxx
    /include
    CMakeLists.txt

cd /libcxx/build
CMake ../libcxx

Or:
/libcxx
    /build
    /include
    CMakeLists.txt

cd /libcxx/build
CMake ..

Ben

Thanks Ben.

I tried the 2nd directory hierarchy:

   /home/evansl/dwnlds/llvm/svn/libcxx:
   total used in directory 144 available 242951424
   drwxrwxr-x 10 evansl evansl 4096 Jul 10 11:07 .
   drwxrwxr-x 4 evansl evansl 4096 Jul 8 13:14 ..
   -rw-rw-r-- 1 evansl evansl 76 Jul 8 13:14 .arcconfig
   drwxrwxr-x 8 evansl evansl 4096 Jul 10 11:13 build
   drwxrwxr-x 3 evansl evansl 4096 Jul 8 13:14 cmake
   -rw-rw-r-- 1 evansl evansl 10316 Jul 8 13:14 CMakeLists.txt
   -rw-rw-r-- 1 evansl evansl 363 Jul 8 13:34 cmake.sh

[snip]

std::__1::char_traits<char>; _Allocator = std::__1::allocator<char>]’:
function body not available
  basic_string<_CharT, _Traits, _Allocator>::basic_string()
  ^
/home/evansl/dwnlds/llvm/svn/libcxx/src/locale.cpp:4173:27: error:
called from here
        __thousands_sep_(',')
                            ^
[ 73%] Building CXX object lib/CMakeFiles/cxx.dir/__/src/hash.cpp.o
make[2]: *** [lib/CMakeFiles/cxx.dir/__/src/locale.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [lib/CMakeFiles/cxx.dir/all] Error 2
make: *** [all] Error 2
~/dwnlds/llvm/svn/libcxx/build $

Any ideas how to resolve this issue?

[snip]
Then, based on Marshall's suggestion, specified CXX, and it worked:

Welcome to the Emacs shell

~/dwnlds/llvm/svn/libcxx/build $ ls
logs
~/dwnlds/llvm/svn/libcxx/build $ CXX=clang++ cmake
-DCMAKE_BUILD_TYPE=Release ..
-- The CXX compiler identification is Clang 3.5.0
-- The C compiler identification is GNU 4.9.0

[snip]

-- Configuring done
-- Generating done
-- Build files have been written to:
/home/evansl/dwnlds/llvm/svn/libcxx/build
~/dwnlds/llvm/svn/libcxx/build $ ls
CMakeCache.txt CMakeFiles Makefile cmake_install.cmake include lib
  logs test
~/dwnlds/llvm/svn/libcxx/build $ make -j 4
Scanning dependencies of target cxx
[ 7%] [ 7%] [ 11%] [ 15%] Building CXX object
lib/CMakeFiles/cxx.dir/__/src/stdexcept.cpp.o
Building CXX object lib/CMakeFiles/cxx.dir/__/src/mutex.cpp.o
Building CXX object lib/CMakeFiles/cxx.dir/__/src/thread.cpp.o
Building CXX object lib/CMakeFiles/cxx.dir/__/src/strstream.cpp.o
[ 19%] [ 23%] [ 26%] Building CXX object
lib/CMakeFiles/cxx.dir/__/src/debug.cpp.o
Building CXX object lib/CMakeFiles/cxx.dir/__/src/regex.cpp.o
Building CXX object lib/CMakeFiles/cxx.dir/__/src/utility.cpp.o
[ 30%] Building CXX object lib/CMakeFiles/cxx.dir/__/src/exception.cpp.o
[ 34%] Building CXX object lib/CMakeFiles/cxx.dir/__/src/locale.cpp.o
/home/evansl/dwnlds/llvm/svn/libcxx/src/exception.cpp:118:9: warning:
#warning is a language extension [-Wpedantic]
# warning uncaught_exception not yet implemented
         ^

[snip]

Linking CXX shared library libc++.so
clang: warning: argument unused during compilation: '-nostdinc++'
[100%] Built target cxx
~/dwnlds/llvm/svn/libcxx/build $

Thanks Marshall :frowning:

-regards,
Larry

Unfortunately, when using libcxx with a hello_world.cpp, get missing files:

make
ls -ld /usr/local/lib/libc++*
lrwxrwxrwx 1 root root 11 Jul 10 12:45 /usr/local/lib/libc++.so -> libc++.so.1
lrwxrwxrwx 1 root root 13 Jul 10 12:45 /usr/local/lib/libc++.so.1 -> libc++.so.1.0
-rw-r--r-- 1 root root 1054759 Jul 10 11:53 /usr/local/lib/libc++.so.1.0
ls -ld /usr/local/include/c++/v1/../*
drwxr-xr-x 19 root root 4096 Jul 7 12:11 /usr/local/include/c++/v1/../4.9.0
drwxr-xr-x 5 root root 4096 Jul 10 12:45 /usr/local/include/c++/v1/../v1
/usr/local/bin/clang++ -std=c++11 -stdlib=libc++ -nostdinc -I/usr/local/include/c++/v1 -I/usr/local/include/c++/v1/../4.9.0 -L/usr/local/lib hello_world.cpp -o hello_world.exe
In file included from hello_world.cpp:1:
/usr/local/include/c++/v1/../4.9.0/iostream:38:10: fatal error: 'bits/c++config.h' file not found
#include <bits/c++config.h>
          ^
1 error generated.
make: *** [run] Error 1

Anyone have any ideas how to get libcxx to work on ubuntu?

uname -a
Linux lje-OptiPlex-9020 3.13.0-30-generic #55-Ubuntu SMP Fri Jul 4 21:40:53 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

TIA

-regards,
Larry

Unfortunately, when using libcxx with a hello_world.cpp, get missing files:

make
ls -ld /usr/local/lib/libc++*
lrwxrwxrwx 1 root root 11 Jul 10 12:45 /usr/local/lib/libc++.so ->
libc++.so.1
lrwxrwxrwx 1 root root 13 Jul 10 12:45 /usr/local/lib/libc++.so.1 ->
libc++.so.1.0
-rw-r--r-- 1 root root 1054759 Jul 10 11:53 /usr/local/lib/libc++.so.1.0
ls -ld /usr/local/include/c++/v1/../*
drwxr-xr-x 19 root root 4096 Jul 7 12:11 /usr/local/include/c++/v1/../4.9.0
drwxr-xr-x 5 root root 4096 Jul 10 12:45 /usr/local/include/c++/v1/../v1
/usr/local/bin/clang++ -std=c++11 -stdlib=libc++ -nostdinc
-I/usr/local/include/c++/v1 -I/usr/local/include/c++/v1/../4.9.0
-L/usr/local/lib hello_world.cpp -o hello_world.exe
In file included from hello_world.cpp:1:
/usr/local/include/c++/v1/../4.9.0/iostream:38:10: fatal error:
'bits/c++config.h' file not found
#include <bits/c++config.h>
         ^
1 error generated.
make: *** [run] Error 1

Anyone have any ideas how to get libcxx to work on ubuntu?

Its a distant memory, but....

I seem to recall I had to use -I to include the path to the correct
headers like <bits/c++config.h>. This was on Debian with an updated
Clang (I built and used 3.3 in /usr/local/bin, while Debian provided
3.1, IIRC).

Jeff

Thanks Jeff. That got me a little farther, but now missing other
files. First had to add another -I for features.h, but now I'm
getting compile error as well as another missing file:

make
ls -ld /usr/local/lib/libc++*
lrwxrwxrwx 1 root root 11 Jul 10 12:45 /usr/local/lib/libc++.so -> libc++.so.1
lrwxrwxrwx 1 root root 13 Jul 10 12:45 /usr/local/lib/libc++.so.1 -> libc++.so.1.0
-rw-r--r-- 1 root root 1054759 Jul 10 11:53 /usr/local/lib/libc++.so.1.0
ls -ld /usr/local/include/c++/v1/../*
drwxr-xr-x 19 root root 4096 Jul 7 12:11 /usr/local/include/c++/v1/../4.9.0
drwxr-xr-x 5 root root 4096 Jul 10 12:45 /usr/local/include/c++/v1/../v1
/usr/local/bin/clang++ -std=c++11 -stdlib=libc++ -nostdinc -I/usr/local/include/c++/v1 -I/usr/local/include/c++/4.9.0/x86_64-unknown-linux-gnu -I/usr/local/include/c++/4.9.0 -I/usr/local/include/c++/4.9.0/parallel -L/usr/local/lib hello_world.cpp -o hello_world.exe
In file included from hello_world.cpp:1:
In file included from /usr/local/include/c++/4.9.0/iostream:38:
In file included from /usr/local/include/c++/4.9.0/x86_64-unknown-linux-gnu/bits/c++config.h:430:
/usr/local/include/c++/4.9.0/x86_64-unknown-linux-gnu/bits/os_defines.h:44:19: error: token is not a valid binary operator in a
       preprocessor subexpression
#if __GLIBC_PREREQ(2,15) && defined(_GNU_SOURCE)
     ~~~~~~~~~~~~~~^
In file included from hello_world.cpp:1:
In file included from /usr/local/include/c++/4.9.0/iostream:39:
In file included from /usr/local/include/c++/4.9.0/ostream:38:
In file included from /usr/local/include/c++/4.9.0/ios:38:
In file included from /usr/local/include/c++/4.9.0/iosfwd:40:
In file included from /usr/local/include/c++/4.9.0/bits/postypes.h:40:
/usr/local/include/c++/4.9.0/cwchar:44:10: fatal error: 'wchar.h' file not found
#include <wchar.h>
          ^
2 errors generated.
make: *** [run] Error 1

Compilation exited abnormally with code 2 at Thu Jul 10 15:42:43

-regards,
Larry

I cleared the build directory and started over. The difference this
time was I specified the CC= (in addition to the CXX=. IOW:

CC=clang CXX=clang++ cmake -G "Unix Makefiles" -DLIBCXX_CXX_ABI=libstdc++ -DLIBCXX_LIBSUPCXX_INCLUDE_PATHS="/usr/local/include/c++/4.9.0/;/usr/local/include/c++/4.9.0/x86_64-unknown-linux-gnu/" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local ../..

where the last ../.. is the libcxx source.

I also had to add -Wl,-lstdc++ to the link command when
compiling&linking a hello_world.cpp program. This avoided
this link error:

/usr/local/bin/clang++ -std=c++1y -stdlib=libc++ hello_world.cpp -o hello_world.exe
     /usr/bin/ld: /tmp/hello_world-3c8536.o: undefined reference to symbol '__cxa_free_exception@@CXXABI_1.3'
     //usr/lib/x86_64-linux-gnu/libstdc++.so.6: error adding symbols: DSO missing from command line
     clang: error: linker command failed with exit code 1 (use -v to see invocation)

Hope this helps someone else.

-regards,
Larry

CORRECTION:

For some unknown reason, the same hello_world.cpp program is no longer
linking because `GNU ld` can't find the libc++.so even though it's
there, as shown by:

make -k
ls -ld /usr/local/lib/libc++*
lrwxrwxrwx 1 root root 11 Jul 10 12:45 /usr/local/lib/libc++.so -> libc++.so.1
lrwxrwxrwx 1 root root 13 Jul 10 12:45 /usr/local/lib/libc++.so.1 -> libc++.so.1.0
-rw-r--r-- 1 root root 1039766 Jul 13 20:57 /usr/local/lib/libc++.so.1.0
ls -ld /usr/local/include/c++/v1/../*
drwxr-xr-x 19 root root 4096 Jul 7 12:11 /usr/local/include/c++/v1/../4.9.0
drwxr-xr-x 5 root root 4096 Jul 13 20:59 /usr/local/include/c++/v1/../v1
/usr/local/bin/clang++ -std=c++1y -stdlib=libc++ -Wl,-lstdc++ -Wl,-v hello_world.cpp -o hello_world.exe
GNU ld (GNU Binutils for Ubuntu) 2.24
./hello_world.exe
./hello_world.exe: error while loading shared libraries: libc++.so.1: cannot open shared object file: No such file or directory
make: *** [run] Error 127

Compilation exited abnormally with code 2 at Mon Jul 14 08:37:17

Anyone have any idea what's going on?

-regards,
Larry

Runs again, by passing more flags to linker. The manpage for gnu ld
has:

   The -rpath option is also used when locating shared objects which are
   needed by shared objects explicitly included in the link;

so added the directory where libc++ is located to -rpath link flag,
resulting in OK link. I've no idea why it worked yesterday without
this flag :(.

Here's the compile&link&run:

make -k
ls -ld /usr/local/lib/libc++*
lrwxrwxrwx 1 root root 11 Jul 10 12:45 /usr/local/lib/libc++.so -> libc++.so.1
lrwxrwxrwx 1 root root 13 Jul 10 12:45 /usr/local/lib/libc++.so.1 -> libc++.so.1.0
-rw-r--r-- 1 root root 1039766 Jul 13 20:57 /usr/local/lib/libc++.so.1.0
ls -ld /usr/local/include/c++/v1/../*
drwxr-xr-x 19 root root 4096 Jul 7 12:11 /usr/local/include/c++/v1/../4.9.0
drwxr-xr-x 5 root root 4096 Jul 13 20:59 /usr/local/include/c++/v1/../v1
/usr/local/bin/clang++ -std=c++1y -stdlib=libc++ -Wl,-v -Wl,-lstdc++ -L/usr/local/lib -Wl,-rpath -Wl,/usr/local/lib hello_world.cpp -o hello_world.exe
GNU ld (GNU Binutils for Ubuntu) 2.24
./hello_world.exe
hello World

Compilation finished at Mon Jul 14 08:56:56