[PATCH] D47817: [sanitizer_common] Fix using libtirpc on Linux
Michał Górny via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 9 08:22:12 PDT 2018
mgorny added a comment.
In https://reviews.llvm.org/D47817#1155788, @Lekensteyn wrote:
> In https://reviews.llvm.org/D47817#1155717, @mgorny wrote:
>
> > > This would be the first user of pkg-config here. I am not sure if this would be the best fix. Usually you cannot (easily) recompile libc and override it, but for external libs such as libtirpc this should be more doable (I think).
> >
> > I don't think libtirpc's include path is expected to be predictable by design. I think it's something distro maintainers have to choose to avoid collision with headers that (used to be) installed by glibc. In any case, I can't think of a better solution than pkg-config here (libtirpc doesn't come with CMake modules).
>
>
> On Arch (libtirpc-1.0.3-2), Debian (libtirpc-dev 0.2.5-1.2 in sid), Gentoo (libtirpc-1.0.3), the include files happen to be installed in /usr/include/libtirpc, so it seems pretty consistent. So you could consider writing a `cmake/Modules/FindLibtirpc.cmake` module that looks like:
>
> # sets Libtirpc_FOUND Libtirpc_INCLUDE_DIRS
>
> find_path(Libtirpc_INCLUDE_DIR
> NAMES rpc/xdr.h
> PATH_SUFFIXES tirpc
> )
> include(FindPackageHandleStandardArgs)
> find_package_handle_standard_args(Libtirpc REQUIRED_VARS Libtirpc_INCLUDE_DIR)
> if(Libtirpc_FOUND)
> set(Libtirpc_INCLUDE_DIRS ${Libtirpc_INCLUDE_DIR})
> endif()
>
>
> then you can use `find_package(Libtirpc)` without depending on `pkg-config`.
I'm sorry but I'm not interested in putting a lot of effort to write a cheap hack-a-round to avoid following upstream recommendations. Not using pkg-config is just asking for forcing downstream maintainers to specially account for LLVM, and it only creates yet another excuse not to use pkg-config in the future ('because we managed to hack-it-around so far').
>> libtirpc case never could have worked.
>
> The reason for that is probably because of lib/sanitizer_common/sanitizer_platform.h saying:
>
> // Assume obsolete RPC headers are available by default
> #if !defined(HAVE_RPC_XDR_H) && !defined(HAVE_TIRPC_RPC_XDR_H)
> # define HAVE_RPC_XDR_H (SANITIZER_LINUX && !SANITIZER_ANDROID)
> # define HAVE_TIRPC_RPC_XDR_H 0
> #endif
>
>
> That should probably be addressed too.
Are you suggesting that I remove that?
Repository:
rCRT Compiler Runtime
https://reviews.llvm.org/D47817
More information about the cfe-commits
mailing list