[Openmp-commits] [PATCH] D96187: [OpenMP] Fix libomptarget tests to find libomp

Joel E. Denny via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Fri Feb 5 16:27:38 PST 2021


jdenny created this revision.
jdenny added reviewers: jdoerfert, grokos, tianshilei1992, RaviNarayanaswamy.
Herald added subscribers: guansong, yaxunl.
jdenny requested review of this revision.
Herald added a subscriber: sstefan1.
Herald added a project: OpenMP.

Without this patch, libomptarget tests fail to find libomp.so, whether
I configure openmp as part of LLVM_ENABLE_RUNTIMES or
LLVM_ENABLE_PROJECTS.

In the LLVM_ENABLE_PROJECTS case only, it's already possible to work
around the problem by setting LD_LIBRARY_PATH appropriately before
calling "ninja check-libomptarget".  However, there was a time when
that wasn't necessary, and it seems like it shouldn't be.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D96187

Files:
  openmp/libomptarget/deviceRTLs/nvptx/test/lit.cfg
  openmp/libomptarget/deviceRTLs/nvptx/test/lit.site.cfg.in
  openmp/libomptarget/test/lit.cfg
  openmp/libomptarget/test/lit.site.cfg.in


Index: openmp/libomptarget/test/lit.site.cfg.in
===================================================================
--- openmp/libomptarget/test/lit.site.cfg.in
+++ openmp/libomptarget/test/lit.site.cfg.in
@@ -6,6 +6,7 @@
 config.test_openmp_flags = "@OPENMP_TEST_OPENMP_FLAGS@"
 config.test_extra_flags = "@OPENMP_TEST_FLAGS@"
 config.libomptarget_obj_root = "@CMAKE_CURRENT_BINARY_DIR@"
+config.libomp_library_dir = "@LIBOMP_LIBRARY_DIR@"
 config.library_dir = "@LIBOMPTARGET_LIBRARY_DIR@"
 config.omp_header_directory = "@LIBOMPTARGET_OPENMP_HEADER_FOLDER@"
 config.omp_host_rtl_directory = "@LIBOMPTARGET_OPENMP_HOST_RTL_FOLDER@"
Index: openmp/libomptarget/test/lit.cfg
===================================================================
--- openmp/libomptarget/test/lit.cfg
+++ openmp/libomptarget/test/lit.cfg
@@ -41,7 +41,8 @@
 # compiler flags
 config.test_flags = " -I " + config.test_source_root + \
     " -I " + config.omp_header_directory + \
-    " -L " + config.library_dir;
+    " -L " + config.library_dir + \
+    " -L " + config.libomp_library_dir;
 
 if config.omp_host_rtl_directory:
     config.test_flags = config.test_flags + " -L " + \
@@ -60,18 +61,25 @@
 # Setup environment to find dynamic library at runtime
 if config.operating_system == 'Windows':
     append_dynamic_library_path('PATH', config.library_dir, ";")
+    append_dynamic_library_path('PATH', config.libomp_library_dir, ";")
     append_dynamic_library_path('PATH', config.omp_host_rtl_directory, ";")
 elif config.operating_system == 'Darwin':
     append_dynamic_library_path('DYLD_LIBRARY_PATH', config.library_dir, ":")
+    append_dynamic_library_path('DYLD_LIBRARY_PATH', config.libomp_library_dir,
+                                ":")
     append_dynamic_library_path('DYLD_LIBRARY_PATH', \
         config.omp_host_rtl_directory, ";")
     config.test_flags += " -Wl,-rpath," + config.library_dir
+    config.test_flags += " -Wl,-rpath," + config.libomp_library_dir
     config.test_flags += " -Wl,-rpath," + config.omp_host_rtl_directory
 else: # Unices
     append_dynamic_library_path('LD_LIBRARY_PATH', config.library_dir, ":")
+    append_dynamic_library_path('LD_LIBRARY_PATH', config.libomp_library_dir,
+                                ":")
     append_dynamic_library_path('LD_LIBRARY_PATH', \
         config.omp_host_rtl_directory, ":")
     append_dynamic_library_path('LIBRARY_PATH', config.library_dir, ":")
+    append_dynamic_library_path('LIBRARY_PATH', config.libomp_library_dir, ":")
     append_dynamic_library_path('LIBRARY_PATH', \
         config.omp_host_rtl_directory, ":")
 
Index: openmp/libomptarget/deviceRTLs/nvptx/test/lit.site.cfg.in
===================================================================
--- openmp/libomptarget/deviceRTLs/nvptx/test/lit.site.cfg.in
+++ openmp/libomptarget/deviceRTLs/nvptx/test/lit.site.cfg.in
@@ -5,6 +5,7 @@
 config.test_openmp_flags = "@LIBOMPTARGET_NVPTX_TEST_OPENMP_FLAGS@"
 config.test_extra_flags = "@LIBOMPTARGET_NVPTX_TEST_FLAGS@"
 config.binary_dir = "@CMAKE_CURRENT_BINARY_DIR@"
+config.libomp_library_dir = "@LIBOMP_LIBRARY_DIR@"
 config.library_dir = "@LIBOMPTARGET_LIBRARY_DIR@"
 config.omp_header_directory = "@LIBOMPTARGET_OPENMP_HEADER_FOLDER@"
 config.omp_host_rtl_directory = "@LIBOMPTARGET_OPENMP_HOST_RTL_FOLDER@"
Index: openmp/libomptarget/deviceRTLs/nvptx/test/lit.cfg
===================================================================
--- openmp/libomptarget/deviceRTLs/nvptx/test/lit.cfg
+++ openmp/libomptarget/deviceRTLs/nvptx/test/lit.cfg
@@ -33,6 +33,7 @@
 # compiler flags
 config.test_flags = " -I " + config.omp_header_directory + \
     " -L " + config.library_dir + \
+    " -L " + config.libomp_library_dir + \
     " --libomptarget-nvptx-path=" + config.library_dir;
 
 if config.omp_host_rtl_directory:
@@ -43,6 +44,7 @@
 
 # Setup environment to find dynamic library at runtime.
 prepend_library_path('LD_LIBRARY_PATH', config.library_dir, ":")
+prepend_library_path('LD_LIBRARY_PATH', config.libomp_library_dir, ":")
 prepend_library_path('LD_LIBRARY_PATH', config.omp_host_rtl_directory, ":")
 
 # Forbid fallback to host.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D96187.321894.patch
Type: text/x-patch
Size: 4130 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20210206/585ccc49/attachment.bin>


More information about the Openmp-commits mailing list