[cfe-dev] Installing libc++

Marc J. Driftmeyer mjd at reanimality.com
Tue Apr 19 18:43:02 PDT 2011



On 04/19/2011 05:38 AM, Jean-Daniel Dupas wrote:
> Le 18 avr. 2011 à 23:06, Howard Hinnant a écrit :
>
>> On Apr 18, 2011, at 4:46 PM, Jon Kalb wrote:
>>
>>> On 4/16/11 12:34 AM, "Jean-Daniel Dupas"<devlists at shadowlab.org>  wrote:
>>>
>>>> Le 15 avr. 2011 à 18:58, Howard Hinnant a écrit :
>>>>
>>>>> On Apr 15, 2011, at 12:10 PM, Jon Kalb wrote:
>>>>>
>>>>>> Howard, et. all,
>>>>>>
>>>>>> Following the steps here: http://libcxx.llvm.org/
>>>>>>
>>>>>> I’m stuck here:
>>>>>>
>>>>>> Where it says: “That should result in a libc++.1.dylib. To install it I like
>>>>>> to use links instead of copying, but either should work:”
>>>>>>
>>>>>> Instead I get:
>>>>>>
>>>>>>> Jon-Kalbs-MacBook-Pro:lib jonkalb$ sudo ./buildit
>>>>>>> + for FILE in '../src/*.cpp'
>>>>>>> + clang++ -c -g -Os -fPIC -nostdinc++ -I../include ../src/algorithm.cpp
>>>>>>> + for FILE in '../src/*.cpp'
>>>>>>> + clang++ -c -g -Os -fPIC -nostdinc++ -I../include ../src/bind.cpp
>>>>>>> + for FILE in '../src/*.cpp'
>>>>>>> + clang++ -c -g -Os -fPIC -nostdinc++ -I../include ../src/chrono.cpp
>>>>>>> + for FILE in '../src/*.cpp'
>>>>>>> + clang++ -c -g -Os -fPIC -nostdinc++ -I../include
>>>>>>> ../src/condition_variable.cpp
>>>>>>> + for FILE in '../src/*.cpp'
>>>>>>> + clang++ -c -g -Os -fPIC -nostdinc++ -I../include ../src/exception.cpp
>>>>>>> + for FILE in '../src/*.cpp'
>>>>>>> + clang++ -c -g -Os -fPIC -nostdinc++ -I../include ../src/future.cpp
>>>>>>> + for FILE in '../src/*.cpp'
>>>>>>> + clang++ -c -g -Os -fPIC -nostdinc++ -I../include ../src/hash.cpp
>>>>>>> + for FILE in '../src/*.cpp'
>>>>>>> + clang++ -c -g -Os -fPIC -nostdinc++ -I../include ../src/ios.cpp
>>>>>>> + for FILE in '../src/*.cpp'
>>>>>>> + clang++ -c -g -Os -fPIC -nostdinc++ -I../include ../src/iostream.cpp
>>>>>>> + for FILE in '../src/*.cpp'
>>>>>>> + clang++ -c -g -Os -fPIC -nostdinc++ -I../include ../src/locale.cpp
>>>>>>> + for FILE in '../src/*.cpp'
>>>>>>> + clang++ -c -g -Os -fPIC -nostdinc++ -I../include ../src/memory.cpp
>>>>>>> + for FILE in '../src/*.cpp'
>>>>>>> + clang++ -c -g -Os -fPIC -nostdinc++ -I../include ../src/mutex.cpp
>>>>>>> + for FILE in '../src/*.cpp'
>>>>>>> + clang++ -c -g -Os -fPIC -nostdinc++ -I../include ../src/new.cpp
>>>>>>> + for FILE in '../src/*.cpp'
>>>>>>> + clang++ -c -g -Os -fPIC -nostdinc++ -I../include ../src/random.cpp
>>>>>>> + for FILE in '../src/*.cpp'
>>>>>>> + clang++ -c -g -Os -fPIC -nostdinc++ -I../include ../src/regex.cpp
>>>>>>> + for FILE in '../src/*.cpp'
>>>>>>> + clang++ -c -g -Os -fPIC -nostdinc++ -I../include ../src/stdexcept.cpp
>>>>>>> + for FILE in '../src/*.cpp'
>>>>>>> + clang++ -c -g -Os -fPIC -nostdinc++ -I../include ../src/string.cpp
>>>>>>> + for FILE in '../src/*.cpp'
>>>>>>> + clang++ -c -g -Os -fPIC -nostdinc++ -I../include ../src/strstream.cpp
>>>>>>> + for FILE in '../src/*.cpp'
>>>>>>> + clang++ -c -g -Os -fPIC -nostdinc++ -I../include ../src/system_error.cpp
>>>>>>> + for FILE in '../src/*.cpp'
>>>>>>> + clang++ -c -g -Os -fPIC -nostdinc++ -I../include ../src/thread.cpp
>>>>>>> + for FILE in '../src/*.cpp'
>>>>>>> + clang++ -c -g -Os -fPIC -nostdinc++ -I../include ../src/typeinfo.cpp
>>>>>>> + for FILE in '../src/*.cpp'
>>>>>>> + clang++ -c -g -Os -fPIC -nostdinc++ -I../include ../src/utility.cpp
>>>>>>> + for FILE in '../src/*.cpp'
>>>>>>> + clang++ -c -g -Os -fPIC -nostdinc++ -I../include ../src/valarray.cpp
>>>>>>> + cc algorithm.o bind.o chrono.o condition_variable.o exception.o future.o
>>>>>>> hash.o ios.o iostream.o locale.o memory.o mutex.o new.o random.o regex.o
>>>>>>> stdexcept.o string.o strstream.o system_error.o thread.o typeinfo.o
>>>>>>> utility.o valarray.o -fPIC -o libc++.so.1.0 -shared -nodefaultlibs
>>>>>>> -Wl,-soname,libc++.so.1 -lpthread -lrt -lc
>>>>>>> ld: unknown option: -soname
>>>>>>> collect2: ld returned 1 exit status
>>>>>>>
>>>>>> Any idea what I’m doing wrong?
>>>>>>
>>>>>> Jon
>>>>> Hi Jon,
>>>>>
>>>>> It looks like for some reason the following step:
>>>>>
>>>>> $ export TRIPLE=-apple-
>>>>>
>>>>> didn't take.  You can confirm whether or not this happened with:
>>>>>
>>>>> $ printenv
>>>>>
>>>>> which should list:
>>>>>
>>>>> TRIPLE=-apple-
>>>>
>>>> There is no reason you have to use sudo to build the library.
>>>>
>>>> For security reason, sudo cleanup the environment by default. So the "buildit"
>>>> script is executed in a clean env without TRIPLE exported.
>>>>
>>>> -- Jean-Daniel
>>> If I don't use sudo I get this:
>>>
>>> Jon-Kalbs-MacBook-Pro:lib jonkalb$ ./buildit
>>> + for FILE in '../src/*.cpp'
>>> + clang++ -c -g -Os -arch i386 -arch x86_64 -std=c++0x -U__STRICT_ANSI__
>>> -nostdinc++ -I../include ../src/algorithm.cpp
>>> /usr/bin/lipo: can't create output file: algorithm.o (Permission denied)
>>> clang: error: unable to remove file: algorithm.o: can't destroy file:
>>> Permission denied
>>> clang: error: lipo command failed with exit code 1 (use -v to see
>>> invocation)
>> It looks like you don't have write permission in the directory where you've checked out libc++.  You should check out into some place where you would normally do development work.
>>
>> Let us know if I've guessed wrong.
> The first build using sudo create the object file with owner "root", and so prevent execution of the builtit command as normal user. Restart from a fresh check out.
>
> -- Jean-Daniel
>
>
>
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

