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

Already on GitHub? Sign in to your account

Convert the generator from apt to javax.annotation.processing #6

Closed
Sworddragon opened this Issue Dec 19, 2012 · 16 comments

Comments

Projects
None yet
6 participants

On my Linux 3.7.0 (ant 1.8.2, gcc 4.7.2, openjdk 1.7.0_09) I'm getting a few compiling errors. On the first try a directory was missing:

sworddragon@ubuntu:~/.git/lwjgl$ ant compile_native
Buildfile: /home/sworddragon/.git/lwjgl/build.xml

-initialize:
[initialiazing bin folder] Created dir: /home/sworddragon/.git/lwjgl/bin
[initialiazing native bin folder] Created dir: /home/sworddragon/.git/lwjgl/bin/lwjgl
[initialiazing native OpenGL ES bin folder] Created dir: /home/sworddragon/.git/lwjgl/bin/lwjgles
[initialiazing dist folder] Created dir: /home/sworddragon/.git/lwjgl/dist
[initialiazing docs folder] Created dir: /home/sworddragon/.git/lwjgl/doc/javadoc
[initialiazing temp folder] Created dir: /home/sworddragon/.git/lwjgl/temp
[initialiazing temp/jar folder] Created dir: /home/sworddragon/.git/lwjgl/temp/jar
[initialiazing temp/doc folder] Created dir: /home/sworddragon/.git/lwjgl/temp/doc
[initialiazing temp/res folder] Created dir: /home/sworddragon/.git/lwjgl/temp/res
[initialiazing temp/native folder] Created dir: /home/sworddragon/.git/lwjgl/temp/native
[initialiazing temp/windows folder] Created dir: /home/sworddragon/.git/lwjgl/temp/native/windows
[initialiazing temp/linux folder] Created dir: /home/sworddragon/.git/lwjgl/temp/native/linux
[initialiazing temp/freebsd folder] Created dir: /home/sworddragon/.git/lwjgl/temp/native/freebsd
[initialiazing temp/macosx folder] Created dir: /home/sworddragon/.git/lwjgl/temp/native/macosx
[initialiazing temp/solaris folder] Created dir: /home/sworddragon/.git/lwjgl/temp/native/solaris

compile:

BUILD FAILED
/home/sworddragon/.git/lwjgl/build.xml:450: srcdir "/home/sworddragon/.git/lwjgl/src/generated" does not exist!

Total time: 0 seconds

After creating the directory manually I got the next errors:

sworddragon@ubuntu:~/.git/lwjgl$ ant compile_native
Buildfile: /home/sworddragon/.git/lwjgl/build.xml

-initialize:

compile:
[core] Compiling 267 source files to /home/sworddragon/.git/lwjgl/bin
[core] /home/sworddragon/.git/lwjgl/src/java/org/lwjgl/openal/EFXUtil.java:34: error: cannot find symbol
[core] import static org.lwjgl.openal.AL10.*;
[core] ^
[SNIP] - LOTS OF SAME ERRORS
[core] 100 errors

BUILD FAILED
/home/sworddragon/.git/lwjgl/build.xml:450: Compile failed; see the compiler error output for details.

Total time: 4 seconds

Contributor

matzon commented Dec 19, 2012

run the generate-all target first

The 3 targets are not independent to each other? Here is the new output:

sworddragon@ubuntu:~/.git/lwjgl$ ant generate-all
Buildfile: /home/sworddragon/.git/lwjgl/build.xml

generators:

BUILD FAILED
/home/sworddragon/.git/lwjgl/platform_build/build-generator.xml:18: destination directory "/home/sworddragon/.git/lwjgl/bin" does not exist or is not a directory

Total time: 0 seconds
sworddragon@ubuntu:~/.git/lwjgl$ mkdir /.git/lwjgl/bin
sworddragon@ubuntu:
/.git/lwjgl$ ant generate-all
Buildfile: /home/sworddragon/.git/lwjgl/build.xml

