You are not logged in.
Hi all,
Recently boost was updated and (as far as I can tell) since I have been unable to compile a project of mine which uses boost_thread. As an example of the issue, I simply include the boost/thread library and compile:
boostthread.cpp:
#include <boost/thread.hpp>
int main()
{
return 0;
}
Next compile with:
g++ boostthread.cpp -g -Wall -o boostthread -lboost_thread
In the process of compiling, I get the errors:
In file included from /usr/include/boost/thread/pthread/mutex.hpp:14: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 boostthread.c:1:
/usr/include/boost/thread/xtime.hpp:23:5: error: expected identifier before numeric constant
/usr/include/boost/thread/xtime.hpp:23:5: error: expected ‘}’ before numeric constant
/usr/include/boost/thread/xtime.hpp:23:5: error: expected unqualified-id before numeric constant
/usr/include/boost/thread/xtime.hpp:46:14: error: expected type-specifier before ‘system_time’
In file included from /usr/include/boost/thread/pthread/mutex.hpp:14: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 boostthread.c:1:
/usr/include/boost/thread/xtime.hpp: In function ‘int xtime_get(xtime*, int)’:
/usr/include/boost/thread/xtime.hpp:73:40: error: ‘get_system_time’ was not declared in this scope
/usr/include/boost/thread/xtime.hpp:73:40: note: suggested alternative:
In file included from /usr/include/boost/thread/locks.hpp:12:0,
from /usr/include/boost/thread/pthread/mutex.hpp:12,
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 boostthread.c:1:
/usr/include/boost/thread/thread_time.hpp:19:24: note: ‘boost::get_system_time’
In file included from /usr/include/boost/thread/pthread/mutex.hpp:14: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 boostthread.c:1:
/usr/include/boost/thread/xtime.hpp: At global scope:
/usr/include/boost/thread/xtime.hpp:88:1: error: expected declaration before ‘}’ token
Looking at xtime.hpp, I cannot see any syntactic errors. Has anyone experienced similar issues with boost_thread recently? Any ideas as to how to resolve the issue? I have tried reinstalling both boost and gcc however neither have helped.
Offline
I was trying to do some stuff with OGRE (which depends on boost_thread) and got the same error.
Offline
What version are you both using? I have no issues. I'm not sure if it's because my mirror is out of date, because yours is, or some other reason.
Edit: Actually, I just went from gcc 4.7.1-3 to 4.7.1-4 and started getting this error. Let me see if I can find anything.
Edit: It seems TIME_UTC is getting defined somewhere as '1', making the line "1=1". I haven't figured out where though, doesn't appear in the updated standard headers or in boost anywhere.
Edit:https://svn.boost.org/trac/boost/ticket/6940 -- looks like TIME_UTC is part of the C++0x standard. Looks like there is a boost patch in 1.50 that fixes this. I'm not sure what Arch's standard handling of something like this would be.
Edit: The great guys running Arch are both aware of this problem, and already have 1.50 coming. Link to mailing list about 1.50. It looks like it will be a smooth transition (from my nooby eyes), so this will be just as quick as patching 1.49 and pushing it out again.
Last edited by jac (2012-07-07 01:38:23)
Offline
What version are you both using? I have no issues. I'm not sure if it's because my mirror is out of date, because yours is, or some other reason.
Edit: Actually, I just went from gcc 4.7.1-3 to 4.7.1-4 and started getting this error. Let me see if I can find anything.
Edit: It seems TIME_UTC is getting defined somewhere as '1', making the line "1=1". I haven't figured out where though, doesn't appear in the updated standard headers or in boost anywhere.
Edit:https://svn.boost.org/trac/boost/ticket/6940 -- looks like TIME_UTC is part of the C++0x standard. Looks like there is a boost patch in 1.50 that fixes this. I'm not sure what Arch's standard handling of something like this would be.
Edit: The great guys running Arch are both aware of this problem, and already have 1.50 coming. Link to mailing list about 1.50. It looks like it will be a smooth transition (from my nooby eyes), so this will be just as quick as patching 1.49 and pushing it out again.
This would explain the cryptic compilation errors, thanks a lot for all of the digging!
Offline
Just rename all the occurences of TIME_UTC to TIME_UTC_ in the /usr/include/boost/thread/xtime.hpp. This is safe, since both boost definition of TIME_UTC and glibc definition of TIME_UTC are the same (ie. TIME_UTC = 1).
Offline
Just rename all the occurences of TIME_UTC to TIME_UTC_ in the /usr/include/boost/thread/xtime.hpp. This is safe, since both boost definition of TIME_UTC and glibc definition of TIME_UTC are the same (ie. TIME_UTC = 1).
This does in fact work. Thanks for the tip!
Offline
Just ran into this too, thanks for the workaround.
Offline
Many thanks for this, fixed my problem too. Any idea whether an updated 1.49 will be pushed out? It seems like more work is needed before 1.50 will be ready.
Offline
Just rename all the occurences of TIME_UTC to TIME_UTC_ in the /usr/include/boost/thread/xtime.hpp. This is safe, since both boost definition of TIME_UTC and glibc definition of TIME_UTC are the same (ie. TIME_UTC = 1).
works for me ! thanks -- i needed this to compile openmw with boost 1.49
If I have the gift of prophecy and can fathom all mysteries and all knowledge, and if I have a faith that can move mountains, but have not love, I am nothing. 1 Corinthians 13:2
Offline