*Fix Your Permission:*

*// On Debian Sid Linux with /usr/local/bin/clang++ and 
/usr/local/bin/clang from daily rebuilds:*

// assuming your group is the same as your username, therefore $sudo 
chown owner:group -R ./ would be $sudo chown owner:owner -R ./.

$ sudo chown username:username -R ./ inside the /buildTopLevel Path


*CMake Option:*

I do a CMake build outside of /libc++ parallel to /libc++ as /cmake-libc++

*username at host:/path-To/cmake-libc++/$* cmake ../libc++ && make -j3

Of course inside CMakeCache.txt I can set the CXX and CC compilers to 
/usr/local/bin/clang++ and /usr/local/bin/clang to use the latest trunk
Clang builds I build prior to rebuild libc++.

username at host:/path-To/cmake-libc++/$ cmake 
*-DCMAKE_CXX_COMPILER=/usr/local/bin/clang++* 
*-DCMAKE_CXX_COMPILER=/usr/local/bin/clang* *../libcxx/* *&&* make -j3

//make -j*3* (*N*=3: *N-1*= actual number of cores.) If I had 12 cores 
I'd really be thrilled at how quickly it builds.

Or you can just vim your CMakeCache.txt file and update those paths 
yourself by hand.

$vim CMakeCache.txt and edit the 
CMAKE_CXX_COMPILER=/usr/local/bin/clang++ by hand.

*Second Option:*

Doing a straight ./buildit inside the /libc++ would have me do the 
following:

*username at host:/path-To/libc++$* sudo chown username:username -R ./

*username at host:/path-To/libc++/lib/$* ./buildit

the buildit script defaults to GCC but you can change that to Clang as well:

Line 17: CXX=/usr/local/bin/clang++

Obviously, this approach is not pleasing as $CXX will change as your 
system updates. Debian has g++ -> g++-4.6 and just modifying the buildit
file each it ever gets updated by LLVM source is less than optimal, or 
having it look for clang++ in your local or system path [lots of devs 
don't like
installing into their /usr/local path for ``pollution reasons''] nor is 
resetting your CXX path. Cmake makes it convenient, besides allowing an 
install
path option whose prefix I set to /usr/local.

Of course, the *testit* tests don't pass as I have yet to figure out how 
to set them in the CMakeCache.txt file seeing as the tests aren't locally
installable under /usr/local that I've found, and thus the header files 
to import aren't imported correctly when compiling the source and thus 
leaving
it to fail the tests.


*username at host:/path-To/libc++/tests/$* ./testit

Excerpt:
          ^
1 error generated.
piecewise.pass.cpp failed to compile
rv_pair_U_V.pass.cpp:16:10: fatal error: 'utility' file not found
#include <utility>
          ^
1 error generated.
rv_pair_U_V.pass.cpp failed to compile
swap.pass.cpp:16:10: fatal error: 'utility' file not found
#include <utility>
          ^
1 error generated.
swap.pass.cpp failed to compile
types.pass.cpp:18:10: fatal error: 'utility' file not found
#include <utility>
          ^
1 error generated.
types.pass.cpp failed to compile
U_V.pass.cpp:16:10: fatal error: 'utility' file not found
#include <utility>
          ^
1 error generated.
U_V.pass.cpp failed to compile
failed 12 tests in 
/home/mdriftmeyer/DeveloperProjects/LLVMProject/libcxx/test/utilities/utility/pairs/pairs.pair
comparison.pass.cpp:21:10: fatal error: 'utility' file not found
#include <utility>
          ^
1 error generated.
comparison.pass.cpp failed to compile
make_pair.pass.cpp:14:10: fatal error: 'utility' file not found
#include <utility>
          ^
1 error generated.
make_pair.pass.cpp failed to compile
non_member_swap.pass.cpp:16:10: fatal error: 'utility' file not found
#include <utility>
          ^
1 error generated.
non_member_swap.pass.cpp failed to compile
failed 3 tests in 
/home/mdriftmeyer/DeveloperProjects/LLVMProject/libcxx/test/utilities/utility/pairs/pairs.spec
swap_array.pass.cpp:17:10: fatal error: 'utility' file not found
#include <utility>
          ^
1 error generated.
swap_array.pass.cpp failed to compile
swap.pass.cpp:17:10: fatal error: 'utility' file not found
#include <utility>

****************************************************
Results for /home/mdriftmeyer/DeveloperProjects/LLVMProject/libcxx/test:
using clang version 3.0 (trunk 129756)
Target: x86_64-unknown-linux-gnu
Thread model: posix
with -std=c++0x -stdlib=libc++
----------------------------------------------------
sections without tests   : 1
sections with failures   : 828
sections without failures: 235
                        +   ----
total number of sections : 1064
----------------------------------------------------
number of tests failed   : 3795
number of tests passed   : 445
                        +   ----
total number of tests    : 4240
****************************************************


I can only assume they would all pass if I knew a bit more of the 
intricacies of CMake allowing the actual tests to install into the 
/usr/local/ path for me to get their proper headers loaded.

- Marc

-- 
Marc J. Driftmeyer
Email :: mjd at reanimality.com <mailto:mjd at reanimality.com>
Web :: http://www.reanimality.com
Cell :: (509) 435-5212
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110419/788b346c/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mjd.vcf
Type: text/x-vcard
Size: 317 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110419/788b346c/attachment.vcf>


More information about the cfe-dev mailing list