#456 Error running "fansubstitute" (buildall.fan)

jakb Wed 11 Feb 2009

hi If you want to bootstrap the fan source, you get to the point where you have to call an existent fan executable.

So the buildfile ("buildall.fan") contains the shebang

#! /usr/bin/env fansubstitute
#buildall.fan

Something is wrong with this command on my machine (ubuntu 8.04.1, java 1.5).

Error:

$ fansubstitute 
Exception in thread "main" java.lang.NoClassDefFoundError: fanx/tools/Fan

Just to make shure, that my setup is correct:

$ echo $FAN_HOME
/usr/local/fandir/rel

$ vim rel/lib/sys.props:
fan.build.devHome=/usr/local/fandir/fan/

$echo $FAN_SUBSTITUTE
/usr/local/fandir/rel/bin

$ls `echo $FAN_SUBSTITUTE`
fan  fanlaunch  fanp  fansh  fansubstitute  fant  flux

thanks for helping ben

f00biebletch Thu 12 Feb 2009

I'm running ubuntu as well and had problems with this (and still have some), so hopefully I can help get you through it.

Try not setting $FAN_HOME

unset FAN_HOME

and then

chmod +x <any build script you want to run>

and then execute the build script directly. My current problems are with buildall, so try executing sys/build.fan.

HTH.

brian Thu 12 Feb 2009

You need 2 Fan environments:

  • rel which contains a pre-compiled build (downloaded from web)
  • dev which you most likely pulled from hg

It looks like you have those two directories based upon your rel/lib/sys.props setting. But you want your path to point to your dev directory, only FAN_SUBSTITUTE should reference rel.

Kevin suggests not to set FAN_HOME, I actually never set that environment variable in OS X, rather I only set the path and let the script base FAN_HOME on its location. That might be the issue that FAN_HOME is being exported into the substitute.

jakb Thu 12 Feb 2009

hi

unset FAN_HOME didn't help

It still doesn't work, and if you ask me there there a lot of places where you can screw up one of this manual settings. So maybe you see the error:

Fan top directory (/usr/local/fandir/):

$ ls /usr/local/fandir/
fan  rel

Fan source code from hg (/usr/local/fandir/fan/):

$ ls fandir/fan/
adm  bin  examples  flux  lib  src

Fan binary release (/usr/local/fandir/rel):

$ ls fandir/rel/
adm  bin  doc  examples flux  lib  src

Environment variables:

$ echo $FAN_SUBSTITUTE
/usr/local/fandir/rel/bin

$echo $FAN_HOME
/usr/local/fandir/fan

$ echo $PATH
[...]:/usr/local/fandir/fan/bin:[...]

Error:

/usr/local/fandir/fan/src$ ./buildall.fan 
Exception in thread "main" java.lang.NoClassDefFoundError: fanx/tools/Fan

oh man ... ben

brian Thu 12 Feb 2009

Verify you can can run OK out of rel and that it thinks fan.home is running out of rel (unset FAN_HOME):

/usr/local/fandir/rel/bin/fan -version

If that works you should see something like:

Java Runtime:
  java.vm.name:    Java HotSpot(TM) Client VM
  java.vm.vendor:  Sun Microsystems Inc.
  java.vm.version: 1.6.0_03-b05
  java.home:       ....
  fan.home:        /usr/local/fandir/rel/   <---- this line is key
  sys.version:     1.0.37

If that works, then try just a dump for running just jsys:

/usr/local/fandir/fan/src/jsys/build.fan -dumpenv

jakb Thu 12 Feb 2009

FAN_HOME:

$ echo $FAN_HOME

$  

fan version:

$ /usr/local/fandir/rel/bin/fan -version

Java Runtime:
java.vm.name:    Java HotSpot(TM) Client VM
java.vm.vendor:  Sun Microsystems Inc.
java.vm.version: 1.5.0_15-b04
java.home:       /usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre
fan.home:        /usr/local/fandir/rel
sys.version:     1.0.37

build dump:

$ /usr/local/fandir/fan/src/jsys/build.fan -dumpenv
-bash: /usr/local/fandir/fan/src/jsys/build.fan: No such file or directory

with jfan:

$ /usr/local/fandir/fan/src/jfan/build.fan -dumpenv
Exception in thread "main" java.lang.NoClassDefFoundError: fanx/tools/Fan

geez ...what should I do, am I too stupid?

brian Thu 12 Feb 2009

A lot of people seem to run into problems on Unix getting the boot build to work. Although it is hard for me to help debug the problem unless you add some tracing to the fanlaunch bash script.

If you can't get it to work in one environment, you might find it is much easier to setup two different environments:

  1. setup an environment which only uses rel (but with devhome set to dev) and use that to run buildboot.fan; this is basically using rel to build the core pods in dev
  2. setup an environment which only uses dev to run buildpods.fan (this allows dev to be used to finish building itself)

That is effectively all FAN_SUBSTITUTE is doing to make it work in one environment.

Login or Signup to reply.