Ticket #7979 (closed Bugs: fixed)

Opened 15 months ago

Last modified 6 months ago

atomic library compilation error on 1.53.0

Reported by:… Owned by: timblechmann
Milestone: To Be Determined Component: atomic
Version: Boost 1.53.0 Severity: Problem
Keywords: atomic compilation error Cc:



I can't compile boost::atomic in boost 1.53.0 version with buildroot trunk version, uClibc 0.9.33 and gcc 4.6.3.

I think the problem comes from uClibc : "error: 'uintptr_t' was not declared in this scope". See attached compilation log for more information!


boost_compilation_log Download (4.1 KB) - added by… 15 months ago.
atomic compilation log

Change History

Changed 15 months ago by…

atomic compilation log

comment:1 Changed 15 months ago by timblechmann

  • Version changed from Boost 1.52.0 to Boost 1.53.0

related to #7823, we basically just work around that bug manually.

victor, i don't have a uclibc toolchain on my system, but can you try to change

defined(_XOPEN_UNIX) && (_XOPEN_UNIX+0 > 0)


defined(_XOPEN_UNIX) && (_XOPEN_UNIX+0 > 0) && !defined(__UCLIBC__)

comment:2 Changed 15 months ago by…

Thanks, this works fine (compilation finished successfully)!

Will you commit it?

comment:3 Changed 15 months ago by timblechmann

  • Status changed from new to closed
  • Resolution set to fixed

(In [82754]) atomic: uclibc doesn't seem to have intptr_t

fixes #7979

comment:4 Changed 15 months ago by…

Thanks, but I don't agree so much with your commit, at least with your comment : indeed, uClibc have stdint.h file, which declare intptr_t and uintptr_t (see at line 118).

So, maybe, there is a better way to solve this issue.

comment:5 Changed 15 months ago by timblechmann

the correct way to solve it is to use <boost/cstdint.hpp> and boost::intptr_t ... however apparently that is broken and undermaintained, so we just work around this. unfortunately uclibc doesn't seem to be covered by the automatic tests, so i'd prefer to exclude functionality to be on the safe side

comment:6 Changed 15 months ago by…

I understand the problem!

Thanks for your answer!

comment:7 in reply to: ↑ description Changed 6 months ago by david.heidelberger@…

I having this problem with "boost/atomic/atomic.hpp:166:16: error: ‘uintptr_t’ was not declared in this scope". boost-1.53.0, glibc 2.18, gcc 4.9_20131013.

./boost/atomic/atomic.hpp:166:16: error: ‘uintptr_t’ was not declared in this scope ./boost/atomic/atomic.hpp:166:25: error: template argument 1 is invalid ./boost/atomic/atomic.hpp:166:43: error: invalid type in declaration before ‘’ token

comment:8 Changed 6 months ago by hongli@…

I confirm david.heidelberger's problem. I can reproduce it on today's Arch Linux release (2013-10-27), g++ 4.8.2, Boost 1.54.0, glibc instead of ulibc.

The problem is still related to the _XOPEN_UNIX definition. It causes atomic.h to typedef "atomic<uintptr_t> atomic_uintptr_t". However, uintptr_t is not defined. This is because boost/cstdint.hpp does not include stdint.h due to this line:

#if defined(BOOST_HAS_STDINT_H) && (!defined(GLIBC)

I don't know what's the proper way to fix this problem. Defining GLIBC_HAVE_LONG_LONG works along the problem though.

By the way, there is a duplicate here:

comment:9 Changed 6 months ago by hongli@…

Modifying boost/atomic/atomic.hpp as follows also solves the compilation problem:

-    || (defined(_XOPEN_UNIX) && (_XOPEN_UNIX+0 > 0) && !defined(__UCLIBC__)) \
+    || (defined(_XOPEN_UNIX) && (_XOPEN_UNIX+0 > 0) && !defined(__UCLIBC__) && !defined(__GLIBC__)) \

comment:10 Changed 6 months ago by timblechmann

as mentioned in the other bug, can you try boost-trunk?

comment:11 Changed 6 months ago by hongli@…

Yes boost-trunk compiles without problems.


Add a comment

Modify Ticket

Change Properties
<Author field>
as closed
The resolution will be deleted. Next status will be 'reopened'

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.