Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake doesn't find /usr/lib/x86_64-linux-gnu/libOpenCL.so.1 to enable OpenCL BE #542

Open
pjaaskel opened this issue Jul 13, 2023 · 8 comments
Assignees
Labels
opencl Issues affecting only the OpenCL backend

Comments

@pjaaskel
Copy link
Collaborator

This happens in the Intel Devcloud PVC env (at least). It's in ld.so.conf and clinfo works.

@pjaaskel pjaaskel added the opencl Issues affecting only the OpenCL backend label Jul 13, 2023
@pjaaskel pjaaskel added this to the 1.0 milestone Jul 13, 2023
@pjaaskel pjaaskel self-assigned this Jul 13, 2023
@pjaaskel pjaaskel changed the title CMake doesn't find /lib/x86_64-linux-gnu/libOpenCL.so.1 to enable OpenCL CMake doesn't find /usr/lib/x86_64-linux-gnu/libOpenCL.so.1 to enable OpenCL BE Jul 13, 2023
@pjaaskel
Copy link
Collaborator Author

pjaaskel commented Jul 13, 2023

Seems CMake searches only for *.so. In our case since we ship OpenCL headers, we could just use the so.1 without installing ocl-icd-opencl-dev or other dev package which brings in the .so.

An ugly workaround:

mkdir -p ~/local/lib
ln -s /usr/lib/x86_64-linux-gnu/libOpenCL.so.1 ~/local/lib/libOpenCL.so
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/local/lib
cmake [...]

@franz
Copy link
Collaborator

franz commented Jul 13, 2023

LD_LIBRARY_PATH is only used when loading a library (by ld); it's not used when GCC or other compiler searches for a library at build time. CMake has its own variable for this purpose.

@pjaaskel
Copy link
Collaborator Author

Yeah, so I thought before taking a look at chipStar's CMake conf which uses it directly.

@pjaaskel
Copy link
Collaborator Author

Thus, setting only LD_LIBRARY_PATH instead of both the cmake's build time and the runtime path suffices here.

@pvelesko
Copy link
Collaborator

I did that on purpose because I was getting tired of default OpenCL runtimes getting picked up. Normally I log in, load modules (which load LD_LIBRARY_PATH) and then compile and run.

The fix is as simple as enabling searches on default path.

@pjaaskel
Copy link
Collaborator Author

Added a workaround to README.md. Should do for 1.0.

@pjaaskel pjaaskel removed this from the 1.0 milestone Jul 14, 2023
@pvelesko
Copy link
Collaborator

Is this a name issue? Cmake expectes libOpenCL.so and libOpenCL.so.1 doens't satisfy it?

@pjaaskel
Copy link
Collaborator Author

I think so, yes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
opencl Issues affecting only the OpenCL backend
Projects
None yet
Development

No branches or pull requests

3 participants