[libcxx-commits] [PATCH] D82702: [libc++] Use a proper CMake target to represent libc++ headers

Petr Hosek via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sun Jul 12 20:13:24 PDT 2020


phosek added a comment.

In D82702#2146195 <https://reviews.llvm.org/D82702#2146195>, @phosek wrote:

> I spent some time debugging this, and to be honest, I don't know what's going on. The problem is that in the multilib variant case, the header includes are missing. So normally, the generated Ninja entries would look like this:
>
>   build libcxx/src/CMakeFiles/cxx_static.dir/filesystem/operations.cpp.obj: CXX_COMPILER__cxx_static /src/clang-llvm/llvm-project/libcxx/src/filesystem/operations.cpp || cmake_object_order_depends_target_cxx_static
>     DEFINES = -DNDEBUG -D_LIBCPP_BUILDING_LIBRARY -D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
>     DEP_FILE = libcxx/src/CMakeFiles/cxx_static.dir/filesystem/operations.cpp.obj.d
>     FLAGS = --target=x86_64-unknown-fuchsia -I/usr/local/google/home/phosek/clang-llvm/sdk/pkg/fdio/include -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wstring-conversion -ffunction-sections -fdata-sections -ffile-prefix-map=/src/clang-llvm/llvm-build/fuchsia/runtimes/runtimes-x86_64-unknown-fuchsia-bins=../llvm-build/fuchsia/runtimes/runtimes-x86_64-unknown-fuchsia-bins -ffile-prefix-map=/src/clang-llvm/llvm-project/= -no-canonical-prefixes -O2 -g -DNDEBUG   -DLIBCXX_BUILDING_LIBCXXABI -nostdinc++ -fvisibility-inlines-hidden -fvisibility=hidden -Wall -Wextra -W -Wwrite-strings -Wno-unused-parameter -Wno-long-long -Werror=return-type -Wextra-semi -Wno-user-defined-literals -Wno-covered-switch-default -Wno-ignored-attributes -Wno-error -fvisibility-global-new-delete-hidden -include /src/clang-llvm/llvm-build/fuchsia/runtimes/runtimes-x86_64-unknown-fuchsia-bins/libcxx/__config_site -std=c++14
>     INCLUDES = -Ilibcxx/include/c++build -I/src/clang-llvm/llvm-build/fuchsia/include/c++/v1
>     OBJECT_DIR = libcxx/src/CMakeFiles/cxx_static.dir
>     OBJECT_FILE_DIR = libcxx/src/CMakeFiles/cxx_static.dir/filesystem
>
>
> but with this patch, we would end up with this:
>
>   build libcxx/src/CMakeFiles/cxx_static.dir/filesystem/operations.cpp.obj: CXX_COMPILER__cxx_static /src/clang-llvm/llvm-project/libcxx/src/filesystem/operations.cpp || cmake_object_order_depends_target_cxx_static
>     DEFINES = -DNDEBUG -D_LIBCPP_BUILDING_LIBRARY -D_LIBCPP_DISABLE_NEW_DELETE_DEFINITIONS -D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
>     DEP_FILE = libcxx/src/CMakeFiles/cxx_static.dir/filesystem/operations.cpp.obj.d
>     FLAGS = --target=x86_64-unknown-fuchsia -I/usr/local/google/home/phosek/clang-llvm/sdk/pkg/fdio/include -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wstring-conversion -fno-omit-frame-pointer -fsanitize=address -fsanitize-address-use-after-scope -ffunction-sections -fdata-sections -ffile-prefix-map=/src/clang-llvm/llvm-build/fuchsia/runtimes/runtimes-x86_64-unknown-fuchsia+asan+noexcept-bins=../llvm-build/fuchsia/runtimes/runtimes-x86_64-unknown-fuchsia+asan+noexcept-bins -ffile-prefix-map=/src/clang-llvm/llvm-project/= -no-canonical-prefixes -O2 -g -DNDEBUG   -DLIBCXX_BUILDING_LIBCXXABI -fno-omit-frame-pointer -gline-tables-only -fsanitize=address -fsanitize=address -nostdinc++ -fvisibility-inlines-hidden -fvisibility=hidden -Wall -Wextra -W -Wwrite-strings -Wno-unused-parameter -Wno-long-long -Werror=return-type -Wextra-semi -Wno-user-defined-literals -Wno-covered-switch-default -Wno-ignored-attributes -Wno-error -fno-exceptions -include /src/clang-llvm/llvm-build/fuchsia/runtimes/runtimes-x86_64-unknown-fuchsia+asan+noexcept-bins/libcxx/__config_site -std=c++14
>     INCLUDES = -Ilibcxx/include/c++build
>     OBJECT_DIR = libcxx/src/CMakeFiles/cxx_static.dir
>     OBJECT_FILE_DIR = libcxx/src/CMakeFiles/cxx_static.dir/filesystem
>
>
> See the `INCLUDES` variable, in the latter case, `-I/src/clang-llvm/llvm-build/fuchsia/include/c++/v1` is missing so compiler fails to find libc++ headers.
>
> I have no idea why that happens. I inserted debugging prints into various places and I haven't seen any obvious issue. The only difference between the two runtime builds is (aside from ASan instrumentation) that in the latter case, compiler-rt isn't being built as part of runtimes, but I still don't see why that would should matter here.


One more thing I've noticed is that both of those invocations include `__config_site` which is added by the `cxx-headers` interface library, so that library must be used, it's just as if `target_include_directories(${CXX_HEADER_TARGET} INTERFACE ${output_dir})` was ignored when building the instrumented version.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D82702/new/

https://reviews.llvm.org/D82702





More information about the libcxx-commits mailing list