gpu / JOCL

Java bindings for OpenCL
http://www.jocl.org
Other
187 stars 33 forks source link

Initial Vagrantfile #18

Closed Lewiscowles1986 closed 6 years ago

Lewiscowles1986 commented 6 years ago

Auto-build JOCL located in an ubuntu xenial64 vagrant

Fixes #17 Closes #3

gpu commented 6 years ago

Thanks, I'm currently starting with Vagrant. I'll see how to schedule this, but will try to give this setup file a try ASAP. (I'm still afraid that my slow net connection will make it necessary to run this over night, but I'll see)

Lewiscowles1986 commented 6 years ago

I thought about this. You should be able to run it on any ubuntu xenial VM under sudo. Any xenial vm with internet should do it. It'd just get packages etc. :smile: It might also work on debian stretch but I'm not sure I'd hold my breath lol

gpu commented 6 years ago

Just a short heads-up/apology: I'll likely not be able to give this a try before the holidays, but hope that at beginning/middle of January, I can allocate some more time here.

gpu commented 6 years ago

So I finally could give this a try. On the one hand it could be nice and slick and convenient: Getting it up and running was fairly trivial. The Maven build part also worked smoothly.

The problem right now is that it fails to compile the natives, due to

default: CMake Error at /usr/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:148 (message):
default:   Could NOT find OpenGL (missing: OPENGL_gl_LIBRARY OPENGL_INCLUDE_DIR)
default: Call Stack (most recent call first):
default:   /usr/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:388 (_FPHSA_FAILURE_MESSAGE)
default:   /usr/share/cmake-3.5/Modules/FindOpenGL.cmake:172 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
default:   CMakeLists.txt:18 (find_package)
default: -- Configuring incomplete, errors occurred!

Websearch results suggest different apt-get install... calls that should be done to resolve this, but until now, none of them seemed to work.

(BTW: libjna-java should not be required, right?)

Any ideas?

Otherwise, I'll have to continue a bit with trial and error - maybe I can sneak the required variables (OPENGL_gl_LIBRARY and OPENGL_INCLUDE_DIR) into CMake manually, because they should be known inside the virtual box, but I still wonder what has to be done to let it "properly" find them...

Lewiscowles1986 commented 6 years ago

Oh, I had to symbolic link files to get cmake to find jna (super weird bug from cmake being far too specific). I Could have sworn I fixed that. Darn, I'll have to take another look. Thanks for checking it out.

gpu commented 6 years ago

Um... I just removed JNA, and think it should not be necessary in any case. (JOCL is using plain JNI).

The main issue (as far as I can tell) is the missing OpenGL headers/libs. The solutions e.g. at https://stackoverflow.com/questions/31170869/cmake-could-not-find-opengl-in-ubuntu did not seem to work.

(And I also think that GLUT should not be necessary - OpenGL itself should be sufficient. So I'd rather upvote the second answer there, but unfortunately, it didn't seem to work either)

I'll try to see whether this can be solved by maybe adding some environment variables in the shell script, or passing the paths to CMake manually after the apt-get for OpenGL. (I'm not sure which "OpenGL" is needed there - mesa, glut, mesa-dev, something else? So this will involve some trial and error...)

gpu commented 6 years ago

So I should have re-tried this earlier. After tearing down the VM and bringing it up again (with the slight modifications in the Vagrantfile), it worked smoothly: It found OpenGL, and the libraries could be built without any further problems.

I have added the updated Vagrantfile and some build instructions at https://github.com/gpu/JOCL#building-on-a-virtual-machine

Thanks again @Lewiscowles1986 ! If you would like a certain attribution, just drop me a note. Otherwise, I'd at least add a note and a link to your GitHub account.

(This could turn out to be tremendously helpful in order to provide the Linux libraries not only for JOCL itself, but also for JOCLBlast and some other libraries that I'm working on. I guess bringing CUDA into such a VM might still be a bit trickier, but maybe it's just another apt call that has to be added)