yasin1913 / kryonet

Automatically exported from code.google.com/p/kryonet
0 stars 0 forks source link

Can't build trunk from source using scar #33

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
After getting the following exception when attempting to use host discovery on 
OS X 10.6.8 (Snow Leopard):

00:31 ERROR: [kryonet] Host discovery failed.
java.io.IOException: Invalid argument
    at java.net.PlainDatagramSocketImpl.send(Native Method)
    at java.net.DatagramSocket.send(DatagramSocket.java:625)
    at com.esotericsoftware.kryonet.Client.broadcast(Client.java:412)
    at com.esotericsoftware.kryonet.Client.discoverHosts(Client.java:455)

I found out that this is supposedly fixed in the kryonet svn trunk (r132), by 
surrounding the send methods with try / catch blocks. But the latest release 
2.20, does not have this fix. So the only option available at this time appears 
to be checkout out the latest source from the svn trunk and build it myself.

I finally figured out that I need to use Scar to build the library from source. 
So, I checkout the latest kryonet source (136) from the svn trunk, download the 
latest Scar release, cp scar and scar.jar into the kryonet source folder 
(directory containing project.yaml), and run ./scar. Here's what I get (highly 
edited for brevity):

Aaron:kryonet Aaron$ ./scar
00:01  INFO: [kryonet] Target: /Users/Aaron/NetBeansProjects/target/kryonet/
00:01  INFO: [kryonet] Clean
00:01  INFO: [kryonet] Compile
/Users/Aaron/NetBeansProjects/kryonet/src/com/esotericsoftware/kryonet/KryoSeria
lization.java:6: package com.esotericsoftware.kryo does not exist
import com.esotericsoftware.kryo.Kryo;
                                ^
/Users/Aaron/NetBeansProjects/kryonet/src/com/esotericsoftware/kryonet/Connectio
n.java:14: package com.esotericsoftware.minlog does not exist
import static com.esotericsoftware.minlog.Log.*;
                                         ^
/Users/Aaron/NetBeansProjects/kryonet/src/com/esotericsoftware/kryonet/JsonSeria
lization.java:7: package com.esotericsoftware.jsonbeans does not exist
import com.esotericsoftware.jsonbeans.Json;
                                     ^
/Users/Aaron/NetBeansProjects/kryonet/src/com/esotericsoftware/kryonet/Connectio
n.java:61: cannot find symbol
symbol  : method trace(java.lang.String,java.lang.String)
location: class com.esotericsoftware.kryonet.Connection
                if (TRACE) trace("kryonet", this + " TCP had nothing to send.");
                           ^
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
100 errors
Exception in thread "main" java.lang.RuntimeException: Error executing code for 
project: kryonet
    at com.esotericsoftware.scar.Build.executeDocument(Build.java:413)
    at com.esotericsoftware.scar.Build.main(Build.java:433)
Caused by: java.lang.RuntimeException: Error executing code:
Build.build(project);
Build.oneJAR(project);
    at com.esotericsoftware.scar.Scar.executeCode(Scar.java:1199)
    at com.esotericsoftware.scar.Build.executeDocument(Build.java:411)
    ... 1 more
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.esotericsoftware.scar.Scar.executeCode(Scar.java:1197)
    ... 2 more
Caused by: java.lang.RuntimeException: Error during compilation.
Source: 17 files
Classpath: /Users/Aaron/NetBeansProjects/kryonet/lib/jsonbeans-0.5.jar, 
/Users/Aaron/NetBeansProjects/kryonet/lib/asm-4.0.jar, 
/Users/Aaron/NetBeansProjects/kryonet/lib/reflectasm-1.07.jar, 
/Users/Aaron/NetBeansProjects/kryonet/lib/minlog-1.2.jar, 
/Users/Aaron/NetBeansProjects/kryonet/lib/objenesis-1.2.jar, 
/Users/Aaron/NetBeansProjects/kryonet/lib/kryo-debug-2.20.jar
    at com.esotericsoftware.scar.Scar.compile(Scar.java:1010)
    at com.esotericsoftware.scar.Build.compile(Build.java:169)
    at com.esotericsoftware.scar.Build.build(Build.java:391)
    at Generated.execute(Generated.java from :10)
    ... 7 more

Obviously it's not finding the libraries in the lib folder, which doesn't make 
any sense. I read a post on kryonet-users saying that all you (Nate) had to do 
was go to the kryonet directory and type scar. I tried to add the relevant 
entries to project.yaml, but I'm getting the same output no matter what I do.

Can you please explain how to build kryonet from the latest source, using scar, 
without these errors? Thank you!

Also, when are you going to be releasing the next version of kryonet with this 
bugfix, rendering this entire process unnecessary?

Original issue reported on code.google.com by knightof...@gmail.com on 8 May 2013 at 9:32

GoogleCodeExporter commented 8 years ago
P.S. The host discovery issue was not fixed by System.setProperty 
("java.net.preferIPv4Stack" , "true").

Original comment by knightof...@gmail.com on 8 May 2013 at 9:38

GoogleCodeExporter commented 8 years ago
I got the same error in Ubuntu Linux with JDK 1.6 and JDK 1.7, and in Mac OS X 
with JDK 1.6. I also tried running Java in 32 bit mode.

Inspecting the class path, it seems fine. minlog is there, as is kryo-debug. 
Not clear on why they're not loading.

Original comment by stillf...@gmail.com on 23 May 2013 at 1:00

GoogleCodeExporter commented 8 years ago
That said, there doesn't seem to be anything special about building this app. I 
compiled the sources into .class files by hand and stuck them all in a jar file 
and that seems to work fine.

Original comment by stillf...@gmail.com on 23 May 2013 at 1:42

GoogleCodeExporter commented 8 years ago
Not sure why it won't build for you guys. Try "scar debug", this is what I get:
http://pastebin.com/3fFtHaCy

Yes, the project is very simple, just class files that get compiled and JARed. 
You could use Eclipse export JAR.

Original comment by cont...@esotericsoftware.com on 23 May 2013 at 10:56

GoogleCodeExporter commented 8 years ago
You can also try "scar trace". I'm curious what the classpath it reports looks 
like.

Original comment by cont...@esotericsoftware.com on 23 May 2013 at 10:57

GoogleCodeExporter commented 8 years ago
"scar trace" gives the same output I reported above.

Original comment by knightof...@gmail.com on 23 May 2013 at 10:15

GoogleCodeExporter commented 8 years ago
"scar debug" gives the same output as well.

Original comment by knightof...@gmail.com on 23 May 2013 at 10:35

GoogleCodeExporter commented 8 years ago
It seems to me that there is some kind of assumption being made regarding the 
setup / configuration of either environment variables, scar, or svn. Can you 
please explain step-by-step how you would build kryonet from source on a new 
machine? I'm sure I'm missing something obvious, but I'm not sure what it is 
because there's very little information on how to build kryonet from source. 
Nate makes it sound so simple, "just svn checkout then run scar".

Original comment by knightof...@gmail.com on 23 May 2013 at 10:44

GoogleCodeExporter commented 8 years ago
Okay, I'll go first. Here's exactly what I'm doing, step-by-step on the command 
line (assume scar-1.09.zip has been downloaded and unzipped in 
~/Downloads/scar-1.09):

http://pastebin.com/qbC9fH3n

Original comment by knightof...@gmail.com on 23 May 2013 at 11:00