Welcome! Log In Create A New Profile

Advanced

Compiling Host for the C programmer

Posted by Traumflug 
Compiling Host for the C programmer
June 23, 2010 10:59AM
Hello all,

in the German RUG we currently wonder how one would build a current version of the host software.

There are instructions: [reprap.org] , but dumbly following the click-here instructions doesn't work. Some buttons are not where expected, so the path breaks. I'm even using Ubuntu Linux, the same as Adrian's.

I see no chance in getting this fixed in Eclipse. This IDE is so incredibly complex it would probably take months to learn on how to build and run a simple application. As checked out from SVN, the "build..." menu item is just dimmed.

So I turned to the command line. Ant at least remotely reminds me of "make" and seems to follow some sort of logical behaviour. The result (about 1000 lines snipped):

$ ant build
Buildfile: build.xml

init:

build:
     [echo] Reprap: /home/mah/RepRap/reprap-reprap/host/build.xml
    [javac] Compiling 86 source files to /home/mah/RepRap/reprap-reprap/host/bin
    [javac] /home/mah/RepRap/reprap-reprap/host/src/org/reprap/Attributes.java:3: package javax.media.j3d does not exist
    [javac] import javax.media.j3d.Appearance;
    [javac]                       ^

Looking around in the checked out stuff, there are plenty of libraries with "j3d" in the name. .jar, .so, .dll, whatever your heart desires, in several copies.

Can I get a helping hand in fixing the build.xml?


Thanks,
Markus


Generation 7 Electronics Teacup Firmware RepRap DIY
     
Re: Compiling Host for the C programmer
June 24, 2010 06:30PM
I think was the last person to make changes to build-user.xml, in January... of 2008. Like you, I tend to avoid Eclipse smiling smiley

There is a script called host-package-release which does all the work needed to create a reprap-mendel-20100624.zip "release" file, including compiling the reprap host code into Java bytecode and creating a .jar containing it.

