-
Notifications
You must be signed in to change notification settings - Fork 14.7k
[flang/flang-rt] Add -isysroot flag only to tests really requiring #152914
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
Conversation
-isysroot flag was added to all tests, but it makes Driver/darwin-version.f90 failed. In fact, only a few tests need -isysroot flag. So, -isysroot flag is now eliminated from the substitution `%flang`, and a new substitution `%isysroot` has been introduced. Moreover, Integration/iso-fortran-binding.cpp invokes clang++ via a shell script, which makes it hard to add -isysroot flag. So, it is refactored.
flang/test/Integration/lit.local.cfg
Outdated
|
||
# Include path for C headers that define Flang's Fortran ABI. | ||
config.substitutions.append( | ||
("%include", os.path.join(config.flang_source_dir, "include")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this for? I comment it out and it still works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be necessary when building flang standalone.
/path/to/build/bin/clang --driver-mode=g++ -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX15.5.sdk -I %include/flang /path/to/llvm-project/flang/test/Integration/iso-fortran-binding.cpp -o /path/to/build2/flang/test/Integration/Output/iso-fortran-binding.cpp.tmp/a.out # RUN: at line 4
+ /path/to/build/bin/clang --driver-mode=g++ -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX15.5.sdk -I %include/flang /path/to/llvm-project/flang/test/Integration/iso-fortran-binding.cpp -o /path/to/build2/flang/test/Integration/Output/iso-fortran-binding.cpp.tmp/a.out
/path/to/llvm-project/flang/test/Integration/iso-fortran-binding.cpp:8:10: fatal error: 'ISO_Fortran_binding.h' file not found
8 | #include "ISO_Fortran_binding.h"
| ^~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
--
/path/to/build/bin/clang++
does not search /path/to/build2/lib/clang/22/include
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you
@@ -6,10 +6,12 @@ import lit.util | |||
config.llvm_tools_dir = lit_config.substitute("@LLVM_TOOLS_DIR@") | |||
config.llvm_shlib_dir = lit_config.substitute(path(r"@SHLIBDIR@")) | |||
config.llvm_plugin_ext = "@LLVM_PLUGIN_EXT@" | |||
config.host_triple = "@LLVM_HOST_TRIPLE@" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why has this been added? I don't see it being used anywhere in this PR - at least not directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is used by llvm_config.use_clang(required=False)
. But it also has a fallback when not defined. Without e.g. the feature native
is not defined. Not sure we strictly need it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I remove this line, I'll get the following error message. We could fix clang_setup
by adding a check for hasattr(self.config, "host_triple")
, but I'm not sure it is better.
llvm-lit: /path/to/llvm-project/llvm/utils/lit/lit/TestingConfig.py:157: fatal: unable to parse config file '/path/to/llvm-project/flang/test/lit.cfg.py', traceback: Traceback (most recent call last):
File "/path/to/llvm-project/llvm/utils/lit/lit/TestingConfig.py", line 145, in load_from_path
exec(compile(data, path, "exec"), cfg_globals, None)
~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/path/to/llvm-project/flang/test/lit.cfg.py", line 175, in <module>
llvm_config.use_clang(required=False)
~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
File "/path/to/llvm-project/llvm/utils/lit/lit/llvm/config.py", line 689, in use_clang
self.clang_setup(additional_tool_dirs)
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
File "/path/to/llvm-project/llvm/utils/lit/lit/llvm/config.py", line 638, in clang_setup
if self.config.host_triple and self.config.host_triple != "@LLVM_HOST_TRIPLE@":
^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'TestingConfig' object has no attribute 'host_triple'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've seen hasattr(self.config, "host_triple")
at other places, seems that some change did not consider it may not be set.
Since we would want clang to know whether it is cross-compiling, I would keep config.host_triple = ..
as-is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Except for @tarunprabhu's comments, LGTM, thanks.
✅ With the latest revision this PR passed the Python code formatter. |
3ceb84e
to
0cef883
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks for the changes
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/201/builds/5894 Here is the relevant piece of the build log for the reference
|
-isysroot flag was added to all tests, but it makes Driver/darwin-version.f90 failed.
In fact, only a few tests regarding interoperability with C need -isysroot flag to search for headers and libraries. So, -isysroot flag is now eliminated from the substitution
%flang
, and a new substitution%isysroot
has been introduced.Moreover, Integration/iso-fortran-binding.cpp invokes clang++ via a shell script, which makes it hard to add -isysroot flag. So, it is refactored.
Fixes #150765