Building leJOS on 64-bit Linux
Introduction
This page attempts to show how to compile
leJOS on 64-bit Linux machines. It is
a work in progress, so see the forums
http://lejos.sourceforge.net/forum for updates and discussion.
The initial problem is that, as of 0.4.0, the JNI sources and the ANT
build script are only targeted at 32-bit systems.
This is my attempt at a simple compilation for 64-bit Linux.
- Install the JDK somewhere on your machine and set an environment variable JAVA_HOME to its base.
- Set an environment variable JAVA_HOME to its base.
- Make sure that you read through the leJOS NXJ FAQ.
- Look through the revised installation
instructions, but note that:
- You need a 32-bit (386) version of libusb, the base package and *-devel package.
- If you get missing file errors for "bluetooth.h" then verify that you have the base and *-devel Bluetooth packages installed (possibly named bluez or libbluetooth).
- Download and decompress the tar file from www.lejos.org.
- Add the environment variable NXJ_HOME and set it to the directory you installed leJOS.
- Add the leJOS bin directory to your PATH. Depending on the privilege settings, you might need to adjust the execution permissions in the bin folder.
- Your PATH must also contain the ant binary (ant 1.6 or above).
- You need libusb installed so the leJOS tools can access your
USB port. This can be downloaded from: http://libusb.sourceforge.net
Search for a package for your OS distribution first, and make sure to get 32-bit (386) versions and the -devel version, too.
- Create an executable shell script named gcc in the build sub-directory of leJOS:
cd $NXJ_HOME/build echo '#!/bin/bash -x' > gcc echo 'inc=${JAVA_HOME}/include' >> gcc echo 'export C_INCLUDE_PATH=.:$inc:$inc/linux' >> gcc echo 'export PATH=${JAVA_HOME}/bin:$PATH' >> gcc echo 'exec /usr/bin/gcc -m32 "$@"' >> gcc chmod +x ./gcc
NOTE: Change the last line if needed:- Add -v (before -m32) if you are having problems and want to see what GCC is doing in more detail,
- Change the path to GCC if needed. To check, use: type gcc
- Prepend your PATH with the new shell script, and build:
export PATH=$PWD:$PATH ant build
- Now you need to build the distribution. Switch to the build folder and run ant. Note that depending on the privilege settings you might need to adjust the execution permissions in the release folder.
- Create an executable shell script named gcc in the build sub-directory of leJOS: