[Bug c++/43915] Compiler flags error: error: invalid initialization of reference of type 'boost::thread' from expression of type 'boost::thread'
--- Comment #11 from mlrus at mac dot com 2010-05-14 13:25 --- The following shows how to patch, compile and use boost 1.43.0 with g++ -std=c++0x. At issue are the rvalue references and typecasts in the boost threading libraries. Simply tell Boost not to use its rvalue reference code when it gets compiled, even with option std=c++0x is set. Here's how: 1. Modify operatingSystem.jam, to compile with the -std=c+0x option. Also, remove the -no-cpp-precomp option if it is not supported by your compiler. For OS X I changed tools/build/v2/tools/darwin.jam at line 483 like this # Misc options. #flags darwin.compile OPTIONS : -no-cpp-precomp -gdwarf-2 ; flags darwin.compile OPTIONS : -std=c++0x -gdwarf-2 ; 2. Modify gcc.hpp to disable the conditional compilation of rvalue references (temporarily, until that part of the code works with g++) diff gcc.hpp.orig gcc.hpp 124c124,125 # define BOOST_HAS_RVALUE_REFS // # define BOOST_HAS_RVALUE_REFS # define BOOST_NO_RVALUE_REFERENCES In this manner you can compile and use Boost 1.43 fine gcc 4.5 or earlier, and still build your software to use the c++0x features supported by the gnu copmiler option -std=c++0x. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43915
[Bug c++/43915] Compiler flags error: error: invalid initialization of reference of type 'boost::thread' from expression of type 'boost::thread'
--- Comment #3 from mlrus at mac dot com 2010-04-28 06:23 --- Subject: Re: Compiler flags error: error: invalid initialization of reference of type 'boost::thread' from expression of type 'boost::thread' Its attached. /Michah --- Comment #2 from pinskia at gcc dot gnu dot org 2010-04-28 02:00 --- Can you attach the preprocessed source? This might be an issue with boost. There was a change with respect to rvalue references; lvalues cannot bind to rvalue references. The C++0x standard is changing still so this was a change with the standard between the releases of 4.4 and 4.5. -- pinskia at gcc dot gnu dot org changed: What|Removed |Added Status|UNCONFIRMED |WAITING http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43915 --- You are receiving this mail because: --- You are on the CC list for the bug, or are watching someone who is. You reported the bug, or are watching the reporter. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43915
[Bug c++/43915] Compiler flags error: error: invalid initialization of reference of type 'boost::thread' from expression of type 'boost::thread'
--- Comment #4 from mlrus at mac dot com 2010-04-28 06:24 --- Created an attachment (id=20502) -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=20502action=view) Bzip'ed preprocessor output for libs/thread/src/pthread/thread.cpp with g++ -c -save-temps -std=c++0x ... Bzip'ed thread.ii. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43915
[Bug c++/43915] Compiler flags error: error: invalid initialization of reference of type 'boost::thread' from expression of type 'boost::thread'
--- Comment #9 from mlrus at mac dot com 2010-04-28 18:20 --- Appended status to booost bug 3944 http://svn.boost.org/trac/boost/ticket/3844 -- mlrus at mac dot com changed: What|Removed |Added Status|NEW |SUSPENDED http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43915
[Bug c++/43915] New: Compiler flags error: error: invalid initialization of reference of type 'boost::thread' from expression of type 'boost::thread'
Compilation of boost_1_42_0 fails with errors. bash-3.2# g++ --version g++ (GCC) 4.5.0 bash-3.2# g++ -ftemplate-depth-128 -finline-functions -Wno-inline -Wall -dynamic -std=gnu++0x -fPIC -DBOOST_ALL_NO_LIB=1 -DBOOST_THREAD_BUILD_DLL=1 -DBOOST_THREAD_POSIX -DNDEBUG -I. -c -o bin.v2/libs/thread/build/darwin-4.5.0/release/threading-multi/pthread/thread.o libs/thread/src/pthread/thread.cpp In file included from ./boost/thread/thread.hpp:22:0, from libs/thread/src/pthread/thread.cpp:10: ./boost/thread/detail/thread.hpp: In function 'boost::thread boost::move(boost::thread)': ./boost/thread/detail/thread.hpp:349:16: error: invalid initialization of reference of type 'boost::thread' from expression of type 'boost::thread' In file included from ./boost/thread/detail/thread_heap_alloc.hpp:17:0, from ./boost/thread/detail/thread.hpp:13, from ./boost/thread/thread.hpp:22, from libs/thread/src/pthread/thread.cpp:10: ./boost/thread/pthread/thread_heap_alloc.hpp: In function 'T* boost::detail::heap_new(A1) [with T = boost::detail::thread_datavoid (*)(), A1 = void (*)()]': ./boost/thread/detail/thread.hpp:130:95: instantiated from here ./boost/thread/pthread/thread_heap_alloc.hpp:24:47: error: cannot bind 'void (*)()' lvalue to 'void (*)()' ./boost/thread/detail/thread.hpp:43:13: error: initializing argument 1 of 'boost::detail::thread_dataF::thread_data(F) [with F = void (*)()]' bash-3.2# -- Summary: Compiler flags error: error: invalid initialization of reference of type 'boost::thread' from expression of type 'boost::thread' Product: gcc Version: 4.5.0 Status: UNCONFIRMED Severity: minor Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: mlrus at mac dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43915
[Bug c++/43915] Compiler flags error: error: invalid initialization of reference of type 'boost::thread' from expression of type 'boost::thread'
--- Comment #1 from mlrus at mac dot com 2010-04-28 01:01 --- bash-3.2# cat build.2.log Building the Boost C++ Libraries. After the build, the headers will be located at /usr/local/boost_1_42_0 The libraries will be located at /usr/local/boost_1_42_0/stage/lib Use 'bjam install --prefix=path' if you wish to install headers and libraries to a different location and remove the source tree. warning: Building Boost.Regex with the optional Unicode/ICU support disabled. note: Please refer to the Boost.Regex documentation for more information note: this is a strictly optional feature. warning: Graph library does not contain MPI-based parallel components. note: to enable them, add using mpi ; to your user-config.jam warning: skipping optional Message Passing Interface (MPI) library. note: to enable MPI support, add using mpi ; to user-config.jam. note: to suppress this message, pass --without-mpi to bjam. note: otherwise, you can safely ignore this message. ...patience... ...patience... ...patience... ...found 6637 targets... ...updating 8 targets... darwin.compile.c++ bin.v2/libs/thread/build/darwin-4.5.0/release/threading-multi/pthread/thread.o g++ -ftemplate-depth-128 -O3 -finline-functions -Wno-inline -Wall -dynamic -no-cpp-precomp -gdwarf-2 -std=c++0x -fPIC -DBOOST_ALL_NO_LIB=1 -DBOOST_THREAD_BUILD_DLL=1 -DBOOST_THREAD_POSIX -DNDEBUG -I. -c -o bin.v2/libs/thread/build/darwin-4.5.0/release/threading-multi/pthread/thread.o libs/thread/src/pthread/thread.cpp g++: unrecognized option '-no-cpp-precomp' In file included from ./boost/thread/thread.hpp:22:0, from libs/thread/src/pthread/thread.cpp:10: ./boost/thread/detail/thread.hpp: In function 'boost::thread boost::move(boost::thread)': ./boost/thread/detail/thread.hpp:349:16: error: invalid initialization of reference of type 'boost::thread' from expression of type 'boost::thread' In file included from ./boost/thread/detail/thread_heap_alloc.hpp:17:0, from ./boost/thread/detail/thread.hpp:13, from ./boost/thread/thread.hpp:22, from libs/thread/src/pthread/thread.cpp:10: ./boost/thread/pthread/thread_heap_alloc.hpp: In function 'T* boost::detail::heap_new(A1) [with T = boost::detail::thread_datavoid (*)(), A1 = void (*)()]': ./boost/thread/detail/thread.hpp:130:95: instantiated from here ./boost/thread/pthread/thread_heap_alloc.hpp:24:47: error: cannot bind 'void (*)()' lvalue to 'void (*)()' ./boost/thread/detail/thread.hpp:43:13: error: initializing argument 1 of 'boost::detail::thread_dataF::thread_data(F) [with F = void (*)()]' ...failed darwin.compile.c++ bin.v2/libs/thread/build/darwin-4.5.0/release/threading-multi/pthread/thread.o... ...skipped pstage/liblibboost_thread.dylib for lack of pbin.v2/libs/thread/build/darwin-4.5.0/release/threading-multipthread/thread.o... ...skipped pbin.v2/libs/thread/build/darwin-4.5.0/release/threading-multilibboost_thread.dylib for lack of pbin.v2/libs/thread/build/darwin-4.5.0/release/threading-multipthread/thread.o... ...skipped pstage/liblibboost_wave.dylib for lack of pbin.v2/libs/thread/build/darwin-4.5.0/release/threading-multilibboost_thread.dylib... darwin.compile.c++ bin.v2/libs/thread/build/darwin-4.5.0/release/link-static/threading-multi/pthread/thread.o g++ -ftemplate-depth-128 -O3 -finline-functions -Wno-inline -Wall -no-cpp-precomp -gdwarf-2 -std=c++0x -DBOOST_ALL_NO_LIB=1 -DBOOST_THREAD_BUILD_LIB=1 -DBOOST_THREAD_POSIX -DNDEBUG -I. -c -o bin.v2/libs/thread/build/darwin-4.5.0/release/link-static/threading-multi/pthread/thread.o libs/thread/src/pthread/thread.cpp g++: unrecognized option '-no-cpp-precomp' In file included from ./boost/thread/thread.hpp:22:0, from libs/thread/src/pthread/thread.cpp:10: ./boost/thread/detail/thread.hpp: In function 'boost::thread boost::move(boost::thread)': ./boost/thread/detail/thread.hpp:349:16: error: invalid initialization of reference of type 'boost::thread' from expression of type 'boost::thread' In file included from ./boost/thread/detail/thread_heap_alloc.hpp:17:0, from ./boost/thread/detail/thread.hpp:13, from ./boost/thread/thread.hpp:22, from libs/thread/src/pthread/thread.cpp:10: ./boost/thread/pthread/thread_heap_alloc.hpp: In function 'T* boost::detail::heap_new(A1) [with T = boost::detail::thread_datavoid (*)(), A1 = void (*)()]': ./boost/thread/detail/thread.hpp:130:95: instantiated from here ./boost/thread/pthread/thread_heap_alloc.hpp:24:47: error: cannot bind 'void (*)()' lvalue to 'void (*)()' ./boost/thread/detail/thread.hpp:43:13: error: initializing argument 1 of 'boost::detail::thread_dataF::thread_data(F) [with F = void (*)()]' ...failed darwin.compile.c++ bin.v2/libs/thread/build/darwin-4.5.0/release/link-static/threading-multi/pthread/thread.o... ...skipped pbin.v2/libs/thread/build/darwin-4.5.0/release/link-static/threading-multilibboost_thread.a(clean