Skip to content

make test results in linker error cannot find OpenCL library #14

@omac777

Description

@omac777

I'm running pop 22.04 with rust nightly. I installed opencl using the following on pop 22.04:

wget -O '/tmp/rocm.gpg.key' 'https://repo.radeon.com/rocm/rocm.gpg.key'
sudo mv '/tmp/rocm.gpg.key' '/etc/apt/trusted.gpg.d/rocm.asc'
sync
echo 'deb https://repo.radeon.com/rocm/apt/latest/ ubuntu main' | sudo tee '/etc/apt/sources.list.d/rocm.list' > '/dev/null' && cat '/etc/apt/sources.list.d/rocm.list'
sudo apt update
sudo apt install rocm-opencl rocm-opencl-dev
sudo usermod --append --groups 'render,video' davidm
reboot

make check worked correctly.

When I ran make test I got the following error:

warning: `blaze-rs` (lib) generated 1 warning
error: linking with `cc` failed: exit status: 1
  |
  = note: "cc" "-m64" "/tmp/rustcYB6OSv/symbols.o" "/home/davidm/blaze/target/debug/deps/mmul-a5f88daec8c33fdd.15cy7bkgix8rtwg3.rcgu.o" "/home/davidm/blaze/target/debug/deps/mmul-a5f88daec8c33fdd.1d14oo4kxedhit6o.rcgu.o" "/home/davidm/blaze/target/debug/deps/mmul-a5f88daec8c33fdd.1dfj0s8tnfj66n11.rcgu.o" "/home/davidm/blaze/target/debug/deps/mmul-a5f88daec8c33fdd.1jzbg4vxwmn1tl3v.rcgu.o" "/home/davidm/blaze/target/debug/deps/mmul-a5f88daec8c33fdd.1qhsxzaro8n1w99a.rcgu.o" "/home/davidm/blaze/target/debug/deps/mmul-a5f88daec8c33fdd.1tdk9eemfhn2zcg.rcgu.o" "/home/davidm/blaze/target/debug/deps/mmul-a5f88daec8c33fdd.1xn9autc40enwghi.rcgu.o" "/home/davidm/blaze/target/debug/deps/mmul-a5f88daec8c33fdd.1zsf2gwqy4mk93jj.rcgu.o" "/home/davidm/blaze/target/debug/deps/mmul-a5f88daec8c33fdd.24zi57ojr1d3znz5.rcgu.o" "/home/davidm/blaze/target/debug/deps/mmul-a5f88daec8c33fdd.2rknx43j1k2w92mm.rcgu.o" "/home/davidm/blaze/target/debug/deps/mmul-a5f88daec8c33fdd.33cj9rdy9nydjddd.rcgu.o" "/home/davidm/blaze/target/debug/deps/mmul-a5f88daec8c33fdd.3o7i5gto1qowp5le.rcgu.o" "/home/davidm/blaze/target/debug/deps/mmul-a5f88daec8c33fdd.3oq2eyd3cl8b746h.rcgu.o" "/home/davidm/blaze/target/debug/deps/mmul-a5f88daec8c33fdd.3pro4muk0al00hzt.rcgu.o" "/home/davidm/blaze/target/debug/deps/mmul-a5f88daec8c33fdd.43z7q5wadfeeajuv.rcgu.o" "/home/davidm/blaze/target/debug/deps/mmul-a5f88daec8c33fdd.46h448z5ts6mxl1n.rcgu.o" "/home/davidm/blaze/target/debug/deps/mmul-a5f88daec8c33fdd.4gew5rp4owhe4y30.rcgu.o" "/home/davidm/blaze/target/debug/deps/mmul-a5f88daec8c33fdd.4hp40b0uhznpzxsc.rcgu.o" "/home/davidm/blaze/target/debug/deps/mmul-a5f88daec8c33fdd.4lfvys2pukeu5qxb.rcgu.o" "/home/davidm/blaze/target/debug/deps/mmul-a5f88daec8c33fdd.4urkuwfmhbm7w3dx.rcgu.o" "/home/davidm/blaze/target/debug/deps/mmul-a5f88daec8c33fdd.74uzz8wymtnyi7h.rcgu.o" "/home/davidm/blaze/target/debug/deps/mmul-a5f88daec8c33fdd.kaudi0fmqii0nc2.rcgu.o" "/home/davidm/blaze/target/debug/deps/mmul-a5f88daec8c33fdd.mptv03y5670yfj5.rcgu.o" "/home/davidm/blaze/target/debug/deps/mmul-a5f88daec8c33fdd.noeicez4c5bdkfn.rcgu.o" "/home/davidm/blaze/target/debug/deps/mmul-a5f88daec8c33fdd.y80h7y7ic69veke.rcgu.o" "/home/davidm/blaze/target/debug/deps/mmul-a5f88daec8c33fdd.vm4eld2qok6v4gp.rcgu.o" "-Wl,--as-needed" "-L" "/home/davidm/blaze/target/debug/deps" "-L" "/home/davidm/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/home/davidm/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libtest-da913cdf5d7548fa.rlib" "/home/davidm/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgetopts-5214be050813988f.rlib" "/home/davidm/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunicode_width-545547c7a91a5f54.rlib" "/home/davidm/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_std-9601d44b3c2bcb0c.rlib" "/home/davidm/blaze/target/debug/deps/libblaze_rs-6d10004028fd0a39.rlib" "/home/davidm/blaze/target/debug/deps/libbox_iter-79d13ebcbdf9c843.rlib" "/home/davidm/blaze/target/debug/deps/libbitflags-05dfd5b5d1225bed.rlib" "/home/davidm/blaze/target/debug/deps/libcfg_if-90e3626e3c41eec3.rlib" "/home/davidm/blaze/target/debug/deps/libopencl_sys-200821ad1c61cc9a.rlib" "/home/davidm/blaze/target/debug/deps/liblibc-e1c27bc548d6aea8.rlib" "/home/davidm/blaze/target/debug/deps/libonce_cell-1f5534b23b172a64.rlib" "-Wl,--start-group" "/home/davidm/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-4393e7d07259b8a4.rlib" "/home/davidm/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-e13cbb326bcd01a4.rlib" "/home/davidm/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libobject-13ac6af5403a52c8.rlib" "/home/davidm/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libmemchr-a7b8febdd2acb289.rlib" "/home/davidm/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libaddr2line-343513f0726f71ed.rlib" "/home/davidm/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgimli-8f833d900bfb98aa.rlib" "/home/davidm/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-e97a7960ca6216c8.rlib" "/home/davidm/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd_detect-683fb35093a61fcc.rlib" "/home/davidm/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-f943c2d34bd4b56d.rlib" "/home/davidm/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libminiz_oxide-72ce2aaa649404e0.rlib" "/home/davidm/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libadler-ac5d08ad5339e92e.rlib" "/home/davidm/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-dacfda262d5656fb.rlib" "/home/davidm/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-e2056a834ba0712c.rlib" "/home/davidm/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-a60649c148c6e2db.rlib" "/home/davidm/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-3e961d059b9bcde7.rlib" "/home/davidm/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-20f26f875d0170e2.rlib" "/home/davidm/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-522518611024dce5.rlib" "/home/davidm/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-05898138a596088a.rlib" "-Wl,--end-group" "/home/davidm/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-5b83a1df856cf582.rlib" "-Wl,-Bdynamic" "-lOpenCL" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-znoexecstack" "-L" "/home/davidm/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/home/davidm/blaze/target/debug/deps/mmul-a5f88daec8c33fdd" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro,-znow" "-nodefaultlibs"
  = note: /usr/bin/ld: cannot find -lOpenCL: No such file or directory
          collect2: error: ld returned 1 exit status

