[Bug sanitizer/87892] New: [9 Regression]: libsanitizer fails to build on CentOS 5.11 (glibc 2.5)

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

[Bug sanitizer/87892] New: [9 Regression]: libsanitizer fails to build on CentOS 5.11 (glibc 2.5)

asolokha at gmx dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87892

            Bug ID: 87892
           Summary: [9 Regression]: libsanitizer fails to build on CentOS
                    5.11 (glibc 2.5)
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: sanitizer
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ubizjak at gmail dot com
                CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org,
                    jakub at gcc dot gnu.org, kcc at gcc dot gnu.org, marxin at gcc dot gnu.org
  Target Milestone: ---

Building libsanitizer with old glibc (2.5) fails with:

libtool: compile:  /home/uros/gcc-build/./gcc/xgcc -shared-libgcc
-B/home/uros/gcc-build/./gcc -nostdinc++
-L/home/uros/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/src
-L/home/uros/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/src/.libs
-L/home/uros/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/libsupc++/.libs
-B/home/uros/local/x86_64-pc-linux-gnu/bin/
-B/home/uros/local/x86_64-pc-linux-gnu/lib/ -isystem
/home/uros/local/x86_64-pc-linux-gnu/include -isystem
/home/uros/local/x86_64-pc-linux-gnu/sys-include -D_GNU_SOURCE -D_DEBUG
-D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
-DHAVE_RPC_XDR_H=1 -DHAVE_TIRPC_RPC_XDR_H=0 -I.
-I../../../../git/gcc/libsanitizer/sanitizer_common -I.. -I
../../../../git/gcc/libsanitizer/include -isystem
../../../../git/gcc/libsanitizer/include/system -Wall -W -Wno-unused-parameter
-Wwrite-strings -pedantic -Wno-long-long -fPIC -fno-builtin -fno-exceptions
-fno-rtti -fomit-frame-pointer -funwind-tables -fvisibility=hidden
-Wno-variadic-macros -I../../libstdc++-v3/include
-I../../libstdc++-v3/include/x86_64-pc-linux-gnu
-I../../../../git/gcc/libsanitizer/../libstdc++-v3/libsupc++ -std=gnu++11
-DSANITIZER_LIBBACKTRACE -DSANITIZER_CP_DEMANGLE -I
../../../../git/gcc/libsanitizer/../libbacktrace -I ../libbacktrace -I
../../../../git/gcc/libsanitizer/../include -include
../../../../git/gcc/libsanitizer/libbacktrace/backtrace-rename.h -g -O2
-D_GNU_SOURCE -MT sanitizer_linux_libcdep.lo -MD -MP -MF
.deps/sanitizer_linux_libcdep.Tpo -c
../../../../git/gcc/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc
-fPIC -DPIC -o .libs/sanitizer_linux_libcdep.o
../../../../git/gcc/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc:
In function ‘__sanitizer::u32 __sanitizer::GetNumberOfCPUs()’:
../../../../git/gcc/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc:699:10:
error: ‘CPU_COUNT’ was not declared in this scope
  699 |   return CPU_COUNT(&CPUs);
      |          ^~~~~~~~~
gmake[2]: *** [sanitizer_linux_libcdep.lo] Error 1
gmake[2]: Leaving directory
`/home/uros/gcc-build/x86_64-pc-linux-gnu/libsanitizer/sanitizer_common'
gmake[1]: *** [all-recursive] Error 1
gmake[1]: Leaving directory
`/home/uros/gcc-build/x86_64-pc-linux-gnu/libsanitizer'
gmake: *** [all] Error 2
Reply | Threaded
Open this post in threaded view
|

[Bug sanitizer/87892] [9 Regression]: libsanitizer fails to build on CentOS 5.11 (glibc 2.5)

asolokha at gmx dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87892

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |build
   Target Milestone|---                         |9.0
Reply | Threaded
Open this post in threaded view
|

[Bug sanitizer/87892] [9 Regression]: libsanitizer fails to build on CentOS 5.11 (glibc 2.5)

asolokha at gmx dot com
In reply to this post by asolokha at gmx dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87892

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2018-11-06
           Assignee|unassigned at gcc dot gnu.org      |marxin at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Confirmed, it's mainline bug, I'll report that.
Reply | Threaded
Open this post in threaded view
|

[Bug sanitizer/87892] [9 Regression]: libsanitizer fails to build on CentOS 5.11 (glibc 2.5)

asolokha at gmx dot com
In reply to this post by asolokha at gmx dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87892

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://github.com/google/s
                   |                            |anitizers/issues/1019

