glibc stopped installing rpc headers by default back in 2011: versions 2.14 and 2.15 never install them, versions 2.16 and higher require the configuration option --enable-obsolete-rpc. Most distros still install the headers for backwards compatibility, but on systems that use default glibc, building libsanitizer, and thus GCC, fails with ../../../../gcc/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc:134:21: fatal error: rpc/xdr.h: No such file or directory Given that libsanitizer doesn't actually use anything from the header other than as a sanity check, the build shouldn't fail if the header is missing. GCC is configured with ../gcc/configure --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --prefix=$HOME/gcc-run --enable-languages=c,c++ and re-checked today with sources from: commit 31aebeec4f215f444c96c0dbc333c4eff3f7809a Author: ienkovich <ienkovich@138bc75d-0d04-0410-961f-82ee72b054a4> Date: Wed Jan 28 11:46:44 2015 +0000 Version 4.9.2 builds just fine.
FWIW, libsanitizer builds just fine if the rpc references are forcibly removed, like so: --- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc +++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc @@ -131,7 +131,6 @@ #include <netax25/ax25.h> #include <netipx/ipx.h> #include <netrom/netrom.h> -#include <rpc/xdr.h> #include <scsi/scsi.h> #include <sys/mtio.h> #include <sys/kd.h> @@ -1148,19 +1147,6 @@ CHECK_SIZE_AND_OFFSET(group, gr_gid); CHECK_SIZE_AND_OFFSET(group, gr_mem); #if SANITIZER_LINUX && !SANITIZER_ANDROID -CHECK_TYPE_SIZE(XDR); -CHECK_SIZE_AND_OFFSET(XDR, x_op); -CHECK_SIZE_AND_OFFSET(XDR, x_ops); -CHECK_SIZE_AND_OFFSET(XDR, x_public); -CHECK_SIZE_AND_OFFSET(XDR, x_private); -CHECK_SIZE_AND_OFFSET(XDR, x_base); -CHECK_SIZE_AND_OFFSET(XDR, x_handy); -COMPILER_CHECK(__sanitizer_XDR_ENCODE == XDR_ENCODE); -COMPILER_CHECK(__sanitizer_XDR_DECODE == XDR_DECODE); -COMPILER_CHECK(__sanitizer_XDR_FREE == XDR_FREE); -#endif - -#if SANITIZER_LINUX && !SANITIZER_ANDROID COMPILER_CHECK(sizeof(__sanitizer_FILE) <= sizeof(FILE)); CHECK_SIZE_AND_OFFSET(FILE, _flags); CHECK_SIZE_AND_OFFSET(FILE, _IO_read_ptr); But that's clearly not acceptable :)
Confirmed.
I've sent fix upstream: http://reviews.llvm.org/D8698 . We'll probably need similar checks for existance of xdr.h in GCC Autoconf.
Finally fixed upstream in https://github.com/llvm-mirror/compiler-rt/commit/d09b23010698144d10cba0dacc5c599f230cbf62 . Does anyone have time to backport to GCC 5?
Created attachment 35286 [details] Proposed patch Would something like this make sense? If yes, I'll do full round of testing and send to gcc-patches so that we hopefully get it in GCC5.
if test "$ac_cv_header_rpc_xdr_h" = "yes"; then etc. should be written as if test x"$ac_cv_header_rpc_xdr_h" = xyes; then Otherwise, LGTM (patch preapproved), but if you want to get it into GCC 5, commit it RSN (within a few hours).
Author: ygribov Date: Mon Apr 13 08:59:55 2015 New Revision: 222043 URL: https://gcc.gnu.org/viewcvs?rev=222043&root=gcc&view=rev Log: 2015-04-13 Yury Gribov <y.gribov@samsung.com> PR sanitizer/64839 libsanitizer/ * sanitizer_common/sanitizer_platform.h: Cherry pick upstream r234470. * sanitizer_common/sanitizer_platform_limits_posix.cc: Ditto. * configure.ac (RPC_DEFS): Check for precense of RPC headers. * sanitizer_common/Makefile.am (DEFS): Pass info to compiler. * Makefile.in: Regenerate. * asan/Makefile.in: Regenerate. * config.h.in: Regenerate. * configure: Regenerate. * interception/Makefile.in: Regenerate. * libbacktrace/Makefile.in: Regenerate. * lsan/Makefile.in: Regenerate. * sanitizer_common/Makefile.in: Regenerate. * tsan/Makefile.in: Regenerate. * ubsan/Makefile.in: Regenerate. Modified: trunk/libsanitizer/ChangeLog trunk/libsanitizer/Makefile.in trunk/libsanitizer/asan/Makefile.in trunk/libsanitizer/config.h.in trunk/libsanitizer/configure trunk/libsanitizer/configure.ac trunk/libsanitizer/interception/Makefile.in trunk/libsanitizer/libbacktrace/Makefile.in trunk/libsanitizer/lsan/Makefile.in trunk/libsanitizer/sanitizer_common/Makefile.am trunk/libsanitizer/sanitizer_common/Makefile.in trunk/libsanitizer/sanitizer_common/sanitizer_platform.h trunk/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc trunk/libsanitizer/tsan/Makefile.in trunk/libsanitizer/ubsan/Makefile.in
Please consider backporting it to gcc-5-branch, but at this point only after 5.1 is released.
Is there something I can do to help move this along? I've tried to locally backport Yury's changeset to the gcc-5-branch and the only conflict I get is in ChangeLog and that's easy to fix up. I don't have commit access, though, so I can't commit the result.
Did libsanitizer build for you both with and without xdr.h? If yes, I'll just go ahead and submit this.
(In reply to Yury Gribov from comment #10) > Did libsanitizer build for you both with and without xdr.h? If yes, I'll > just go ahead and submit this. I'm using your patch applied to 5.1.0 without issues on my system without xdr.h. If you need someone to confirm that it doesn't break systems that do have it, and don't get feedback from someone else soon enough, I can probably check that in the weekend.
> I'm using your patch applied to 5.1.0 without issues on my system without xdr.h. That's probably ok, thanks. I'll submit on Monday then (to be online if problems arise).
Author: ygribov Date: Tue May 12 07:02:09 2015 New Revision: 223032 URL: https://gcc.gnu.org/viewcvs?rev=223032&root=gcc&view=rev Log: 2015-05-12 Yury Gribov <y.gribov@samsung.com> Backport from mainline 2015-04-13 Yury Gribov <y.gribov@samsung.com> PR sanitizer/64839 * sanitizer_common/sanitizer_platform.h: Cherry pick upstream r234470. * sanitizer_common/sanitizer_platform_limits_posix.cc: Ditto. * configure.ac (RPC_DEFS): Check for precense of RPC headers. * sanitizer_common/Makefile.am (DEFS): Pass info to compiler. * Makefile.in: Regenerate. * asan/Makefile.in: Regenerate. * config.h.in: Regenerate. * configure: Regenerate. * interception/Makefile.in: Regenerate. * libbacktrace/Makefile.in: Regenerate. * lsan/Makefile.in: Regenerate. * sanitizer_common/Makefile.in: Regenerate. * tsan/Makefile.in: Regenerate. * ubsan/Makefile.in: Regenerate. Modified: branches/gcc-5-branch/libsanitizer/ChangeLog branches/gcc-5-branch/libsanitizer/Makefile.in branches/gcc-5-branch/libsanitizer/asan/Makefile.in branches/gcc-5-branch/libsanitizer/config.h.in branches/gcc-5-branch/libsanitizer/configure branches/gcc-5-branch/libsanitizer/configure.ac branches/gcc-5-branch/libsanitizer/interception/Makefile.in branches/gcc-5-branch/libsanitizer/libbacktrace/Makefile.in branches/gcc-5-branch/libsanitizer/lsan/Makefile.in branches/gcc-5-branch/libsanitizer/sanitizer_common/Makefile.am branches/gcc-5-branch/libsanitizer/sanitizer_common/Makefile.in branches/gcc-5-branch/libsanitizer/sanitizer_common/sanitizer_platform.h branches/gcc-5-branch/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc branches/gcc-5-branch/libsanitizer/tsan/Makefile.in branches/gcc-5-branch/libsanitizer/ubsan/Makefile.in
Thanks Yury.
(In reply to Thierry Reding from comment #14) > Thanks Yury. Np, you are welcome. @Harald: could you close the bug if it works for you?
Sorry to be an idiot, but I just ran into this building from the 5.1 release tarball. Is the patch attached to this bug (dated 2015-04-10) what I should use to patch against the release? Or is there a different set of changes specific to the 5.1 branch backport?
(In reply to Geoff Nixon from comment #16) > what I should use to patch against the release? > Or is there a different set of changes > specific to the 5.1 branch backport? For 5.1 you'd better use the patch in gcc-5-branch: https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=223032
Ok thanks, for other idiots like myself who can't seem to figure out how to get viewvc to generate a diff for a specific rev, a -p1 patch is: svn diff -c 223032 svn://gcc.gnu.org/svn/gcc/branches/gcc-5-branch Or if you don't have subversion installed, here: http://gist.github.com/anonymous/7f239960c46240d83a67/raw
Can the bug be marked as resolved?
(In reply to Martin Liška from comment #19) > Can the bug be marked as resolved? Yes, sorry for missing the earlier request to do so.