Bug 61955 - libsanitizer fails to compile on RHEL4
Summary: libsanitizer fails to compile on RHEL4
Alias: None
Product: gcc
Classification: Unclassified
Component: sanitizer (show other bugs)
Version: 4.9.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
Keywords: build
Depends on:
Reported: 2014-07-29 16:31 UTC by Bruce Adams
Modified: 2021-08-17 00:04 UTC (History)
6 users (show)

See Also:
Known to work:
Known to fail:
Last reconfirmed:


Note You need to log in before you can comment on or make changes to this bug.
Description Bruce Adams 2014-07-29 16:31:14 UTC
gcc 4.9.0 fails to compile on a standard Red Hat 4 system due to problems compiling libsantiser. 
See also https://gcc.gnu.org/ml/gcc/2014-05/msg00219.html

The work around of configuring gcc --disable-libsanitizer progresses the build
(which then fails for other reasons see below)

I would have thought this was a reasonably popular target still but there do not seem to be any other reports.
I tried again using gcc 4.9.1 and the problem still occurs.
This target build successfully using the same method for gcc 4.8.1

brucea@:development/brucea/gcc>lsb_release -a
LSB Version:	:core-3.0-amd64:core-3.0-ia32:core-3.0-noarch:graphics-3.0-amd64:graphics-3.0-ia32:graphics-3.0-noarch
Distributor ID:	RedHatEnterpriseES
Description:	Red Hat Enterprise Linux ES release 4 (Nahant Update 5)
Release:	4
Codename:	NahantUpdate5

brucea@:development/brucea/gcc>uname -a
Linux uktnswg-tvdev01.tnsad.com 2.6.9-55.ELsmp #1 SMP Fri Apr 20 16:36:54 EDT 2007 x86_64 x86_64 x86_64 GNU/Linux

Build using configure/make/install for each of the following in turn
gcc-4.9.0.tar.bz2   or gcc-4.9.1.tar.bz2

libtool: compile:  /development/brucea/gcc/build/build/./gcc/xgcc -shared-libgcc -B/development/brucea/gcc/build/build/./gcc -
nostdinc++ -L/development/brucea/gcc/build/build/x86_64-unknown-linux-gnu/libstdc++-v3/src -L/development/brucea/gcc/build/bui
ld/x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs -L/development/brucea/gcc/build/build/x86_64-unknown-linux-gnu/libstdc++-v3
/libsupc++/.libs -B/home/brucea/gcc4.9.1/x86_64-unknown-linux-gnu/bin/ -B/home/brucea/gcc4.9.1/x86_64-unknown-linux-gnu/lib/ -
isystem /home/brucea/gcc4.9.1/x86_64-unknown-linux-gnu/include -isystem /home/brucea/gcc4.9.1/x86_64-unknown-linux-gnu/sys-inc
libsanitizer/sanitizer_common -I.. -I ../../../../gcc-4.9.1/libsanitizer/include -isystem ../../../../gcc-4.9.1/libsanitizer/i
nclude/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../../libstd
c++-v3/include/x86_64-unknown-linux-gnu -I../../../../gcc-4.9.1/libsanitizer/../libstdc++-v3/libsupc++ -DSANITIZER_LIBBACKTRAC
E -DSANITIZER_CP_DEMANGLE -I ../../../../gcc-4.9.1/libsanitizer/../libbacktrace -I ../libbacktrace -I ../../../../gcc-4.9.1/li
bsanitizer/../include -include ../../../../gcc-4.9.1/libsanitizer/libbacktrace/backtrace-rename.h -g -O2 -D_GNU_SOURCE -MT san
itizer_platform_limits_linux.lo -MD -MP -MF .deps/sanitizer_platform_limits_linux.Tpo -c ../../../../gcc-4.9.1/libsanitizer/sa
nitizer_common/sanitizer_platform_limits_linux.cc  -fPIC -DPIC -o .libs/sanitizer_platform_limits_linux.o
In file included from ../../../../gcc-4.9.1/libsanitizer/sanitizer_common/sanitizer_platform_limits_linux.cc:49:0:
../../../../gcc-4.9.1/libsanitizer/include/system/linux/aio_abi.h:2:32: fatal error: linux/aio_abi.h: No such file or director
 #include_next <linux/aio_abi.h>
compilation terminated.
make[3]: *** [sanitizer_platform_limits_linux.lo] Error 1
make[3]: Leaving directory `/development/brucea/gcc/build/build/x86_64-unknown-linux-gnu/libsanitizer/sanitizer_common'
make[2]: *** [install-recursive] Error 1
make[2]: Leaving directory `/development/brucea/gcc/build/build/x86_64-unknown-linux-gnu/libsanitizer'
make[1]: *** [install-target-libsanitizer] Error 2
make[1]: Leaving directory `/development/brucea/gcc/build/build'
make: *** [install] Error 2
Comment 1 Bruce Adams 2014-07-29 16:37:21 UTC
configuring with --disable-libsantizer progresses the build but it fails later on linking cilk. See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61956
Comment 2 Bruce Adams 2014-08-22 20:45:02 UTC
Running configure using --disable-libcilkrts (in addition to --disable-libsanitiser) which is not documented results in a useable gcc 4.9.1 (with c++ working but presumably cilk++ broken).
Comment 3 Bruce Adams 2014-08-22 20:45:52 UTC
Running configure using --disable-libcilkrts (in addition to --disable-libsanitiser) which is not documented results in a useable gcc 4.9.1 (with c++ working but presumably cilk++ broken).
Comment 4 Pierre Ossman 2015-05-21 07:08:36 UTC
Unfortunately the git history doesn't go further back than 2.6.12 so I don't know when aio_abi.h got added. But the code only needs the enum, so something like this should work:

#include <linux/version.h>
/* aio_abi.h was added in 2.6.10 (FIXME: check this) */
enum {
        IOCB_CMD_PREAD = 0,
        IOCB_CMD_PWRITE = 1,
        IOCB_CMD_FSYNC = 2,
        IOCB_CMD_FDSYNC = 3,
        IOCB_CMD_NOOP = 6,
#include_next <linux/aio_abi.h>
/* IOCB_CMD_PREADV/PWRITEV has been added in 2.6.19 */
Comment 6 Dmitry Vyukov 2015-05-21 07:49:11 UTC
How does LINUX_VERSION_CODE relate to linux kernel version? What is the LINUX_VERSION_CODE value for 2.5.32? Is the other LINUX_VERSION_CODE value (132627) correct?
Comment 7 Andreas Schwab 2015-05-21 07:58:32 UTC
Format it as a hexadecimal number.
Comment 8 Dmitry Vyukov 2015-05-21 08:09:29 UTC
Kostya, Alexey, Eugeniy, please land this fix to llvm tree while I am OOO.
Comment 9 Pierre Ossman 2015-05-21 08:22:32 UTC
(In reply to Andreas Schwab from comment #5)
> <linux/aio_abi.h> was added in 2.5.32.
> https://git.kernel.org/cgit/linux/kernel/git/tglx/history.git/commit/
> ?id=ea5097be4e814a2a9457e60653052306295941e8

How can it be missing on RHEL 4 with 2.6.9 in that case?
Comment 11 Pierre Ossman 2015-05-21 08:50:30 UTC
Not really. :)

I stumbled upon this trying to use 2.4 headers, so I honestly haven't tried 2.6.9, RHEL variant or otherwise.