Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 851903 - sys-devel/clang-14.0.5 cmake cannot find the correct header
Summary: sys-devel/clang-14.0.5 cmake cannot find the correct header
Status: RESOLVED WORKSFORME
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo Linux bug wranglers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-06-14 11:00 UTC by Yiyang Wu
Modified: 2022-06-15 10:11 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Yiyang Wu 2022-06-14 11:00:13 UTC
using find_package(Clang) in CMakeLists.txt returns the wrong CLANG_INSTALL_PREFIX and CLANG_INCLUDE_DIRS

Reproducible: Always

Steps to Reproduce:
1. Create an minimum reproducing unit:
$cat CMakeLists.txt:
project(test)
cmake_minimum_required(VERSION 3.22)
find_package(Clang)
message("CLANG_INSTALL_PREFIX=${CLANG_INSTALL_PREFIX}")
message("CLANG_INCLUDE_DIRS=${CLANG_INCLUDE_DIRS}")
add_executable(hello hello.c)


$cat helloc
hello.c: empty
2. mkdir build; cd build; cmake .. -G Ninja
3. Find out that CLANG_INSTALL_PREFIX and CLANG_INCLUDE_DIRS are wrong:

Actual Results:  
-- The C compiler identification is GNU 11.3.1
-- The CXX compiler identification is GNU 11.3.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test HAVE_FFI_CALL
-- Performing Test HAVE_FFI_CALL - Success
-- Found FFI: /opt/gentoo/usr/lib64/libffi.so
-- Performing Test Terminfo_LINKABLE
-- Performing Test Terminfo_LINKABLE - Success
-- Found Terminfo: /usr/lib64/libtinfo.so
-- Found ZLIB: /usr/lib64/libz.so (found version "1.2.11")
CLANG_INSTALL_PREFIX=/usr/lib/llvm/14
CLANG_INCLUDE_DIRS=/usr/lib/llvm/14/include
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/cm/build

Expected Results:  
CLANG_INSTALL_PREFIX should be /opt/gentoo/usr/lib/clang/<version>
Comment 1 Yiyang Wu 2022-06-14 11:55:17 UTC
While /usr/lib/llvm/14/include/clang is one of the clang include dir, but what about /usr/lib/clang/14.0.5/include?
Comment 2 Yiyang Wu 2022-06-14 11:58:34 UTC
CLANG_RESOURCE_DIR is pointing to the correct location. So I suppose this bug can be closed.
Comment 3 Yiyang Wu 2022-06-14 12:03:07 UTC
(In reply to Yiyang Wu from comment #2)
> CLANG_RESOURCE_DIR is pointing to the correct location. So I suppose this
> bug can be closed.

Oh CLANG_RESOURCE_DIR is defined in a header, not in cmake. Reopen this ticket.