Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 417547

Summary: sys-libs/db-4.8.30 redefines builtin function __atomic_compare_exchange
Product: Gentoo Linux Reporter: Richard Yao (RETIRED) <ryao>
Component: Current packagesAssignee: Gentoo's Team for Core System packages <base-system>
Status: RESOLVED FIXED    
Severity: normal CC: Adrian.Bassett, srcshelton, wizardedit
Priority: Normal Keywords: PATCH, REGRESSION
Version: unspecified   
Hardware: All   
OS: All   
URL: http://clang-developers.42468.n3.nabble.com/How-to-disable-built-in-td3934787.html
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 408963, 417789    
Attachments: sys-libs/db-4.8.30 failure log
Fix build failure with Clang 3.0

Description Richard Yao (RETIRED) gentoo-dev 2012-05-26 03:03:10 UTC
Created attachment 313075 [details]
sys-libs/db-4.8.30 failure log

`env CC=clang CXX=clang++ emerge -1v sys-libs/db` currently fails on all platforms because it redefines the built-in function __atomic_compare_exchange.

According to the Clang mailing list, GCC 4.7 also implements __atomic_compare_exchange, so it should also be affected.
Comment 1 Ryan Hill (RETIRED) gentoo-dev 2012-05-29 02:57:05 UTC
It's a warning, not a failure with 4.7.

../dist/../dbinc/atomic.h:179:19: warning: conflicting types for built-in function '__atomic_compare_exchange' [enabled by default]
Comment 2 Richard Yao (RETIRED) gentoo-dev 2012-05-29 04:06:57 UTC
`env EXTRA_ECONF=--disable-atomicsupport CC=clang CXX=clang++ emerge -1v sys-libs/db` builds without a problem.

It looks like this can be fixed by modifying ./dist/aclocal/mutex.m4 to do a check for __atomic_compare_exchange and modifying ./dbinc/atomic.h to obey it.
Comment 3 Richard Yao (RETIRED) gentoo-dev 2012-05-29 04:08:46 UTC
(In reply to comment #1)
> It's a warning, not a failure with 4.7.
> 
> ../dist/../dbinc/atomic.h:179:19: warning: conflicting types for built-in
> function '__atomic_compare_exchange' [enabled by default]

In that case, we do not need the blocker on bug #390247. Thanks for testing that.
Comment 4 Richard Yao (RETIRED) gentoo-dev 2012-05-29 05:16:22 UTC
Created attachment 313479 [details, diff]
Fix build failure with Clang 3.0

Clang's __atomic_compare_exchange uses 6 arguments while the sys-lib/db version uses 3 arguments. As such, the best thing to do is to just rename the function.

I have attached a patch that does that.
Comment 5 Richard Yao (RETIRED) gentoo-dev 2012-05-29 08:28:32 UTC
Fix committed to CVS with Chainsaw's approval.

I only committed it for sys-libs/db-4.8.30. Someone will need to review later releases, verify that the patch applies to them (it likely does) and apply the fix to them. I will try to do that later. I am marking this as in progress.
Comment 6 Richard Yao (RETIRED) gentoo-dev 2012-05-29 13:27:22 UTC
(In reply to comment #5)
> Fix committed to CVS with Chainsaw's approval.
> 
> I only committed it for sys-libs/db-4.8.30. Someone will need to review
> later releases, verify that the patch applies to them (it likely does) and
> apply the fix to them. I will try to do that later. I am marking this as in
> progress.

I verified that versions 5.0.y compiled with the patch, so I have applied it to them in CVS. It does not apply cleanly to versions 5.1.y and 5.2.y, but 5.x is masked, so I am going to put this down for now.
Comment 7 Christoph Junghans (RETIRED) gentoo-dev 2014-08-08 01:17:08 UTC
*** Bug 519362 has been marked as a duplicate of this bug. ***
Comment 8 Austin English (RETIRED) gentoo-dev 2016-06-03 06:57:33 UTC
(In reply to Richard Yao from comment #5)
> Fix committed to CVS with Chainsaw's approval.
> 
> I only committed it for sys-libs/db-4.8.30. Someone will need to review
> later releases, verify that the patch applies to them (it likely does) and
> apply the fix to them. I will try to do that later. I am marking this as in
> progress.

4.8.30-r2, 6.0.35, 6.1.26, 6.2.23 are fine, 5.1.29, 5.3.28 fail with clang-3.5.
Comment 9 Austin English (RETIRED) gentoo-dev 2016-06-03 08:26:14 UTC
(In reply to Austin English from comment #8)
> (In reply to Richard Yao from comment #5)
> > Fix committed to CVS with Chainsaw's approval.
> > 
> > I only committed it for sys-libs/db-4.8.30. Someone will need to review
> > later releases, verify that the patch applies to them (it likely does) and
> > apply the fix to them. I will try to do that later. I am marking this as in
> > progress.
> 
> 4.8.30-r2, 6.0.35, 6.1.26, 6.2.23 are fine, 5.1.29, 5.3.28 fail with
> clang-3.5.

https://github.com/gentoo/gentoo/pull/1591

Upstream moved the affected file to a new src/ dir in 5.x, which broke the patch. I rebased for 5.x, and now all 4.x, 5.x and 6.x versions compile with clang-3.5 on my machine.
Comment 10 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2016-06-04 19:06:32 UTC
commit ca32c42