Skip to content

[clang] Fix missing installed header #95979

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

Merged
merged 1 commit into from
Jun 20, 2024

Conversation

danielotero
Copy link
Contributor

Since commit 8d468c1, the header openmp_wrappers/complex is hidden behind openmp_wrappers/complex.h due to a bug in CMake1, so is not actually installed.

To test the issue, you can ask ninja to generate the file on your build:

$ ninja lib/clang/19/include/openmp_wrappers/complex.h
[199/199] Copying clang's openmp_wrappers/complex.h...
$ ninja lib/clang/19/include/openmp_wrappers/complex
ninja: error: unknown target 'lib/clang/19/include/openmp_wrappers/complex', did you mean 'lib/clang/19/include/openmp_wrappers/complex.h'? 

Re-ordering the entries workarounds the issue. The other option is to revert the cited commit, but I'm not sure which approach is preferred.

CC @etcwilde @jdoerfert

Footnotes

  1. Here is the CMake report on the issue.

Since commit 8d468c1, the header
`openmp_wrappers/complex` is hidden behind `openmp_wrappers/complex.h`
due to a bug in CMake, so is not actually installed.

Re-ordering the entries workarounds the issue.

See https://gitlab.kitware.com/cmake/cmake/-/issues/26058 for more
information on the CMake bug.
Copy link

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 clang Clang issues not falling into any other category backend:X86 clang:headers Headers provided by Clang, e.g. for intrinsics labels Jun 18, 2024
@llvmbot
Copy link
Member

llvmbot commented Jun 18, 2024

@llvm/pr-subscribers-clang

@llvm/pr-subscribers-backend-x86

Author: Daniel Otero (danielotero)

Changes

Since commit 8d468c1, the header openmp_wrappers/complex is hidden behind openmp_wrappers/complex.h due to a bug in CMake1, so is not actually installed.

To test the issue, you can ask ninja to generate the file on your build:

$ ninja lib/clang/19/include/openmp_wrappers/complex.h
[199/199] Copying clang's openmp_wrappers/complex.h...
$ ninja lib/clang/19/include/openmp_wrappers/complex
ninja: error: unknown target 'lib/clang/19/include/openmp_wrappers/complex', did you mean 'lib/clang/19/include/openmp_wrappers/complex.h'? 

Re-ordering the entries workarounds the issue. The other option is to revert the cited commit, but I'm not sure which approach is preferred.

CC @etcwilde @jdoerfert


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

1 Files Affected:

  • (modified) clang/lib/Headers/CMakeLists.txt (+3-1)
diff --git a/clang/lib/Headers/CMakeLists.txt b/clang/lib/Headers/CMakeLists.txt
index d3090e488306f..89fa0ecd45eb4 100644
--- a/clang/lib/Headers/CMakeLists.txt
+++ b/clang/lib/Headers/CMakeLists.txt
@@ -318,8 +318,10 @@ set(ppc_wrapper_files
 set(openmp_wrapper_files
   openmp_wrappers/math.h
   openmp_wrappers/cmath
-  openmp_wrappers/complex.h
+  # Due to a bug in CMake, `complex` must be before `complex.h`
+  # See: https://gitlab.kitware.com/cmake/cmake/-/issues/26058
   openmp_wrappers/complex
+  openmp_wrappers/complex.h
   openmp_wrappers/__clang_openmp_device_functions.h
   openmp_wrappers/complex_cmath.h
   openmp_wrappers/new

Footnotes

  1. Here is the CMake report on the issue.

Copy link
Contributor

@etcwilde etcwilde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice find. That's kind of horrifying. I'm fine with flipping the file order to avoid the source file caching bug in CMake.
CC @compnerd since he also knows CMake and may have opinions.

@mathstuf
Copy link
Contributor

Nice find. That's kind of horrifying.

Indeed. CMake's old "guess the extension" behavior was always a…fun thing to deal with. Alas, this emergent behavior was unknown at the time and a straight fix is likely to break other projects :( . Plus it's not likely we'll get patched releases for the past 18 releases. Luckily, there is a fix here. We'll get this in the test suite and properly nailed down though; hopefully we can detect this behavior so that other projects can discover such instances as well.

@danielotero
Copy link
Contributor Author

I forgot to say I don't have commit access, so feel free to merge this.

@etcwilde etcwilde merged commit 651d44d into llvm:main Jun 20, 2024
11 checks passed
Copy link

@danielotero Congratulations on having your first Pull Request (PR) merged into the LLVM Project!

Your changes will be combined with recent changes from other authors, then tested
by our build bots. If there is a problem with a build, you may receive a report in an email or a comment on this PR.

Please check whether problems have been caused by your change specifically, as
the builds can include changes from many authors. It is not uncommon for your
change to be included in a build that fails due to someone else's changes, or
infrastructure issues.

How to do this, and the rest of the post-merge process, is covered in detail here.

If your change does cause a problem, it may be reverted, or you can revert it yourself.
This is a normal part of LLVM development. You can fix your changes and open a new PR to merge them again.

If you don't get any reports, no action is required from you. Your changes are working as expected, well done!

@etcwilde
Copy link
Contributor

@danielotero Thank you for your contribution.

@danielotero danielotero deleted the fix-missing-omp-complex-header branch July 1, 2024 14:26
AlexisPerry pushed a commit to llvm-project-tlp/llvm-project that referenced this pull request Jul 9, 2024
Since commit 8d468c1, the header
`openmp_wrappers/complex` is hidden behind `openmp_wrappers/complex.h`
due to a bug in CMake[^1], so is not actually installed.

To test the issue, you can ask `ninja` to generate the file on your
build:

```
$ ninja lib/clang/19/include/openmp_wrappers/complex.h
[199/199] Copying clang's openmp_wrappers/complex.h...
$ ninja lib/clang/19/include/openmp_wrappers/complex
ninja: error: unknown target 'lib/clang/19/include/openmp_wrappers/complex', did you mean 'lib/clang/19/include/openmp_wrappers/complex.h'? 
```

Re-ordering the entries workarounds the issue. The other option is to
revert the cited commit, but I'm not sure which approach is preferred.

CC @etcwilde @jdoerfert 

[^1]: [Here](https://gitlab.kitware.com/cmake/cmake/-/issues/26058) is
the CMake report on the issue.
@etcwilde
Copy link
Contributor

For folks landing here, this should be fixed in CMake 4.1 by policy CMP0187.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend:X86 clang:headers Headers provided by Clang, e.g. for intrinsics clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants