jrprice / Oclgrind

An OpenCL device simulator and debugger
Other
346 stars 63 forks source link

adding to the package managers? #153

Open Foadsf opened 6 years ago

Foadsf commented 6 years ago

I just checked the Repology page of this project. Unfortunately there are none of the package managers for windows and mac have this library. It would be a great help if it could be added to some, for example Chocolatey and/or Scoop for Windows, and HomeBrew and/or MacPorts for macOS.

jrprice commented 6 years ago

Agreed, but this is something that will require external contributors who have experience with these package managers to do (as I personally have neither the experience nor the time right now).

I think @Athas was looking at writing a homebrew formula at some point but not sure if that went anywhere.

athas commented 6 years ago

I did try writing a Homebrew formula, but encountered weird LLVM-related errors that I did not understand. Maybe I should try again.

athas commented 6 years ago

I can't even figure out how to compile oclgrind on macOS in the first place, apparently. First, I have installed LLVM via Homebrew. It appears to be version 6.0.1. The oclgrind build instructions state that I should run cmake with LLVM_ROOT set to the "path to the LLVM installation". Where is that? cmake complains that it cannot find a package configuration file unless I set LLVM_ROOT to a directory containing LLVM's CMakeLists.txt, but when I set it to e.g. /usr/local/Cellar/llvm/5.0.1/share/cmake/modules I get this grammatically incomprehensible error from cmake:

-- Found LLVM
-- Using LLVMConfig.cmake in: /usr/local/Cellar/llvm/5.0.1/share/cmake/modules/
CMake Error at CMakeLists.txt:56 (if):
  if given arguments:

    "VERSION_LESS" "3.9"

  Unknown arguments specified

-- Configuring incomplete, errors occurred!
See also "/Users/athas/repos/oclgrind/CMakeFiles/CMakeOutput.log".


installation intructions at
jrprice commented 6 years ago

Are you using CMake version older than 3.0 by any chance? Looks like VERSION_LESS may have not been introduced until 3.0.2, which would explain the weird error message. I guess I need to bump the minimum CMake version if that's the case.

athas commented 6 years ago

If I use the following simple formula for Homebrew, then apparently the environment magic gets set up correctly and Homebrew can start compilation:

class Oclgrind < Formula
  desc "OpenCL device simulator and debugger"
  homepage "https://github.com/jrprice/Oclgrind"
  url "https://github.com/jrprice/Oclgrind/archive/v18.3.tar.gz"
  sha256 "90518d47573e64c6c28e173dc6f10c4e0ca53a99543ef2f1afaac1cbf725fe90"

  depends_on "cmake" => :build
  depends_on "llvm" => :build

  def install
    system "cmake", ".", *std_cmake_args
    system "make", "install"
  end

  test do
    system "#{bin}/oclgrind", "ls", "-l"
  end
end

But the build fails for terrifying reasons (external link due to size): https://paste.fedoraproject.org/paste/LIHFJ-ycqtWgV0V9OnbNNg

athas commented 6 years ago

My cmake is 3.12.

jrprice commented 6 years ago

Weird, same formula seems to work fine for me.

Those linker errors look bizarre, haven't seen anything like that before...

athas commented 6 years ago

It's possible my Homebrew setup is broken. I seem to recall having a messed up LLVM before (from having multiple versions installed simultaneously - and while my C++-fu has weakened, that could look like stale object files).

athas commented 6 years ago

Alright, after reinstalling everything, the formula works. I'll submit it to Homebrew later tonight.

athas commented 6 years ago

It's in Homebrew now.

athas commented 5 years ago

I'm now also trying to add it to NixOS. However, the latest release of Oclgrind does not work with LLVM 7. Could we have a new release soon, please? (NixOS is fortunately flexible enough that it's trivial to have different LLVMs installed concurrently, but it's a waste of disk space.)

jrprice commented 5 years ago

However, the latest release of Oclgrind does not work with LLVM 7. Could we have a new release soon, please?

Sure. I'll aim to release shortly after the LLVM branches for the 9.0 release (in ~1 month) so that we can support that as well.

athas commented 5 years ago

I got Oclgrind added to NixOS.