[cfe-dev] [PATCH] Make libc++ compile on linux (issue1164043)
Howard Hinnant
hhinnant at apple.com
Wed Jun 2 06:59:52 PDT 2010
On Jun 2, 2010, at 7:19 AM, 罗勇刚(Yonggang Luo) wrote:
> What's the building option for libc++ on ubuntu.
> I was using such options
> export CXX="g++ -std=c++0x"
>
> And the build result is
>
> ./buildit
> ./buildit: line 15: [: g++: binary operator expected
> + for FILE in '../src/*.cpp'
> + g++ -std=c++0x -c -g -Os -fPIC -nostdinc++ -I../include ../src/algorithm.cpp
> + for FILE in '../src/*.cpp'
> + g++ -std=c++0x -c -g -Os -fPIC -nostdinc++ -I../include ../src/bind.cpp
> + for FILE in '../src/*.cpp'
> + g++ -std=c++0x -c -g -Os -fPIC -nostdinc++ -I../include ../src/chrono.cpp
> + for FILE in '../src/*.cpp'
> + g++ -std=c++0x -c -g -Os -fPIC -nostdinc++ -I../include
> ../src/condition_variable.cpp
> In file included from ../src/condition_variable.cpp:11:
> ../include/thread: In member function ‘std::__1::thread&
> std::__1::thread::operator=(std::__1::thread&&)’:
> ../include/thread:268: error: no match for ‘operator!=’ in
> ‘((std::__1::thread*)this)->std::__1::thread::__t_ !=
> std::__1::__get_nullptr_t()’
> ../include/system_error:569: note: candidates are: bool
> std::__1::operator!=(const std::__1::error_condition&, const
> std::__1::error_condition&)
> ../include/system_error:565: note: bool
> std::__1::operator!=(const std::__1::error_condition&, const
> std::__1::error_code&)
> ../include/system_error:561: note: bool
> std::__1::operator!=(const std::__1::error_code&, const
> std::__1::error_condition&)
> ../include/system_error:557: note: bool
> std::__1::operator!=(const std::__1::error_code&, const
> std::__1::error_code&)
> ../include/cstddef:73: note: bool
> std::__1::operator!=(std::__1::nullptr_t, std::__1::nullptr_t)
> ../include/thread:271: error: cannot convert ‘std::__1::nullptr_t’ to
> ‘pthread_t’ in assignment
> [3]+ Done gedit ./buildit
On Mac OS, this code takes advantage of the fact that pthread_t is a pointer. Other arrangements will have to be made for when this is not the case. One important fact to remember in porting this code is that the pthread_t must have a state that represents "no thread". On Mac OS that state is the null pointer. Alternatively one could add an extra bool member to std::thread to indicate when the pthread_t does not represent a joinable thread.
> Also there is a patch for buildit
> dreamkxd at lyg-laptop:~/workspace/libcxx/lib$ svn diff
> Index: buildit
> ===================================================================
> --- buildit (revision 105318)
> +++ buildit (working copy)
> @@ -12,7 +12,7 @@
> exit 1
> fi
>
> -if [ -z $CXX ]
> +if [ -z "$CXX" ]
> then
> CXX=g++
> fi
Thanks, I'll make this change next time I check in.
-Howard
More information about the cfe-dev
mailing list