generators:
[generator] Compiling 121 source files to /home/sworddragon/.git/lwjgl/bin
[generator] /home/sworddragon/.git/lwjgl/src/java/org/lwjgl/util/generator/FieldsGenerator.java:38: warning: [deprecation] FieldDeclaration in com.sun.mirror.declaration has been deprecated
[generator] import com.sun.mirror.declaration.FieldDeclaration;
[generator] ^
[generator] /home/sworddragon/.git/lwjgl/src/java/org/lwjgl/util/generator/FieldsGenerator.java:39: warning: [deprecation] Modifier in com.sun.mirror.declaration has been deprecated
[generator] import com.sun.mirror.declaration.Modifier;
[generator] ^
...
[generator] /home/sworddragon/.git/lwjgl/src/java/org/lwjgl/util/generator/FieldsGenerator.java:56: warning: [deprecation] TypeMirror in com.sun.mirror.type has been deprecated
[generator] TypeMirror field_type = field.getType();
[generator] ^
[generator] /home/sworddragon/.git/lwjgl/src/java/org/lwjgl/util/generator/FieldsGenerator.java:57: warning: [deprecation] PrimitiveType in com.sun.mirror.type has been deprecated
[generator] if ( field_type instanceof PrimitiveType ) {
[generator] ^
[generator] Note: Some input files additionally use or override a deprecated API.
[generator] Note: /home/sworddragon/.git/lwjgl/src/java/org/lwjgl/opencl/FastLongMap.java uses unchecked or unsafe operations.
[generator] 100 warnings
[generator] Compiling 15 source files to /home/sworddragon/.git/lwjgl/bin

generate-openal:

BUILD FAILED
/home/sworddragon/.git/lwjgl/platform_build/build-generator.xml:62: Execute failed: java.io.IOException: Cannot run program "apt" (in directory "/home/sworddragon/.git/lwjgl/src/templates/org/lwjgl/openal"): error=2, Datei oder Verzeichnis nicht gefunden
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
at java.lang.Runtime.exec(Runtime.java:615)
at org.apache.tools.ant.taskdefs.Execute$Java13CommandLauncher.exec(Execute.java:862)
at org.apache.tools.ant.taskdefs.Execute.launch(Execute.java:481)
at org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:495)
at org.apache.tools.ant.taskdefs.ExecTask.runExecute(ExecTask.java:631)
at org.apache.tools.ant.taskdefs.ExecuteOn.runParallel(ExecuteOn.java:716)
at org.apache.tools.ant.taskdefs.ExecuteOn.runExec(ExecuteOn.java:479)
at org.apache.tools.ant.taskdefs.ExecTask.execute(ExecTask.java:498)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:390)
at org.apache.tools.ant.Target.performTasks(Target.java:411)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
at org.apache.tools.ant.Main.runBuild(Main.java:809)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
Caused by: java.io.IOException: error=2, Datei oder Verzeichnis nicht gefunden
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.(UNIXProcess.java:135)
at java.lang.ProcessImpl.start(ProcessImpl.java:130)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1021)
... 24 more

Total time: 3 seconds

Contributor

matzon commented Dec 19, 2012

On Wed, Dec 19, 2012 at 10:23 PM, Sworddragon notifications@github.comwrote:

/home/sworddragon/.git/lwjgl/platform_build/build-generator.xml:62:
Execute failed: java.io.IOException: Cannot run program "apt" (in directory
"/home/sworddragon/.git/lwjgl/src/templates/org/lwjgl/openal"): error=2,
Datei oder Verzeichnis nicht gefunden
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
at java.lang.Runtime.exec(Runtime.java:615)
at
org.apache.tools.ant.taskdefs.Execute$Java13CommandLauncher.exec(Execute.java:862)
at org.apache.tools.ant.taskdefs.Execute.launch(Execute.java:481)
at org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:495)
at org.apache.tools.ant.taskdefs.ExecTask.runExecute(ExecTask.java:631)
at org.apache.tools.ant.taskdefs.ExecuteOn.runParallel(ExecuteOn.java:716)
at org.apache.tools.ant.taskdefs.ExecuteOn.runExec(ExecuteOn.java:479)
at org.apache.tools.ant.taskdefs.ExecTask.execute(ExecTask.java:498)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:390)
at org.apache.tools.ant.Target.performTasks(Target.java:411)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
at org.apache.tools.ant.Main.runBuild(Main.java:809)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
Caused by: java.io.IOException: error=2, Datei oder Verzeichnis nicht
gefunden
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.(UNIXProcess.java:135)
at java.lang.ProcessImpl.start(ProcessImpl.java:130)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1021)
... 24 more

Total time: 3 seconds


Reply to this email directly or view it on GitHubhttps://github.com/LWJGL/lwjgl/issues/6#issuecomment-11549199.

Sun removed the APT tool recent version of Java:
http://openjdk.java.net/jeps/117
Please use an "older" version to compile LWJGL for now. (Java 6 should be
fine)

I have now removed the OpenJDK 7 and installed the OpenJDK 6 (1.6.0_24). Here is the output:

sworddragon@ubuntu:~/.git/lwjgl$ ant generate-all
Buildfile: /home/sworddragon/.git/lwjgl/build.xml

generators:

BUILD FAILED
/home/sworddragon/.git/lwjgl/platform_build/build-generator.xml:18: destination directory "/home/sworddragon/.git/lwjgl/bin" does not exist or is not a directory

Total time: 0 seconds
sworddragon@ubuntu:~/.git/lwjgl$ mkdir /.git/lwjgl/bin
sworddragon@ubuntu:
/.git/lwjgl$ ant generate-all
Buildfile: /home/sworddragon/.git/lwjgl/build.xml