I also checked to confirm OpenCL libraries have been installed. There are more of them than I can shake a stick at!
Shouldn't the above build have /usr/lib/x86_64-linux-gnu/ as part of its linker search path at the very least?

/usr/lib/x86_64-linux-gnu/libOpenCL.so.1.0.0
/usr/lib/x86_64-linux-gnu/libOpenCL.so.1
/opt/rocm-5.2.0/opencl/lib/libOpenCL.so
/opt/rocm-5.2.0/opencl/lib/libOpenCL.so.1
/opt/rocm-5.2.0/opencl/lib/libOpenCL.so.1.2
/opt/rocm-5.2.0/lib/libOpenCL.so
/opt/rocm-5.2.0/lib/libOpenCL.so.1
/opt/rocm-5.2.0/lib/libOpenCL.so.1.2
/home/davidm/.local/share/flatpak/.removed/org.freedesktop.Platform-e5aff027f1cfc1b950d476dab5159628f077a4ca114e87160a123df9cce700bf/files/lib/x86_64-linux-gnu/libOpenCL.so.1.0.0
/home/davidm/.local/share/flatpak/.removed/org.freedesktop.Platform-e5aff027f1cfc1b950d476dab5159628f077a4ca114e87160a123df9cce700bf/files/lib/x86_64-linux-gnu/libOpenCL.so.1
/home/davidm/.local/share/flatpak/runtime/org.gnome.Platform/x86_64/41/07e2f19d660a4bf5520857f2eea3aa7005d0e320b2ee5ec7c02a5ea95d2123a3/files/lib/x86_64-linux-gnu/libOpenCL.so.1.0.0
/home/davidm/.local/share/flatpak/runtime/org.gnome.Platform/x86_64/41/07e2f19d660a4bf5520857f2eea3aa7005d0e320b2ee5ec7c02a5ea95d2123a3/files/lib/x86_64-linux-gnu/libOpenCL.so.1
/home/davidm/.local/share/flatpak/runtime/org.gnome.Platform/x86_64/42/95efaa2378b7fe76734f58eae5a52bb66d0e73bcded62470e97159cb15e93315/files/lib/x86_64-linux-gnu/libOpenCL.so.1.0.0
/home/davidm/.local/share/flatpak/runtime/org.gnome.Platform/x86_64/42/95efaa2378b7fe76734f58eae5a52bb66d0e73bcded62470e97159cb15e93315/files/lib/x86_64-linux-gnu/libOpenCL.so.1
/home/davidm/.local/share/flatpak/runtime/org.kde.Platform/x86_64/5.15-21.08/497a0d244beeb1308837e356ec9a39dfdaf23d9de18998aeaaa05f171f0415a2/files/lib/x86_64-linux-gnu/libOpenCL.so.1.0.0
/home/davidm/.local/share/flatpak/runtime/org.kde.Platform/x86_64/5.15-21.08/497a0d244beeb1308837e356ec9a39dfdaf23d9de18998aeaaa05f171f0415a2/files/lib/x86_64-linux-gnu/libOpenCL.so.1
/home/davidm/.local/share/flatpak/runtime/org.freedesktop.Platform/x86_64/21.08/c7252386179c4c1ecf5d93bdaec6ca82852dddfdae7112b5c3177f7424c4a928/files/lib/x86_64-linux-gnu/libOpenCL.so.1.0.0
/home/davidm/.local/share/flatpak/runtime/org.freedesktop.Platform/x86_64/21.08/c7252386179c4c1ecf5d93bdaec6ca82852dddfdae7112b5c3177f7424c4a928/files/lib/x86_64-linux-gnu/libOpenCL.so.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions