NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.28k stars 13.54k forks source link

arrayfire: add OpenCL libs #71487

Open chessai opened 4 years ago

chessai commented 4 years ago

Describe the bug the arrayfire package does not provide the opencl libs, only the cuda ones.

To Reproduce Build the arrayfire package and do:

$ ls /nix/store/hash-arrayfire/lib/
libafcpu.so        libafcuda.so        libaf.so
libafcpu.so.3      libafcuda.so.3      libaf.so.3
libafcpu.so.3.6.4  libafcuda.so.3.6.4  libaf.so.3.6.4

And note that libafopencl.* are note present.

Metadata [chessai@chessai-kudu:~]$ nix run nixpkgs.nix-info -c nix-info -m

Maintainer information:

# a list of nixpkgs attributes affected by the problem
attribute: arrayfire
chessai commented 4 years ago

i intend to work on this. can someone assign me?

stale[bot] commented 4 years ago

Thank you for your contributions. This has been automatically marked as stale because it has had no activity for 180 days. If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity. Here are suggestions that might help resolve this more quickly:

  1. Search for maintainers and people that previously touched the related code and @ mention them in a comment.
  2. Ask on the NixOS Discourse. 3. Ask on the #nixos channel on irc.freenode.net.
SchrodingerZhu commented 1 year ago

still important to me.

Also, please keep sync with the 3.8 branch if possible.

SchrodingerZhu commented 1 year ago

cc @hrhino who updates the library to 3.7.3 cc @umar456 see if upstream can help

Sorry for the noise if I am too verbose. I am just hoping we can have a better support of arrayfire.

For now, I am using the pre-compiled packages from upstream. Everything works fine on nixos if one sets LD_LIBRARY_PATH properly.

{ pkgs ? import <nixpkgs> {} }:
  pkgs.gcc.stdenv.mkDerivation {
    name = "sample";
    buildInputs = with pkgs; [
        openssl
        pkg-config
        cmake
        gcc
        autoconf
        automake
        ninja
        gnumake
        llvmPackages_latest.clang
        llvmPackages_latest.libclang
        llvmPackages_latest.libclang.lib
        llvmPackages_latest.llvm
        llvmPackages_latest.lld
    ];
    shellHook = ''
        export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$AF_PATH/lib64
        export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(nix eval --raw nixpkgs#llvmPackages_latest.libclang.lib)/lib
        export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(nix eval --raw nixpkgs#stdenv.cc.cc.lib)/lib
    '';
}
umar456 commented 1 year ago

Our CMake tries to find OpenCL libraries on the system and if its not installed it will disable the building on that backend. I am not sure about the configuration of the build system so I don't know what could be the issue there. Its possible that the libOpenCL.so and the headers are not found by the FindOpenCL.cmake config. You can manually set the undefined OpenCL variables in the build script if you know where they are.