marosi / SocialDesktopClient

Desktop client for social networks

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Building the project fails

tkoski opened this issue · comments

I'm following the instructions from the readme file, and after the following commands:

cd SocialDesktopClient  
./build.sh

I get this:

g++ -c -pipe -std=c++0x -O2 -Wall -W -D_REENTRANT -DBOOST_FILESYSTEM_VERSION=2 -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -Isdc -Isdc/core -Isdc/qtgui -I. -I. -o event_manager.o sdc/core/event_manager.cc
In file included from /usr/include/boost/thread/thread.hpp:22:0,
from /usr/include/boost/thread.hpp:13,
from sdc/core/event_manager.h:17,
from sdc/core/event_manager.cc:8:
/usr/include/boost/thread/detail/thread.hpp: In function ‘boost::thread&& boost::move(boost::thread&&)’:
/usr/include/boost/thread/detail/thread.hpp:349:16: error: invalid initialization of reference of type ‘boost::thread&&’ from expression of type ‘boost::thread’
sdc/core/event_manager.cc: In member function ‘void sdc::EventManager::Run()’:
sdc/core/event_manager.cc:36:29: error: expected initializer before ‘:’ token
sdc/core/event_manager.cc:40:3: error: expected primary-expression before ‘}’ token
sdc/core/event_manager.cc:40:3: error: expected ‘;’ before ‘}’ token
sdc/core/event_manager.cc:40:3: error: expected primary-expression before ‘}’ token
sdc/core/event_manager.cc:40:3: error: expected ‘)’ before ‘}’ token
sdc/core/event_manager.cc:40:3: error: expected primary-expression before ‘}’ token
sdc/core/event_manager.cc:40:3: error: expected ‘;’ before ‘}’ token
In file included from /usr/include/boost/thread/detail/thread_heap_alloc.hpp:17:0,
from /usr/include/boost/thread/detail/thread.hpp:13,
from /usr/include/boost/thread/thread.hpp:22,
from /usr/include/boost/thread.hpp:13,
from sdc/core/event_manager.h:17,
from sdc/core/event_manager.cc:8:
/usr/include/boost/thread/pthread/thread_heap_alloc.hpp: In function ‘T* boost::detail::heap_new(A1&&) [with T = boost::detail::thread_data<void (*)()>, A1 = void (&)()]’:
/usr/include/boost/thread/detail/thread.hpp:130:95: instantiated from here
/usr/include/boost/thread/pthread/thread_heap_alloc.hpp:24:47: error: cannot bind ‘void (
)()’ lvalue to ‘void (&&)()’
/usr/include/boost/thread/detail/thread.hpp:43:13: error: initializing argument 1 of ‘boost::detail::thread_data::thread_data(F&&) [with F = void (
)()]’
In file included from /usr/include/boost/thread/pthread/mutex.hpp:11:0,
from /usr/include/boost/thread/mutex.hpp:16,
from /usr/include/boost/thread/pthread/thread_data.hpp:12,
from /usr/include/boost/thread/thread.hpp:17,
from /usr/include/boost/thread.hpp:13,
from sdc/core/event_manager.h:17,
from sdc/core/event_manager.cc:8:
/usr/include/boost/thread/locks.hpp: In member function ‘boost::unique_lock& boost::unique_lock::operator=(boost::unique_lock&&) [with Mutex = boost::mutex, boost::unique_lock = boost::unique_lockboost::mutex]’:
/usr/include/boost/thread/future.hpp:414:91: instantiated from here
/usr/include/boost/thread/locks.hpp:269:13: error: cannot bind ‘boost::unique_lockboost::mutex’ lvalue to ‘boost::unique_lockboost::mutex&&’
/usr/include/boost/thread/locks.hpp:279:14: error: initializing argument 1 of ‘void boost::unique_lock::swap(boost::unique_lock&&) [with Mutex = boost::mutex, boost::unique_lock = boost::unique_lockboost::mutex]’
make: *** [event_manager.o] Error 1

I was able to replicate the same error (on Ubuntu 10.10). It is due to GCC and Boost versions.

GCC

I probably pushed too hard on new C++ standard that required GCC 4.6 <. I made some modifications so the earliest acceptable version of GCC is now 4.5.
If you have earlier version, this worked for me on Ubuntu 10.10:

sudo apt-get install g++-4.5
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.5 100

Last number is priority and must be the highest among all alternatives, you can check other alternatives using

update-alternatives --query g++

Boost

There is a bug, at least in version 1.42.0 (ticket#3844). Some Boost code could not cope with rvalue reference when using new standard (-std=c++0x). There are some patches for that, but the easiest way is to disable rvalue references.

In file /usr/include/boost/config/compiler/gcc.hpp comment line

//#define BOOST_HAS_RVALUE_REFS

and define new macro

#define BOOST_NO_RVALUE_REFERENCES

There is more about this error here http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43915#c11

This is just a temporary solution for the boost until it became packaged with the client.

Can you please tell me if it works for you or provide gcc and boost version otherwise? Thanks!