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

Bug 672294

Summary: sys-libs/compiler-rt-sanitizers-7.0.0 uses CLOCK_REALTIME which is unavailable on OS X versions less than 10.12
Product: Gentoo/Alt Reporter: Tamas Jantvik <tsjk>
Component: Mac OSXAssignee: Gentoo Prefix <prefix>
Status: RESOLVED OBSOLETE    
Severity: normal CC: llvm, mgorny, tsjk
Priority: Normal    
Version: unspecified   
Hardware: AMD64   
OS: OS X   
Whiteboard:
Package list:
Runtime testing required: ---

Description Tamas Jantvik 2018-11-30 13:38:16 UTC
Bootstrapping fails on sys-libs/compiler-rt-sanitizers-7.0.0 with the first error seeming to be
.../Gentoo/var/tmp/portage/sys-libs/compiler-rt-sanitizers-7.0.0/work/compiler-rt-7.0.0.src/lib/xray/xray_basic_logging.cc:300:32: error: use of undeclared identifier 'CLOCK_REALTIME'

According to Googlable source CLOCK_REALTIME does not exist on OS X v10.11 and earlier.

Reproducible: Always

Steps to Reproduce:
1.Get bootstrap script on Mac OS X v10.11 (my case)
2.Run it
3.Observe error
Actual Results:  
sys-libs/compiler-rt-sanitizers-7.0.0 fails with the first error seeming to be
.../Gentoo/var/tmp/portage/sys-libs/compiler-rt-sanitizers-7.0.0/work/compiler-rt-7.0.0.src/lib/xray/xray_basic_logging.cc:300:32: error: use of undeclared identifier 'CLOCK_REALTIME'

Expected Results:  
sys-libs/compiler-rt-sanitizers-7.0.0 should merge successfully
Comment 1 Tamas Jantvik 2018-11-30 14:11:24 UTC
Don't know if the patch below works yet, because the failure of compiling this package screwed up the bootstrap beyond a simple resume ('emerge -u system' did nothing, while 'emerge --depclean' bailed out)

--- compiler-rt-sanitizers-7.0.0.ebuild.orig    2018-10-30 10:26:00.000000000 +0100
+++ compiler-rt-sanitizers-7.0.0.ebuild 2018-11-30 15:07:30.000000000 +0100
@@ -138,6 +138,15 @@
                )
        fi

+       if use prefix && [[ "${CHOST}" == *-darwin* ]] ; then
+               local _uname_r=$(uname -r | sed -E 's@\.@@g')
+               if [[ ${_uname_r} -le 1560 ]] ; then
+                       mycmakeargs+=(
+                               -DCOMPILER_RT_BUILD_XRAY=OFF
+                       )
+               fi
+       fi
+
        cmake-utils_src_configure

        if use test; then
Comment 2 Fabian Groffen gentoo-dev 2018-11-30 14:16:35 UTC
if [[ ${CHOST} == *-darwin* && ${CHOST#*darwin} -lt 18 ]] ; then
  # disable XRAY
fi
Comment 3 Tamas Jantvik 2018-11-30 14:19:16 UTC
Right. I'll try that :)
Comment 4 Fabian Groffen gentoo-dev 2018-12-06 10:18:05 UTC
@llvm: do you have suggestions here?  Are you OK with applying a workaround for Darwin?
Comment 5 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2018-12-06 14:07:20 UTC
I think it'd be cleaner to add a flag for xray, and mask it in those profiles.
Comment 6 Fabian Groffen gentoo-dev 2018-12-06 14:11:31 UTC
that works for us, do you want a patch for that?
Comment 7 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2018-12-06 15:14:23 UTC
No need to, I'll do the ebuild part this evening. Just let me know which versions you need.
Comment 8 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2018-12-06 15:14:48 UTC
I mean, compiler-rt versions.
Comment 9 Fabian Groffen gentoo-dev 2018-12-06 16:57:44 UTC
At this point it seems like 6 and up.
Comment 10 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2018-12-06 18:08:46 UTC
FTR, this may take a while longer since I want to test if all components are suitable for disabling via USE flags.
Comment 11 Larry the Git Cow gentoo-dev 2018-12-06 19:09:08 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e9d44197c21230b01df34d3a726fef5707a0033b

commit e9d44197c21230b01df34d3a726fef5707a0033b
Author:     Michał Górny <mgorny@gentoo.org>
AuthorDate: 2018-12-06 18:59:33 +0000
Commit:     Michał Górny <mgorny@gentoo.org>
CommitDate: 2018-12-06 19:08:59 +0000

    sys-libs/compiler-rt-sanitizers: Add explicit flags for components
    
    Bug: https://bugs.gentoo.org/672294
    Signed-off-by: Michał Górny <mgorny@gentoo.org>

 .../compiler-rt-sanitizers-6.0.1.ebuild                      | 12 +++++++-----
 .../compiler-rt-sanitizers-7.0.0.ebuild                      | 12 +++++++-----
 .../compiler-rt-sanitizers-7.0.1_rc2.ebuild                  | 12 +++++++-----
 .../compiler-rt-sanitizers-7.0.9999.ebuild                   | 12 +++++++-----
 .../compiler-rt-sanitizers-9999.ebuild                       | 12 +++++++-----
 sys-libs/compiler-rt-sanitizers/metadata.xml                 |  4 ++++
 6 files changed, 39 insertions(+), 25 deletions(-)
Comment 12 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2018-12-06 19:11:58 UTC
Please test and mask as appropriate.
Comment 13 Fabian Groffen gentoo-dev 2021-01-11 19:36:04 UTC
Basically, obsolete from my point of view.  GCC is working much (much!) better, in particular on older systems.  LLVM/Clang bootstraps are still broken, and it is questionable we will ever be able to support it due to it's abundance of complexities.