generators:
[generator] Compiling 121 source files to /home/sworddragon/.git/lwjgl/bin
[generator] /home/sworddragon/.git/lwjgl/src/java/org/lwjgl/opencl/FastLongMap.java:62: warning: [unchecked] unchecked conversion
[generator] found : org.lwjgl.opencl.FastLongMap.Entry[]
[generator] required: org.lwjgl.opencl.FastLongMap.Entry[]
[generator] final Entry[] table = this.table;
[generator] ^
[generator] /home/sworddragon/.git/lwjgl/src/java/org/lwjgl/opencl/FastLongMap.java:85: warning: [unchecked] unchecked conversion
[generator] found : org.lwjgl.opencl.FastLongMap.Entry[]
[generator] required: org.lwjgl.opencl.FastLongMap.Entry[]
[generator] final Entry[] newTable = new Entry[newCapacity];
[generator] ^
[generator] /home/sworddragon/.git/lwjgl/src/java/org/lwjgl/opencl/FastLongMap.java:107: warning: [unchecked] unchecked conversion
[generator] found : org.lwjgl.opencl.FastLongMap.Entry
[generator] required: org.lwjgl.opencl.FastLongMap.Entry
[generator] for ( Entry e = table[index]; e != null; e = e.next )
[generator] ^
[generator] /home/sworddragon/.git/lwjgl/src/java/org/lwjgl/opencl/FastLongMap.java:113: warning: [unchecked] unchecked conversion
[generator] found : org.lwjgl.opencl.FastLongMap.Entry[]
[generator] required: org.lwjgl.opencl.FastLongMap.Entry[]
[generator] final Entry[] table = this.table;
[generator] ^
[generator] /home/sworddragon/.git/lwjgl/src/java/org/lwjgl/opencl/FastLongMap.java:122: warning: [unchecked] unchecked conversion
[generator] found : org.lwjgl.opencl.FastLongMap.Entry
[generator] required: org.lwjgl.opencl.FastLongMap.Entry
[generator] for ( Entry e = table[index]; e != null; e = e.next )
[generator] ^
[generator] /home/sworddragon/.git/lwjgl/src/java/org/lwjgl/opencl/FastLongMap.java:130: warning: [unchecked] unchecked conversion
[generator] found : org.lwjgl.opencl.FastLongMap.Entry
[generator] required: org.lwjgl.opencl.FastLongMap.Entry
[generator] Entry prev = table[index];
[generator] ^
[generator] /home/sworddragon/.git/lwjgl/src/java/org/lwjgl/opencl/FastLongMap.java:157: warning: [unchecked] unchecked conversion
[generator] found : org.lwjgl.opencl.FastLongMap.Entry[]
[generator] required: org.lwjgl.opencl.FastLongMap.Entry[]
[generator] final Entry[] table = this.table;
[generator] ^
[generator] /home/sworddragon/.git/lwjgl/src/java/org/lwjgl/opencl/FastLongMap.java:179: warning: [unchecked] unchecked conversion
[generator] found : org.lwjgl.opencl.FastLongMap.Entry[]
[generator] required: org.lwjgl.opencl.FastLongMap.Entry[]
[generator] final Entry[] table = FastLongMap.this.table;
[generator] ^
[generator] /home/sworddragon/.git/lwjgl/src/java/org/lwjgl/opencl/FastLongMap.java:203: warning: [unchecked] unchecked conversion
[generator] found : org.lwjgl.opencl.FastLongMap.Entry[]
[generator] required: org.lwjgl.opencl.FastLongMap.Entry[]
[generator] final Entry[] table = FastLongMap.this.table;
[generator] ^
[generator] 9 warnings
[generator] Compiling 15 source files to /home/sworddragon/.git/lwjgl/bin

generate-openal:

BUILD FAILED
/home/sworddragon/.git/lwjgl/platform_build/build-generator.xml:62: Execute failed: java.io.IOException: Cannot run program "apt" (in directory "/home/sworddragon/.git/lwjgl/src/templates/org/lwjgl/openal"): java.io.IOException: error=2, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:475)
at java.lang.Runtime.exec(Runtime.java:610)
at org.apache.tools.ant.taskdefs.Execute$Java13CommandLauncher.exec(Execute.java:862)
at org.apache.tools.ant.taskdefs.Execute.launch(Execute.java:481)
at org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:495)
at org.apache.tools.ant.taskdefs.ExecTask.runExecute(ExecTask.java:631)
at org.apache.tools.ant.taskdefs.ExecuteOn.runParallel(ExecuteOn.java:716)
at org.apache.tools.ant.taskdefs.ExecuteOn.runExec(ExecuteOn.java:479)
at org.apache.tools.ant.taskdefs.ExecTask.execute(ExecTask.java:498)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:390)
at org.apache.tools.ant.Target.performTasks(Target.java:411)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
at org.apache.tools.ant.Main.runBuild(Main.java:809)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
Caused by: java.io.IOException: java.io.IOException: error=2, No such file or directory
at java.lang.UNIXProcess.(UNIXProcess.java:164)
at java.lang.ProcessImpl.start(ProcessImpl.java:81)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:468)
... 24 more

