This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP] [OMPD] Build gdb-plugin code only when python3 development files are available.
ClosedPublic

Authored by Vigneshbalu on Sep 20 2022, 5:22 AM.

Details

Summary

This is follow-up patch to the review https://reviews.llvm.org/D100185.

gdb-plugin code is a interface between gdb, libompd, gdb and libomp. and Python3 development files are required to build this utility.
This patch will disable the plugin code build when python3 dev files are not available.

Diff Detail

Event Timeline

Vigneshbalu created this revision.Sep 20 2022, 5:22 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 20 2022, 5:22 AM
Vigneshbalu requested review of this revision.Sep 20 2022, 5:22 AM
Herald added a project: Restricted Project. · View Herald Transcript
aaronpuchert added inline comments.Sep 20 2022, 2:59 PM
openmp/libompd/CMakeLists.txt
11–17

Use Python3_FOUND (see docs).

openmp/libompd/gdb-plugin/CMakeLists.txt
16

This should no longer be necessary if the parent directory finds it.

mgorny added inline comments.Sep 20 2022, 11:29 PM
openmp/libompd/CMakeLists.txt
11–12

I think option() is better for booleans.

https://cmake.org/cmake/help/latest/command/option.html

Vigneshbalu added inline comments.Sep 20 2022, 11:46 PM
openmp/libompd/CMakeLists.txt
11–17

Python3_Development_FOUND might be more suitable But i wonder whether it will be true when one of the artifacts was absent in rare scenario. Example Python3_INCLUDE_DIR is present but not Python3_LIBRARY
I assumed this would be safest.

mgorny added inline comments.Sep 21 2022, 4:10 AM
openmp/libompd/CMakeLists.txt
11–17

Python3_FOUND is FALSE if *any* of the requested components are missing. It's easy enough to check by renaming /usr/include/python3.x .

Vigneshbalu added inline comments.Sep 22 2022, 7:54 AM
openmp/libompd/CMakeLists.txt
11–17

I can see Python3_FOUND is false if i rename /usr/include/python3.x. However same is not true if i rename /usr/lib/x86_64-linux-gnu/libpython3.x.so . Even Python3_Development_FOUND doesn't work for above case.

this if check if (Python3_INCLUDE_DIRS AND Python3_LIBRARIES) also works fine with configuration if i rename library and fails at runtime.

I couldn't see any other reference anywhere in llvm-repo.
Am i missing something here ?

mgorny added inline comments.Sep 22 2022, 8:57 AM
openmp/libompd/CMakeLists.txt
11–17

It returns FALSE for me w/ CMake 3.24.2.

Apologies for delay. Updated the patch.

aaronpuchert accepted this revision.Oct 4 2022, 12:40 PM

Perhaps wait for @mgorny before you submit. Just a minor suggestion from me how you could simplify this.

openmp/libompd/CMakeLists.txt
11–16
This revision is now accepted and ready to land.Oct 4 2022, 12:40 PM
mgorny accepted this revision.Oct 5 2022, 10:34 PM
mgorny added inline comments.
openmp/libompd/CMakeLists.txt
11–16

I think it should be good to go once you implement this suggestion.

resolved review comments.

mgorny accepted this revision.Oct 6 2022, 2:16 AM
aaronpuchert accepted this revision.Oct 6 2022, 3:10 PM