You are not logged in.

#1 2012-07-06 23:36:21

anstmich
Member
Registered: 2009-06-20
Posts: 29

Unable to compile applications using boost_thread since updating boost

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

#2 2012-07-06 23:57:55

bgs100
Member
Registered: 2011-11-02
Posts: 3

Re: Unable to compile applications using boost_thread since updating boost

I was trying to do some stuff with OGRE (which depends on boost_thread) and got the same error. hmm

Offline

#3 2012-07-07 01:11:26

jac
Member
From: /home/jac
Registered: 2009-05-19
Posts: 431
Website

Re: Unable to compile applications using boost_thread since updating boost

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

#4 2012-07-07 02:05:05

anstmich
Member
Registered: 2009-06-20
Posts: 29

Re: Unable to compile applications using boost_thread since updating boost

jac wrote:

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

#5 2012-07-07 11:58:11

6xx
Package Maintainer (PM)
Registered: 2006-11-26
Posts: 22
Website

Re: Unable to compile applications using boost_thread since updating boost

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

#6 2012-07-07 14:35:06

anstmich
Member
Registered: 2009-06-20
Posts: 29

Re: Unable to compile applications using boost_thread since updating boost

6xx wrote:

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

#7 2012-07-09 15:50:41

cleanrock
Member
Registered: 2008-11-17
Posts: 109

Re: Unable to compile applications using boost_thread since updating boost

Just ran into this too, thanks for the workaround.

Offline

#8 2012-07-10 04:00:10

Malvineous
Member
From: Brisbane, Australia
Registered: 2011-02-03
Posts: 189
Website

Re: Unable to compile applications using boost_thread since updating boost

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

#9 2012-07-16 19:53:42

punkrockguy318
Member
From: New Jersey
Registered: 2004-02-15
Posts: 711
Website

Re: Unable to compile applications using boost_thread since updating boost

6xx wrote:

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

Board footer

Powered by FluxBB