The key ant command is ant clean jar. This (still) works for me in Ubuntu 10.04 amd64. Note that on Ubuntu (and Debian) machines, it is best (I think) to remove all the *.so and most *.jar files from the resulting "release" file, and mod the reprap script to look in /usr/share/java/* for the system-installed (Ubuntu-packaged) Java libraries etc. I have a modified wrapper script which does this, if you need it.

I hope to release an actual Debian/Ubuntu package of the reprap host software soon. The only library I find I still need from the reprap svn tree is the j3d-org-java3d-all.jar one which has some STL file loader code that is apparently not in the official java3d packages.

This is a good time to compile the reprap host software from svn -- Adrian's recent r3610 commit seems to provide a massive performance improvement!



Jonathan
Re: Compiling Host for the C programmer
June 25, 2010 06:48AM
Quote

The key ant command is ant clean jar. This (still) works for me in Ubuntu 10.04 amd64.

Thanks for the help, Jonathan. Unfortunately, ant clean jar produces the same set of at least 100 errors.

Quote

There is a script called host-package-release which does all the work needed to create a reprap-mendel-20100624.zip "release" file, including compiling the reprap host code into Java bytecode and creating a .jar containing it.

This one apparently worked, except for the "design files" missing. Glad to see somebody worked out the Java mysteries already. After also applying the usual x86_64 tweaks, the GUI actually appeared. :-) :-) :-)


Generation 7 Electronics Teacup Firmware RepRap DIY
     
Re: Compiling Host for the C programmer
June 25, 2010 07:49AM
I've added a section for building without Eclipse to the build instructions: [reprap.org]


Generation 7 Electronics Teacup Firmware RepRap DIY
     
Re: Compiling Host for the C programmer
June 25, 2010 12:29PM
Thanks for updating the docs.

The design files are under mendel/ not host/ so you need to check out both subtrees.

So (for me, at least!) I can build a release .zip file including the design files and the reprap host software by doing

mkdir ~/repraptest
cd repraptest
svn -q co h\ttps://reprap.svn.sourceforge.net/svnroot/reprap/trunk/reprap/host
svn -q co h\ttps://reprap.svn.sourceforge.net/svnroot/reprap/trunk/mendel
cd host
./host-package-release

and to get a Linux-specific wrapper script that runs the code using installed Ubuntu-packaged libraries instead of the 32bit ones included in reprap svn, I do
cd release/reprap-mendel-2*
cat >reprap.sh
#!/bin/bash                                                                                                                    
# reprap-host -- runs RepRap Java host with an appropriate classpath                                                           

REPRAP_RAM_SIZE=1024M           # Amount of RAM to allow Java VM to use                                                        
REPRAP_DIR=`dirname $0`         # reprap.jar and stl file                                                                      
SHARED_JAVA_DIR=/usr/share/java # System-wide shared java library directory                                                    

cd $REPRAP_DIR

# build up classpath                                                                                                           
# when we move to OpenJDK/Java-6 these next few can be replaced with wildcard                                                  
# *.jar and we will not need swing-layout any more.                                                                            
CLASSPATH=./reprap.jar
CLASSPATH=$CLASSPATH:./j3d-org-java3d-all.jar
CLASSPATH=$CLASSPATH:${SHARED_JAVA_DIR}'/*'
CLASSPATH=$CLASSPATH:.

# invoke the code                                                                                                              
echo "$0: java -cp $CLASSPATH -Xmx$REPRAP_RAM_SIZE org.reprap.Main"
java -cp $CLASSPATH -Xmx$REPRAP_RAM_SIZE org.reprap.Main

ctrl-D

chmod +x reprap.sh

and now (assuming the relevant Java libs are already installed on the machine of course), running ./reprap.sh will run the newly created reprap host.



Jonathan
Re: Compiling Host for the C programmer
June 25, 2010 02:53PM
Quote

So (for me, at least!) I can build a release .zip file including the design files and the reprap host software by doing[...]

Added this to the Wiki, thanks.

Quote

and to get a Linux-specific wrapper

Actually, it was a Windows user asking for an up-to-date package. :-)

Is there a good place for uploading this package other than one of the generic sharehosters (rapidshare, megaupload, ...)? The Wiki?


Generation 7 Electronics Teacup Firmware RepRap DIY
     
Re: Compiling Host for the C programmer
June 25, 2010 03:04PM
Quote
Traumflug
Is there a good place for uploading this package other than one of the generic sharehosters (rapidshare, megaupload, ...)? The Wiki?
Yes, the wiki should be fine, unless the package is really *huge* .

Quote
Traumflug
Actually, it was a Windows user asking for an up-to-date package. :-)
So... are you proposing uploading a modified reprap-mendel-20100625.zip that works on 64bit Windows machines?
Did you modify the included .bat file to use 64bit libs if it detects it is being run on a 64bit OS? That would be a good way to go, at least until we get a "real" Windows installer once again.

Given the performance significance of Adrian's recent host code update, we really should do a release to sourceforge soon. If I can get "automatic" 64bit-readiness into that, I will.



Jonathan
Re: Compiling Host for the C programmer
June 26, 2010 05:36AM
Quote

Yes, the wiki should be fine, unless the package is really *huge*.

8 MB for the software alone, 62 MB with the design files.

Quote

So... are you proposing uploading a modified reprap-mendel-20100625.zip that works on 64bit Windows machines?

I didn't want to propose anything. Me is the guy with the Ubuntu machine and as building instructions exist only for Ubuntu, I compiled the package for another user. This other user might be using 32-bit Windows or 64-bit, I don't know.

All I wanted to mention is, Ubuntu-specific enhancements were of no use in this case.

That said, having a daily build working on all platforms uploaded somewhere would be just great, but I don't volunteer.


Generation 7 Electronics Teacup Firmware RepRap DIY
     
Re: Compiling Host for the C programmer
June 26, 2010 09:56AM
Re: Compiling Host for the C programmer
June 27, 2010 05:26PM
I believe that the java3d libraries come from here: [www.j3d.org]. Java3d development within SUN (as was) was put on hold and integrated into the JavaFX development so the community has taken over development and enhancements with respect to this. As far as I am aware JavaFX doesn't have any api for STL loaders

(JavaFX is only just available in a beta format for Linux, last year it was only available for Windows and Mac).

David
Re: Compiling Host for the C programmer
June 27, 2010 11:28PM
Thanks... that makes sense, and helps... but it also makes me wonder why Debian and Ubuntu must be packaging up an "old" version of those libraries, in that case? On Ubuntu 10.04 I have libjava3d-java 1.5.2+dfsg-5 and Debian has nothing newer than that. So to avoid carrying the extra library around in my (planned/unfinished) reprap-host package, I'll probably have to package the STL loader code separately and get it accepted into both Debian and Ubuntu... which should be possible, but not exactly quick.



Jonathan
Re: Compiling Host for the C programmer
June 28, 2010 05:07AM
Quote
Traumflug
... having a daily build working on all platforms uploaded somewhere would be just great, but I don't volunteer.

I do, at least unofficially smiling smiley Let's see how http://jonathan.reprap.org/nightly-builds/ works for a few days. It just uses the host-release-package script, so "working on all platforms" is not yet true for 64bit systems.



Jonathan
Re: Compiling Host for the C programmer
June 28, 2010 02:11PM
Great move, Johnathan, thanks.

Right now I'm downloading at about 30 kB/s, expected download time 40 minutes. Is this running off your home server? If not, it might be a good idea to separate out design files for automatic builds.


Generation 7 Electronics Teacup Firmware RepRap DIY
     
Re: Compiling Host for the C programmer
June 29, 2010 05:31AM
Quote

It just uses the host-release-package script, so "working on all platforms" is not yet true for 64bit systems.

With the required libraries installed from Ubuntu/Debian packages, the following patch makes the nightly build working unchanged:

--- reprap	2010-06-28 09:48:20.000000000 +0200
+++ reprap.patched	2010-06-29 11:02:53.248162062 +0200
@@ -19,4 +19,4 @@
 CLASSPATH=$CLASSPATH:.
 
 # invoke the code
-java -cp $CLASSPATH -Xmx$REPRAP_RAM_SIZE -Djava.library.path=. org.reprap.Main
+java -cp $CLASSPATH -Xmx$REPRAP_RAM_SIZE -Djava.library.path=/usr/lib/jni:/usr/lib:. org.reprap.Main

Filed a bug to get it into the general RepRap host software distribution: [sourceforge.net]


Generation 7 Electronics Teacup Firmware RepRap DIY
     
Sorry, only registered users may post in this forum.

Click here to login