Skip to content

release/18.x: change the visibility of libc++ header to public in libcxx module #91182

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

RichardLuo0
Copy link
Contributor

This PR addresses a problem that headers may not be able to be found if #include is used with std modules.

Consider the following file:

#include <boost/json.hpp>
import std;

int main(int, const char **) { }

boost will include something from libc++, but we are using -nostdinc++, so the compiler can not find any default std header.
Therefore the locally built header needs to be public.

@RichardLuo0 RichardLuo0 requested a review from a team as a code owner May 6, 2024 10:45
Copy link

github-actions bot commented May 6, 2024

Thank you for submitting a Pull Request (PR) to the LLVM Project!

This PR will be automatically labeled and the relevant teams will be
notified.

If you wish to, you can add reviewers by using the "Reviewers" section on this page.

If this is not working for you, it is probably because you do not have write
permissions for the repository. In which case you can instead tag reviewers by
name in a comment by using @ followed by their GitHub username.

If you have received no comments on your PR for a week, you can request a review
by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate
is once a week. Please remember that you are asking for valuable time from other developers.

If you have further questions, they may be answered by the LLVM GitHub User Guide.

You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums.

@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label May 6, 2024
@llvmbot
Copy link
Member

llvmbot commented May 6, 2024

@llvm/pr-subscribers-libcxx

Author: RichardLuo (RichardLuo0)

Changes

This PR addresses a problem that headers may not be able to be found if #include is used with std modules.

Consider the following file:

#include &lt;boost/json.hpp&gt;
import std;

int main(int, const char **) { }

boost will include something from libc++, but we are using -nostdinc++, so the compiler can not find any default std header.
Therefore the locally built header needs to be public.


Full diff: https://github.com/llvm/llvm-project/pull/91182.diff

1 Files Affected:

  • (modified) libcxx/modules/CMakeLists.txt.in (+2-2)
diff --git a/libcxx/modules/CMakeLists.txt.in b/libcxx/modules/CMakeLists.txt.in
index e332d70cc16333..1f8f159e710cb9 100644
--- a/libcxx/modules/CMakeLists.txt.in
+++ b/libcxx/modules/CMakeLists.txt.in
@@ -41,7 +41,7 @@ target_sources(std
     std.cppm
 )
 
-target_include_directories(std SYSTEM PRIVATE @LIBCXX_CONFIGURED_INCLUDE_DIRS@)
+target_include_directories(std SYSTEM PUBLIC @LIBCXX_CONFIGURED_INCLUDE_DIRS@)
 
 if (NOT @LIBCXX_ENABLE_EXCEPTIONS@)
   target_compile_options(std PUBLIC -fno-exceptions)
@@ -67,7 +67,7 @@ target_sources(std.compat
     std.compat.cppm
 )
 
-target_include_directories(std.compat SYSTEM PRIVATE @LIBCXX_CONFIGURED_INCLUDE_DIRS@)
+target_include_directories(std.compat SYSTEM PUBLIC @LIBCXX_CONFIGURED_INCLUDE_DIRS@)
 
 if (NOT @LIBCXX_ENABLE_EXCEPTIONS@)
   target_compile_options(std.compat PUBLIC -fno-exceptions)

@RichardLuo0 RichardLuo0 changed the title change the visibility of libc++ header to public in libcxx module release/18.x: change the visibility of libc++ header to public in libcxx module May 6, 2024
@RichardLuo0
Copy link
Contributor Author

The checks error seems to have nothing to do with the changes

@nikic nikic added this to the LLVM 18.X Release milestone May 14, 2024
@tstellar
Copy link
Collaborator

@mordante Do you think we should backport this?

@tstellar
Copy link
Collaborator

Is there a similar change that is proposed for the main branch?

@RichardLuo0
Copy link
Contributor Author

Is there a similar change that is proposed for the main branch?

Yes #91240, I forget to mention that here.

@ldionne
Copy link
Member

ldionne commented Jul 9, 2024

Closing this PR since we are not making any more LLVM 18 releases. This will be included in LLVM 19.

@ldionne ldionne closed this Jul 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Projects
Development

Successfully merging this pull request may close these issues.

6 participants