philcali / sbt-lwjgl-plugin

An sbt / lwjgl plugin
MIT License
44 stars 12 forks source link

Natives not found on Ubuntu 10.10 with openJDK #4

Closed GarrettSmith closed 13 years ago

GarrettSmith commented 13 years ago

It looks like your plugin doesn't find the natives properly on my machine when I try to run a project. I get the following error whenever I try to run.

[error] java.lang.UnsatisfiedLinkError: org.lwjgl.DefaultSysImplementation.getPointerSize()I
[error]     at org.lwjgl.DefaultSysImplementation.getPointerSize(Native Method)
[error]     at org.lwjgl.Sys.<clinit>(Sys.java:100)
[error]     at org.lwjgl.opengl.Display.<clinit>(Display.java:130)
[error]     at net.Motor.Game$.<init>(Game.scala:14)
[error]     at net.Motor.Game$.<clinit>(Game.scala)
[error]     at net.Motor.Game.main(Game.scala)
[error]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[error]     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
[error]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[error]     at java.lang.reflect.Method.invoke(Method.java:616)
[error]     at scala.tools.nsc.util.ScalaClassLoader$$anonfun$run$1.apply(ScalaClassLoader.scala:81)
[error]     at scala.tools.nsc.util.ScalaClassLoader$class.asContext(ScalaClassLoader.scala:24)
[error]     at scala.tools.nsc.util.ScalaClassLoader$URLClassLoader.asContext(ScalaClassLoader.scala:86)
[error]     at scala.tools.nsc.util.ScalaClassLoader$class.run(ScalaClassLoader.scala:81)
[error]     at scala.tools.nsc.util.ScalaClassLoader$URLClassLoader.run(ScalaClassLoader.scala:86)
[error]     at scala.tools.nsc.MainGenericRunner$.main(MainGenericRunner.scala:83)
[error]     at scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)

Edit: Turns out it runs fine after i got rid of openjdk and just ran sun-java6-jre on my system.

philcali commented 13 years ago

Yes, openjdk seems to be sending a little different os property... I first saw this on my Mac, and I have a fix in place for that, but I haven't actually testing it on any other OS (whoops!). Now that this is happening on Mac and Linux I better roll 2.0.5 sooner than I want.

Could you run the following snippet in a scala console for me on your machine?

System.getProperty("os.name")

Thanks for the feedback.

-- Philip Cali

GarrettSmith commented 13 years ago

Alright so I ran that with both openjdk and sun's jdk and they both return the same thing. res0: java.lang.String = Linux

philcali commented 13 years ago

Ok, that complies with what I found on the internet regarding the os.name property.

Hmmm sound like it might be trying to load the lwjgl binaries twice. This is a silly question, do you have the binaries defined somewhere on you JAVA_LIBRARY_PATH in your bash profile?

-- Philip Cali

GarrettSmith commented 13 years ago

Well turns out that wasn't too silly of a question because I did. I had some remnants of the outdated lwjgl installed in the package manager. After removing them everything runs fine under openjdk.

Thanks a lot for your help with this, and for making such a helpful plugin.

philcali commented 13 years ago

I'm going to leave this issue open, as I feel it's a bug that creeped up from the original implementation of the plugin. This plugin was implemented before lwjgl had an "official" maven repo, so it relied on the fact that you had binaries extracted on your system or defined in your java.library.path.

Now the plugin uses the jar pulled from the maven repo.

What's happening now: if lwjgl is defined in your java.library.path, it loads both the one on your system and the one in the repo! (Uh oh!) Definitely going to fix this :P

Thank you for pointing out that bug.

I'm glad you like the plugin! Happy LWJGL developing!