Total time: 2 seconds

Currently we have:

  • A missing directory on compiling on OpenJDK 6 and 7.
  • Conversion warnings on OpenJDK 6.
  • Deprecated warnings on OpenJDK 7.
  • Missing apt on OpenJDK 6 and 7.
Contributor

matzon commented Dec 20, 2012

Well, get a real JDK then ;)

What do you mean with a real JDK?

Contributor

matzon commented Dec 20, 2012

something with APT in it - for instance the oracle jdk

The OpenJDK and Oracle JDK are both from Oracle. The difference is that the OpenJDK is the open source solution. I would assume that apt is not in the OpenJDK because it is not open source.

As I remember Oracle doesn't allow the Oracle JDK/JRE 7 to be in the repositories of the different Linux distributions. This is why the Oracle JDK has no real future on Linux based systems (you can install the JDK/JRE manually but the common user will use the package manager).

See this as a feature request: LWJGL could support compiling on the OpenJDK 6/7. At least there are already a few points that could theoretically be fixed but I don't know how many effort it will need to find a solution for this apt problem.

Edit: From your link:

By removing apt from the JDK, annotation processing can finish transitioning to the superior, standardized JSR 269 API.

The apt annotation processing framework is JDK-specific and dates back to JDK 5. The functionality of the API was standardized with JSR 269, which shipped as part of Java SE 6. In JDK 7, the entirety of the apt API was deprecated.

and

After this change, users of annotation processing will have to use the JSR 269 annotation processing facility, which has been supported in javac since JDK 6.

Does this mean that apt is just deprecated and there is already something newer which should be used instead?

Owner

Spasi commented Dec 20, 2012

Afaik, apt is part of both OpenJDK 6 and 7. It's only JDK 8 that doesn't have it.

Anyway, your problem is that you're calling targets in the wrong order. Do a plain "ant" first, it will initialize the project properly and call the right targets, up to and including compile_native.

Anyway, your problem is that you're calling targets in the wrong order. Do a plain "ant" first, it will initialize the project properly and call the right targets, up to and including compile_native.

At least this solves the problem with the missing directory. But the compiling process still fails because apt is missing.

Contributor

matzon commented Dec 20, 2012

You cannot build lwjgl without apt. Get a JDK that has apt, or use the supplied prebuilt binaries. No other way around it.
fwiw, I have never heard of anyone else having issues with this ...

I have now tried to compile LWJGL 3 on my system with the OpenJDK 7 and the building process was successfull even without apt. Maybe something has changed in LWJGL 3 which doesn't need apt anymore. But there are a few compiling warnings too but I have already created an own ticket for that.

Because of all these changes (at least the "Feature Request" to work with the OpenJDK) I'm seeing this ticket as fixed in LWJGL 3. Keep it open if you think somebody wants still to fix the compiling warnings in LWJGL 2 otherwise feel free to close this ticket.

Owner

Spasi commented Dec 24, 2012

Indeed, LWJGL 3 uses a new code generator that does not depend on apt, but LWJGL 3 won't be ready for general use for quite some time.

Porting the current generator to javax.annotation.processing is doable but not an easy process, so I don't see a reason to do it. We have a new generator and we haven't had an complains about apt before.

Keeping this open in case someone wants to contribute the apt port.

Just got the build working on Linux. It will work with OpenJDK as well. If you look at the OpenJDK's bin directory the tool is present there.

However, it is possible that the tool is not on the path and that may be why your build fails.

What I did was added the bin directory to the path

export PATH=$PATH:java_home/bin (replace java_home to where you Java is installed)

Just make sure apt is there in the bin directory inside the jvm. Tested on Ubuntu with OpenJDK6

Owner

kappaOne commented Oct 29, 2013

Not really worth spending time to port the LWJGL 2 generator from apt to something else (unless someone is up for the task and provides a patch). Its just a matter of using the correct JDK to compile to avoid the issue.

LWJGL 3 already has a brand new generator which doesn't use apt and therefore avoids this issue entirely.

Closed.

@kappaOne kappaOne closed this Oct 29, 2013

http://it.toolbox.com/wiki/index.php/Developing_on_Raspberry_Pi
He sets the Path variable to the openjdk bin directory. This works for me.

Search on your system for apt and add the path to your $PATH variable.

find /usr -name apt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment