Modify

Opened 5 years ago

Closed 5 years ago

Last modified 4 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@… 5 years ago.
atomic compilation log

Download all attachments as: .zip

Change History (12)

Changed 5 years ago by victor.hiairrassary.ml@…

Attachment: boost_compilation_log added

atomic compilation log

comment:1 Changed 5 years ago by timblechmann

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

Thanks, this works fine (compilation finished successfully)!

Will you commit it?

comment:3 Changed 5 years ago by timblechmann

Resolution: fixed
Status: newclosed

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

fixes #7979

comment:4 Changed 5 years ago by victor.hiairrassary.ml@…

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

I understand the problem!

Thanks for your answer!

comment:7 in reply to:  description Changed 4 years 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 4 years 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)
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 Changed 4 years 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 4 years ago by timblechmann

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

comment:11 Changed 4 years ago by hongli@…

Yes boost-trunk compiles without problems.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain timblechmann.
The resolution will be deleted.

Add Comment


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

 
Note: See TracTickets for help on using tickets.