--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
Reported upstream.
Reply | Threaded
Open this post in threaded view
|

[Bug sanitizer/87892] [9 Regression]: libsanitizer fails to build on CentOS 5.11 (glibc 2.5)

asolokha at gmx dot com
In reply to this post by asolokha at gmx dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87892

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |WONTFIX

--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> ---
So it looks mainline is not interested in fixing support for 10 years old
glibc. I'm also not planning to fix that.
Reply | Threaded
Open this post in threaded view
|

[Bug sanitizer/87892] [9 Regression]: libsanitizer fails to build on CentOS 5.11 (glibc 2.5)

asolokha at gmx dot com
In reply to this post by asolokha at gmx dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87892

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|WONTFIX                     |---

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
While upstream is careless, we shouldn't be.
You can look e.g. at libgomp/config/linux/affinity.c for how to handle older
glibcs that don't define CPU_COUNT, or CPU_*_S, etc.
Reply | Threaded
Open this post in threaded view
|

[Bug sanitizer/87892] [9 Regression]: libsanitizer fails to build on CentOS 5.11 (glibc 2.5)

asolokha at gmx dot com
In reply to this post by asolokha at gmx dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87892

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |ASSIGNED

--- Comment #5 from Martin Liška <marxin at gcc dot gnu.org> ---
Ok, sorry for bailing that too early..
Reply | Threaded
Open this post in threaded view
|

[Bug sanitizer/87892] [9 Regression]: libsanitizer fails to build on CentOS 5.11 (glibc 2.5)

asolokha at gmx dot com
In reply to this post by asolokha at gmx dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87892

--- Comment #6 from Martin Liška <marxin at gcc dot gnu.org> ---
Hints from Jakub:

<jakub> marxin: just look at libgomp sources, I have all kinds of stuff there
<marxin> jakub: ok, then let me fix that
<jakub> marxin: sysconf(_SC_NPROCESSORS_ONLN) is a good fallback if the
affinity doesn't work
<jakub> note even the version they wrote is of course incorrect
<jakub> it will not work on machines where the cpuset is very large
<marxin> jakub: due to buffer(4096); ?
<jakub> marxin: cpu_set_t is fixed size
<jakub> marxin: newer glibcs provide APIs where one specifies the size
<marxin> jakub: ok
<jakub> marxin: if they don't want to use sysconf because it allocates memory,
then can read /proc/cpuinfo themselves
<marxin> jakub: they read /sys/devices/system/cpu instead
<jakub> marxin: they do that on android only; /sys is newer than /proc though
<jakub> marxin: in any case, CPU_COUNT, if missing, can be easily written using
__builtin_popcountl in a loop, see libgomp/config/linux/proc.c
(gomp_cpuset_popcount)
<jakub> but that assumption that sched_getaffinity will succeed is bogus, it
might fail because it isn't implemented, or may fail because the cpu_set_t is
too small
<jakub> marxin: then you can of course allocate using their allocators
something bigger and retry
<jakub> marxin: see also gomp_init_num_threads in the same file; while you
might avoid the sysconf if they don't want to call it at start, start with
cpu_set_t size
<marxin> thanks for hints
<jakub> just note that libgomp is GPL and libsanitizer is not, so copy'n'paste
is not allowed
Reply | Threaded
Open this post in threaded view
|

[Bug sanitizer/87892] [9 Regression]: libsanitizer fails to build on CentOS 5.11 (glibc 2.5)

asolokha at gmx dot com
In reply to this post by asolokha at gmx dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87892

--- Comment #7 from Martin Liška <marxin at gcc dot gnu.org> ---
Author: marxin
Date: Fri Nov  9 09:14:36 2018
New Revision: 265950

URL: https://gcc.gnu.org/viewcvs?rev=265950&root=gcc&view=rev
Log:
Fallback in libsanitizer for scudo sanitizer (PR sanitizer/87892).

2018-11-09  Martin Liska  <[hidden email]>

        PR sanitizer/87892
        * sanitizer_common/sanitizer_linux_libcdep.cc (defined): Return
        1 when CPU_COUNT macro is not defined.

Modified:
    trunk/libsanitizer/ChangeLog
    trunk/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc
Reply | Threaded
Open this post in threaded view
|

[Bug sanitizer/87892] [9 Regression]: libsanitizer fails to build on CentOS 5.11 (glibc 2.5)

asolokha at gmx dot com
In reply to this post by asolokha at gmx dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87892

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #8 from Martin Liška <marxin at gcc dot gnu.org> ---
Fixed.