« Tagged HybridOS/Bluecat RH 8.0 building | Main | Hybrid OS »

Building Bluecat on RH 8.0

  • Build local GNUTools on RH 8.0
  • Fixed bug in do_it script WRT RH 8.0

Building GNUTools on RH 8.0

When trying to build Bluecat on RH 8.0 and running mktools (to build the local gnutools) I get the following:

[int@europa make]$ autoreconf -f -i
autoreconf: `aclocal.m4' is updated
Makefile.am: installing `./depcomp'
WARNING: Using auxiliary files such as `acconfig.h', `config.h.bot'
WARNING: and `config.h.top', to define templates for `config.h.in'
WARNING: is deprecated and discouraged.

WARNING: Using the third argument of `AC_DEFINE' and
WARNING: `AC_DEFINE_UNQUOTED' allows to define a template without
WARNING: `acconfig.h':

WARNING:   AC_DEFINE([NEED_MAIN], 1,
WARNING:             [Define if a function `main' is needed.])

WARNING: More sophisticated templates can also be produced, see the
WARNING: documentation.
autoheader-2.53: `config.h.in' is updated

Further, after running configure I get the following odd file in /usr/local/bluecat/eng/bluecat/make/.deps: remote-$(REMOTE).Po which causes the make to fail:

[int@europa make]$ make
Makefile:329: .deps/remote-stub.Po: No such file or directory
make: *** No rule to make target `.deps/remote-stub.Po'.  Stop.

Renaming .deps/remote-$(REMOTE).Po -> .deps/remote-stub.Po allows the make to proceed.

Fun with eval, echo and new shell

One of the things that the Bluecat do_it script does is to define the series of "steps" that need to be performed in terms of command lines in variables. Later on the $BUILD_STEP is evaluated to determine which set of commands need to be done as follows:

echo "---- Step $BUILD_STEP started at `date` ----"
su $BUILD_CMD_OWNER -c "mkdir -p $LOGS_PREFIX/step${BUILD_STEP}"
cmd=`eval echo $"STEP${BUILD_STEP}_CMD"`
su $BUILD_CMD_OWNER -c "$cmd $*"

Effectively the name of the environment variable holding the proper command(s) for the step is composed with the echo portion. The eval statement is used to "evaluate" that environment variable thus storing the string of commands into the environment variable cmd. This works well in past versions of the OS but it fails in RH 8.0. First here's the behavior on RH 6.1:

RH6.1:export STEP1_CMD="ls /tmp"
RH6.1:export BUILD_STEP=1
RH6.1:echo $"STEP${BUILD_STEP}_CMD"
$STEP1_CMD

However hears the same commands on RH8.0:

RH8.0:export STEP1_CMD="ls /tmp"
RH8.0:export BUILD_STEP=1
RH8.0:echo $"STEP${BUILD_STEP}_CMD"
STEP1_CMD

As you can see the result is missing a $. Prepending a leading \ before the $ fixes this. Adding in the eval portion also works:

RH8.0:eval echo \$"STEP${BUILD_STEP}_CMD"
ls /tmp

However when this is assigned to another environment variable (i.e. cmd) the result is not correct:

RH8.0:cmd=`eval echo \$"STEP${BUILD_STEP}_CMD"`
RH8.0:echo $cmd
STEP1_CMD

Subsituting the syntax of $() for `

RH8.0:cmd=$(eval echo \$"STEP${BUILD_STEP}_CMD")
RH8.0:echo $cmd
ls /tmp

Note that the shell (bash) has been majorly updated for RH8.0:

RH6.1:bash -version
GNU bash, version 1.14.7(1)

Versus:

RH8.0:bash -version
GNU bash, version 2.05b.0(1)-release (i686-pc-linux-gnu)
Copyright (C) 2002 Free Software Foundation, Inc.

Please note that this new syntax also works flawlessly on the older RH 6.1.