ROCm / rocm-cmake

CMake modules used within the ROCm libraries
https://rocm.docs.amd.com/projects/ROCmCMakeBuildTools/en/latest/
MIT License
61 stars 43 forks source link

Update RPATH to binaries for PRIVATE lib changes #197

Closed ahsan-ca closed 5 months ago

ahsan-ca commented 5 months ago

This PR updates RPATHs for libraries and executables to account for moving private libraries under the project name.

ahsan-ca commented 5 months ago

@pfultz2 PR is ready for review now. Thanks!

ahsan-ca commented 5 months ago
ldd /opt/rocm/bin/migraphx-driver 
        linux-vdso.so.1 (0x00007fff53d3c000)
        libmigraphx_onnx.so.2010000 => /opt/rocm/bin/../lib/migraphx/lib/libmigraphx_onnx.so.2010000 (0x00007f2bffdf2000)
        libmigraphx_tf.so.2010000 => /opt/rocm/bin/../lib/migraphx/lib/libmigraphx_tf.so.2010000 (0x00007f2bffb3b000)
        libmigraphx_py.so => /opt/rocm/bin/../lib/libmigraphx_py.so (0x00007f2bffb30000)
        libmigraphx_ref.so.2010000 => /opt/rocm/bin/../lib/migraphx/lib/libmigraphx_ref.so.2010000 (0x00007f2bff864000)
        libmigraphx_cpu.so.2010000 => /opt/rocm/bin/../lib/migraphx/lib/libmigraphx_cpu.so.2010000 (0x00007f2bff0a7000)
        libdnnl.so.1 => /usr/local/lib/libdnnl.so.1 (0x00007f2bfcee8000)
        libomp.so => /opt/rocm-6.0.2/lib/llvm/lib/libomp.so (0x00007f2bfcdf5000)
        libmigraphx_gpu.so.2010000 => /opt/rocm/bin/../lib/migraphx/lib/libmigraphx_gpu.so.2010000 (0x00007f2bf3e30000)
        librocblas.so.4 => /opt/rocm/bin/../lib/librocblas.so.4 (0x00007f2bc1ce9000)
        libMIOpen.so.1 => /opt/rocm/bin/../lib/libMIOpen.so.1 (0x00007f2b8a935000)
        libamdhip64.so.6 => /opt/rocm/bin/../lib/libamdhip64.so.6 (0x00007f2b88e86000)
        libmigraphx.so.2010000 => /opt/rocm/bin/../lib/migraphx/lib/libmigraphx.so.2010000 (0x00007f2b8664d000)
        libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f2b8641a000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f2b86333000)
        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f2b86313000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f2b860ea000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f2c00135000)
        libmigraphx_device.so.2010000 => /opt/rocm/bin/../lib/migraphx/lib/../lib/libmigraphx_device.so.2010000 (0x00007f2b84e20000)
        libamd_comgr.so.2 => /opt/rocm/bin/../lib/libamd_comgr.so.2 (0x00007f2b7c514000)
        libroctx64.so.4 => /opt/rocm/bin/../lib/libroctx64.so.4 (0x00007f2b7c50f000)
        libhsa-runtime64.so.1 => /opt/rocm/bin/../lib/libhsa-runtime64.so.1 (0x00007f2b7c24b000)
        libnuma.so.1 => /lib/x86_64-linux-gnu/libnuma.so.1 (0x00007f2b7c23e000)
        libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f2b7c220000)
        libtinfo.so.6 => /lib/x86_64-linux-gnu/libtinfo.so.6 (0x00007f2b7c1ee000)
        libelf.so.1 => /lib/x86_64-linux-gnu/libelf.so.1 (0x00007f2b7c1d0000)
        libdrm.so.2 => /lib/x86_64-linux-gnu/libdrm.so.2 (0x00007f2b7c1ba000)
        libdrm_amdgpu.so.1 => /lib/x86_64-linux-gnu/libdrm_amdgpu.so.1 (0x00007f2b7c1ae000)
 readelf -d /opt/rocm/bin/migraphx-driver 

Dynamic section at offset 0x7cee0 contains 40 entries:
  Tag        Type                         Name/Value
 0x000000000000001d (RUNPATH)            Library runpath: [/code/AMDMIGraphX/libs-issue/AMDMIGraphX/deps/lib:$ORIGIN/../lib:$ORIGIN/../lib/migraphx/lib:/opt/rocm-6.0.2/lib/llvm/lib]
 0x0000000000000001 (NEEDED)             Shared library: [libmigraphx_onnx.so.2010000]
 0x0000000000000001 (NEEDED)             Shared library: [libmigraphx_tf.so.2010000]
 0x0000000000000001 (NEEDED)             Shared library: [libmigraphx_py.so]
 0x0000000000000001 (NEEDED)             Shared library: [libmigraphx_ref.so.2010000]
 0x0000000000000001 (NEEDED)             Shared library: [libmigraphx_cpu.so.2010000]
 0x0000000000000001 (NEEDED)             Shared library: [libdnnl.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libomp.so]
 0x0000000000000001 (NEEDED)             Shared library: [libmigraphx_gpu.so.2010000]
 0x0000000000000001 (NEEDED)             Shared library: [librocblas.so.4]
 0x0000000000000001 (NEEDED)             Shared library: [libMIOpen.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libamdhip64.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libmigraphx.so.2010000]
 0x0000000000000001 (NEEDED)             Shared library: [libstdc++.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libm.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libgcc_s.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]        
ahsan-ca commented 5 months ago

@cgmb @lawruble13 This PR is needed to fix an issue that breaks MIGraphX. Since Paul is away on parental leave, can you please help to merge in the changes?