<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - libomptarget :: offloading/dynamic_module_load.c failing"
   href="https://bugs.llvm.org/show_bug.cgi?id=50204">50204</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>libomptarget :: offloading/dynamic_module_load.c failing
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>OpenMP
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Runtime Library
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>bryanpkc@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The test offloading/dynamic_module_load.c is a no-op if none of the offloading
plugins is built. However, when I build LLVM 12 with OpenMP enabled, on a
Ubuntu 20.04 system with libelf and libffi headers, the offloading plugins are
built, and the test fails with a C++ exception.

The CMake command I am using is:

cmake -G Ninja \
  -DCMAKE_BUILD_TYPE=Debug \
  -DCMAKE_C_COMPILER=gcc \
  -DCMAKE_CXX_COMPILER=g++ \
  -DLLVM_ENABLE_PROJECTS="clang;openmp" \
  -DLLVM_ENABLE_ASSERTIONS=on \
  -DLLVM_OPTIMIZED_TABLEGEN=on \
  -DLLVM_TARGETS_TO_BUILD="X86" \
  ../llvm

The relevant lines of CMake output are:

-- Found LIBOMPTARGET_DEP_LIBELF: /usr/lib/x86_64-linux-gnu/libelf.so
-- Found LIBOMPTARGET_DEP_LIBFFI: /usr/lib/x86_64-linux-gnu/libffi.so
-- Could NOT find LIBOMPTARGET_DEP_CUDA_DRIVER (missing:
LIBOMPTARGET_DEP_CUDA_DRIVER_LIBRARIES)
-- Could NOT find LIBOMPTARGET_DEP_VEO (missing: LIBOMPTARGET_DEP_VEO_LIBRARIES
LIBOMPTARGET_DEP_VEOSINFO_LIBRARIES LIBOMPTARGET_DEP_VEO_INCLUDE_DIRS)
-- LIBOMPTARGET: Building offloading runtime library libomptarget.
-- LIBOMPTARGET: Not building aarch64 offloading plugin: machine not found in
the system.
-- LIBOMPTARGET: Not building AMDGPU plugin: hsa-runtime64 not found
-- LIBOMPTARGET: Building CUDA offloading plugin.
-- LIBOMPTARGET: Building CUDA plugin for dlopened libcuda
-- LIBOMPTARGET: Disabling tests using CUDA plugin as cuda may not be available
-- LIBOMPTARGET: Not building PPC64 offloading plugin: machine not found in the
system.
-- LIBOMPTARGET: Not building PPC64le offloading plugin: machine not found in
the system.
-- LIBOMPTARGET: Not building nec-aurora plugin: libveo or libveosinfo not
found.
-- LIBOMPTARGET: Building x86_64 offloading plugin.
-- LIBOMPTARGET: Not building NVPTX deviceRTL by default on CUDA free system.

And the test fails like so:

$ env LD_LIBRARY_PATH=lib:projects/openmp/libomptarget LIBOMPTARGET_DEBUG=1 \
 
projects/openmp/libomptarget/test/offloading/Output/dynamic_module_load.c.tmp-x86_64-pc-linux-gnu
\
 
projects/openmp/libomptarget/test/offloading/Output/dynamic_module_load.c.tmp.so
Libomptarget --> Init target library!
Libomptarget --> Loading RTLs...
Libomptarget --> Loading library 'libomptarget.rtl.ppc64.so'...
Libomptarget --> Unable to load library 'libomptarget.rtl.ppc64.so':
libomptarget.rtl.ppc64.so: cannot open shared object file: No such file or
directory!
Libomptarget --> Loading library 'libomptarget.rtl.x86_64.so'...
Libomptarget --> Successfully loaded library 'libomptarget.rtl.x86_64.so'!
Libomptarget --> Registering RTL libomptarget.rtl.x86_64.so supporting 4
devices!
Libomptarget --> Loading library 'libomptarget.rtl.cuda.so'...
terminate called after throwing an instance of 'std::system_error'
  what():  Unknown error -1
Aborted (core dumped)</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>