Opened 10 years ago

Closed 10 years ago

Last modified 9 years ago

#7979 closed Bugs (fixed)

atomic library compilation error on 1.53.0

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

Description

Hello,

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!

Attachments (1)

boost_compilation_log (4.1 KB ) - added by victor.hiairrassary.ml@… 10 years ago.
atomic compilation log

Download all attachments as: .zip

Change History (12)

by victor.hiairrassary.ml@…, 10 years ago

Attachment: boost_compilation_log added

atomic compilation log

comment:1 by timblechmann, 10 years ago

Version: Boost 1.52.0Boost 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)

to

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

comment:2 by victor.hiairrassary.ml@…, 10 years ago

Thanks, this works fine (compilation finished successfully)!

Will you commit it?

comment:3 by timblechmann, 10 years ago

Resolution: fixed
Status: newclosed

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

fixes #7979

comment:4 by victor.hiairrassary.ml@…, 10 years ago

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 http://git.uclibc.org/uClibc/tree/include/stdint.h at line 118).

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

comment:5 by timblechmann, 10 years ago

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 by victor.hiairrassary.ml@…, 10 years ago

I understand the problem!

Thanks for your answer!

in reply to:  description comment:7 by david.heidelberger@…, 9 years ago

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 by hongli@…, 9 years ago

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)
defined(GLIBC_HAVE_LONG_LONG))

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: https://svn.boost.org/trac/boost/ticket/8973

comment:9 by hongli@…, 9 years ago

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 by timblechmann, 9 years ago

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

comment:11 by hongli@…, 9 years ago

Yes boost-trunk compiles without problems.

Note: See TracTickets for help on using tickets.