Configuracion de Aubit4GL's Setup

Contenido/contents:
Intro
Bison
Environment
PostgteSQL
CVS
Compilation
Configuration
Pruebas/Tests
Que sigue?/WHat's next?
Bugs
Pagina principal/Home page

Intro
Aubit4GL es una alternativa libre para reemplazar el codigo que se tenga en el lenguaje Informix 4GL, a pesar de que querix ya tiene una version gratuita no es GPL. Aubit is a free alternative to replace all the code made with Informix 4GL, besides the fact that querix also has a free option it's not GPL.
En mis pruebas que he efectuado con Aubit funciona razonablemente bien y las fallas que he reportado las corrigen mucho mas rapido que las fallas que he reportado a IBM. During my test, Aubit works reasonable well and the bugs I'd reported are fixed faster than the bugs I'd reported to IBM.
Todos los archivos fuentes los descargo en el mismo directorio: All the tarballs are downloaded in the following directory:
export HOME_SRC=/var/src
mkdir $HOME_SRC
Bison
Bison es un reemplazo al programa yacc, la version que viene con el sistema operativo redhat es antigua por lo cual es recomendable borrar la version anterior e instalar la ultima Bison is a replacement for yacc, the version included in RedHat linux is old and you should delete that antique and install the newest.
rpm -e bison
A pesar de que el configure de Aubit diga que bison >= 1.875 solo es necesaria si se desea compilar la sintaxis, es problematico tratar de compilarlo sin tenerlo instalado. No matter the Aubit configure says that bison >= 1.875 is only required if you want to compile the sintaxis, it's troublesome compile Aubit without it.
cd $HOME_SRC
wget http://ftp.gnu.org/gnu/bison/bison-1.875.tar.gz
Extraemos el contenido del archivo. Extract the tarball.
tar xvfz bison-1.875.tar.gz
Nos cambiamos al directorio donde dejo los archivos. Change to the directory just extracted.
cd bison-1.875
Configuramos, compilamos e instalamos de la manera 'usual'. Configure, compile and install 'as usual'.
./configure
make
make install
Environment
Uno de mis mayores problemas para poder compilar Aubit4GL fue tener correctamente configurado mi medio ambiente de trabajo. My biggest problem in order to compile Aubit4GL was a right set of environment variables.
Especificamente para poder compilar Aubit4GL en base a los archivos fuentes es necesario tener correctamente configurada la variable AUBITDIR. Yo estaba confundido si debia de valer el directorio donde se instalaba o el de los programas fuentes. To be able to compile Aubit4GL form the sources you must have the variable AUBITDIR set. I was confused about the right value, should it be the path where it is instaled or the path where ths sources are?
Ahora ya se que AUBITDIR debe de valer el directorio donde estan los programas fuentes, o sea que vale lo mismo que AUBITDIR_SRC. Now I found the light! AUBITDIR must point to the path where the source code is, contains the same value as AUBITDIR_SRC.
export AUBITDIR=$HOME_SRC/aubit4glsrc
export AUBITDIR_SRC=$HOME_SRC/aubit4glsrc
Otra variable de medio ambiente requerida para compilar sin problemas es AWK y debe de contener el valor gawk. Another environment variable needed to compile without problems is AWK and must be set to gawg.
export AWK=gawk
Ademas deben de estar correctamente configuradas las librerias cliente de la base de datos a la cual se quiera conectar. Also the client libraries of the data base must already be installed.
Para una explicacion de como configurar la libreria cliente para Informix, puede ver esta guia de la instalacion del CSDK. For an example of how to setup the client library for Informix, you can see this installation guide for the CSDK.
Ademas para que Aubit funcione lo mas pareceido posible a Informix 4GL haran falta agregar algunas variables mas de medio ambiente. Aubit also need others environment variables to has i a better Informix 4GL work-alike.
export A4GL_PRINTSCRKEY=CONTROL-P
export A4GL_PRINTSCRFILE=+$DBSCREENOUT
export ODDOPTIONS=N
PostgreSQL
Una de las ventajes de Aubit4GL es que funciona tanto para la base de datos informix como para otras bases de datos. One of the advantages of Aubit4GL is his ability to work with others RDBMS besides Informix.
En esta pagina explico como instalar y configurar el postgresql para que funcione bien con Aubit4GL. On this page I explain how to install and setup a PostgreSQL+Aubit environment.
En una pagina futura explicare como configurar la conexion ODBC para cualquier otra base de datos. In a future page I'll explain how to setup a ODBC conection with others RDBMS.
CVS
Actualmente el desarrollo de Aubit4GL esta muy dinamico y casi todos los dias corrigen algun BUG o liberan una nueva funcionalidad, es altamente recomendable que se suscriban a la lista de correo de usuarios. Nowadays Aubit development is very dynamic and allmost all days they release a BUG fix or a new feature, is highly advisable you register to the discussion list.
Para descargar los archivos fuentes los pueden bajar de aqui, pero para obtener una version mas fresca con las novedades lo recomendable es bajarlo por CVS. You can download the source tarball from here, but to get a newer version with all the fixes you should get the sources from CVS.
En mi caso tuve que configurar el acceso al repositorio CVS a traves del servidor proxy de la compania (squid). In my case I needed to setup the access to the CVS repository thru the company proxy server (squid).
Si tu version de CVS no soporta la conexion via proxy puedes bajar una version con nuevas caracteristicas aqui. If your version of CVS is old and you require access thru proxy, you can download the new version from here.
cvs -d:pserver\;proxy=192.6.2.40\;proxyport=8080\:anonymous@cvs.sourceforge.net:/cvsroot/aubit4gl login
Como dato cultural esto es lo que guarda mi archivo .cvspass. Notese que tuve que abrir el puerto 2401 en my archivo squid.conf (acl SSL_ports port 2401). For your information, this is the content of my .cvspass file. Note that I needed to open port 2401 in my squid.conf (acl SSL_port 2401).
/1 :pserver:anonymous@cvs.sourceforge.net:2401/cvsroot/aubit4gl A
Una vez registrado el login el archivo $HOME/.cvspass ya se pueden efectuar periodicamente los 'checkout'. When the login registered in the $HOME/.cvspass file you can now make the 'checkout' regularly.
cd $HOME_SRC
cvs -z3 -d:pserver\;proxy=192.6.2.40\;proxyport=8080\:anonymous@cvs.sourceforge.net:/cvsroot/aubit4gl co aubit4glsrc aubit4gltest
Aubit Compilation
Ya con la ultima version de los programas fuentes ya podemos configurar las opciones a compilar. With the last version of the source code we can now configure the options to compile.
Por omision toma como valor de prefix al directorio /opt/aubit4gl y ahi deja los binarios ya instalados. En el directorio /usr/bin solo deja los comandos aubit y aubit-config. The defaulr for prefix is the directory /opt/aubit4gl and there are stored all the binaries. In the directory /usr/bin are stored only the commands aubit and aubit-config.
./configure
Este configurador 'autodecta' las librerias instaldas y normalmente no es necesario decirle con que base de datos nos vamos a conectar, para eso configuramos correctamente el medio ambiente en el capitulo anterior. This command autodetects the installed libraries and normally there is need to specify which RDBMS to use, that's why we setup the environment previously.
Si todo lo detecto correctamente, ahora si procedemos a compilar y a instalar los ejecutables. If everything is detected correctly, we just compile and install as usual.
make
su -c "make install"
La ventaja de tenerlo por CVS es precisamente poder descargar periodicamente las correciones que se publiquen e instalar la nueva version. The biggest advantage of getting the sources thru CVS, is been able to frequently download the updates and install them.
Para obtener las nuevas versiones solo hay que ejecutar de nuevo los comandos para el 'checkout', por lo cual es conveniente tener un pequeño archivo de comandos con estas instrucciones para ejecutarlas mas facilmente: To get the new versiones, we just need to 'checkout' the CVS repository, that's why is usefull to have a short script file with the commands:
#!/bin/bash cd $HOME_SRC
cvs -z3 -d:pserver\;proxy=192.6.2.40\;proxyport=8080\:anonymous@cvs.sourceforge.net:/cvsroot/aubit4gl co aubit4glsrc aubit4gltest
La operacion normal del 'make' es solo compilar los programas que sufrieron cambios, pero en algunas ocaciones sera necesario borrar todos los objetos anteriores para forzar una nueva compilacion. The normal operation of the make command is just compile the sources that has changed since last compile, but there're times were you need to force the compilation , so you need to remove the previous objects.
make cleanall
make clean.tools
make
su -c "make install"
Nota: El repositorio CVS publico esta desfasado alguna horas (3-5) del CVS de los desarrolladores, o sea que si Mike, Andrej o algun otro de los desarroladores hace un cambio y dice que lo acaba de hacer, tardar un tiempo antes de que los simples mortales tengamos accesso a el. Note: The public CVS repository is a few hours (3-5) outdated from the developers repository, so if Mike, Andrej or other developer make a change and say 'Hey! I just fixed it', there'll be a delay before the simple mortal can access the fix.
Aubit Configuration
Los archivos de configuracion son leidos en el siguiente orden: The configuration files are read from, in this order:
  1. : /etc/opt/aubit4gl/aubitrc
  2. : $AUBITDIR/etc/aubitrc
  3. : ~/.aubit4gl/aubitrc (`=$HOME=user's home directory)
  4. : ./.aubitrc (current directory)
  5. : $A4GL_INIFILE environment variable
En resumen la opciones en /etc/opt/aubit4gl/aubitrc las toman todos los usuarios a menos que sean modificadas por otro archivo. For short, the options in /etc/opt/aubit4gl/aubitrc are taken for all, except if modified for another lower file.
Pruebas/Tests
Para hacer las pruebas basicas de que este bien instalado lo mas sencillo es compilar y ejecutar los programas de ejemplo. The basic test for the correct Aubit installation is precisely run the test programs.
Estos se encuentra en el directorio /opt/aubit4gl/tools/test y se compilan con un simple make. They're in the directory /opt/aubit4gl/tools/test and are compiled with a simple make.
cd /opt/aubit4gl/tools/test
make
El programa de ejemplo de 'hola mundo' en Aubit4GL es el hello.4ae, se ejecuta tecleando: The 'Hello world' example is the hello.4ae, and is executed with:
./hello.4ae
Algunos programas de prueba requieren que esten instaladas algunas librerias opcionales en mi caso solo estoy probando actualmente en modo caracter y con Informix. Some test programs requiere some optional libraries, I'm just using CUI/TUI (character/terminal user interface) and informix.
Que sigue?/What's next?
Ahora que ya esta instalado y probado el compilador la p[regunta obligada es, y ahora que sigue? como lo uso para compilar mis programas?
En esta pagina tengo unos ejemplos para iniciar el uso de Aubit4GL en produccion, desde un simple programa independiente hasta como compilar un programa completo formado por varios modulos.
La secuencia de pasos para la migracion es:
  1. Teniendo una base de datos informix y un sistema x4GL en operacion.
  2. Migrar a Aubit4GL usando todavia la base de datos Informix.
  3. Ir convertiendo los enunciados SQL propietarios de Informix a ANSI SQL.
  4. Cambiar de base de datos a PostgreSQL con el parche de informix (EC).
  5. Poder cambiar a cualquier base de datos via ODBC.
Bug Report
Reproduzco un correo que mando Andrej a la lista de correo que menciona la importancia y requisitos para reportar fallas. I reproduce an e-mail than Andrej sent to the mailing list that recall the importance of reporting bugs and the correct way of reporting them.
From: "Andrej Falout"
To: <aubit4gl-discuss@lists.sourceforge.net>
Sent: Tuesday, September 14, 2004 6:07 AM
Subject: RE: [Aubit4gl-discuss] Another SegFault


Hola,

Escribo esto a todos lo que reportan BUGS. Todos estamos agradecidos por los reportes de los BUGS - no podemos arreglar lo que no sabemos que esta mal. Reportar los BUG y arreglarlos son parte crucial del proceso de desarrollo, y es la mejor manera de asegurar una funcionalidad estable y robusta.

Y aqui es la parte donde vienen los 'peros' :-)

Pero, es extremadamente dificil reparar problemas que no [pdemos REPRODUCIR.

Especialmente cuando hay volcados de memoria (core dumps). Las mas veces sera imposible.

Por lo tanto, por favor siempre proporciona los medio para REPRODUCIR el error. Esto significa que debes de proporcionar codigo compilable AUTO CONTENIDO e independiente que contenga TODO lo que se necesita para EJECUTARSE y obtener el mismo resultado (falla( que tu. Al conjunto de todos los componentes necesarios, incluyendo la descripcion del problema, es comunmente llamada un "caso de prueba".

No es suficiente que envien la pieza del codigo donde ocurre el error, sin todas las otras piezas del codigo, archivos de formas, tablas de la base de datos y en algunos casos los datos mismos, que son necesarios para ejecutar el caso de prueba.

Tampoco es correcto que envien el programa completo con algunas miles de lineas de codigo, que nosotros no podemos compilar y menos ejecutar.

Debe de ser razonablemente pequeño, debe de ser autocontenido, debe de copilar y debe de ejecutarse con el comportamiento descrito bajo la condiciones descritas, todo en computadora del desarrollador que arreglara el problema.

Lo anterior aplica especialmente con los 'vuelcos de memoria' (core dumps). Sin un caso de prueba, y sin un rastreo de memoria (core dump back trace), y aun sin un rastreo con Valgrind, sera dificil esperar que se arregle.

Ademas de todo eso, queremos no solo arreglar el problema, queremos asegurarnos de que nunca reaparezca, en el proceso constante y sin fin de mejorar el compilador Aubit. Para que esto suceda, necesitamos que el CASO DE PRUEBA forme parte de nuestras pruebas de regresion. Para que se pueda convertir en un caso de regresion, tiene que existir primero.

Por favor ayudenos a ayudarlo,

Saludos,
Andrej
From: "Andrej Falout"
To: <aubit4gl-discuss@lists.sourceforge.net>
Sent: Tuesday, September 14, 2004 6:07 AM
Subject: RE: [Aubit4gl-discuss] Another SegFault


Hi guys,

I'm writing this to everyone reporting bugs. We are all grateful for bug reports - we can't fix what we do not know is wrong. Bug reports and bug resolution are crucial part of development process, and beast way to ensure stabile and robust functionality.

And here is the part where word 'but' comes :-)

But, it is extremely hard to fix problems one can not REPRODUCE.

Especially when talking about core dumps. More often then not, it can be impossible.

Therefore, please always provide means to REPRODUCE the error. This means that you need to supply SELF CONTAINED and stand-alone compilable code that contains ALL that is needed to RUN it and get the same result (bug) you see. This collection of all needed components, including the description of the problem, is usually referred to as "test case".

It is not enough to send a peace of code where error happens, without all other peaces of code, form files, database tables and in some case data itself, which is needed to run the test case.

It is also no good to send complete program of few thousands lines of code, that we cannot make to compile, not to mention execute.

It must be reasonably small, must be self contained, must compile, and must run and exhibit described behavior under described conditions, all on the computer of the developer that is to fix the problem.

All the above especially applies in case of core dumps. Without a test case, and without a core dump back trace, and without even a Valgrind trace, it will be hard to expect to get a fix.

On top of that, we all wont not only to fix the problem, but to make sure it never appears again later, in the process of Constant And Never Ending Improvement of Aubit Compiler ("Caneiac" :-). For this to happen, we need a TEST CASE to become a part of our regression tests. For it to become a regression test, it needs to exist first.

Please help us to help you,

Cheers,
Andrej
Tambien reproduzco las instrucciones de Mike para poder analizar un volcado de memoria. Also, here is the instruction from Mike to analyze a core dump or segmentation violation.
From: "Mike Aubury"
To: <aubit4gl-discuss@lists.sourceforge.net>
Sent: Tuesday, September 14, 2004 11:50 AM
Subject: Re: [Aubit4gl-discuss] Another SegFault

Hay que compilar el programan activando la opcion de depuracion - busca la lista de correos por la opcion '-debug'..

Ejecuta el programa dentro del depurador GNU (gdb)

$ gdb myprog.4ae
gdb> run
...time passes
Seg Fault
gdb>bt

Envia el rastreo..

Tambien puedes querer instalar valgrind y jugar con el tambien - tambein busca en la lista ....
From: "Mike Aubury"
To: <aubit4gl-discuss@lists.sourceforge.net>
Sent: Tuesday, September 14, 2004 11:50 AM
Subject: Re: [Aubit4gl-discuss] Another SegFault

Compile the program with debugging on - search the mailing list for '-debug'..

Then run the program under the GNU debugger (gdb)

$ gdb myprog.4ae
gdb> run
...time passes
Seg Fault
gdb> bt

And send that backtrace..

You may also want to install valgrind and play with that too - again search the list...
Yo he usado poco el gdb pero encontre que para poder ejecutar un programa con parametros hay que ejecutar el comando gdb sin los parametros y despues asignar los parametros con el comando set args: With my few experince with gdb I found a method to execute a 'gdb' of a program with parameters, execute gdb without the parameters and then assign them with the command set args:
Por ejemplo para hacer un analisis de una falla al compilar un programa, se darian estos comandos, asumo que en la linea del error se hace referencia a la variable fprop por lo cual desplegamos su valor para analizar la falla: Supose you need to analyze a segmentation fault during compilation of a program, you need to type the following assuming that the backtrace reported an error in tha varable fprop:
gdb /opt/aubit4gl/bin/4glc
...
(gdb)set args prog.4gl -o prog.4ae
(gdb)run
...
(gdb)bt
...
(gdb)print fprop
...
(gdb)print *fprop
...
Tambien reproduzco el correo donde Mike da unos tips para ejecutar Valgrind . Here's also the mail from Mike about a tiips to execute Valgrind .
From: "Mike Aubury"
To: <aubit4gl-discuss@lists.sourceforge.net>
Sent: Thursday, August 12, 2004 9:12 AM
Subject: Re: [Aubit4gl-discuss] problems with port to pg

No se la manera oficial de hacerlo - Yo solo uso:
--logfile=algunarchivo or --gdb-attach=yes

en el primer caso tendras un archivo llamado algunarchivo.pid

en el segundo caso, algunas veces tienes que ejecutar "stty sane" para dejar la pantalla funcionando nuevamente.

--- John O'Gorman wrote:
valgrind es nuevo para mi. Encontre que esta en mi maquina con SuSE 9.1 pero no existe la pagina de "man" o "info" para el.

Cuando lo ejecuto con un programa 4GL, obtengo una pantalla revuelta. Tanto valgrind y el 4GL hacen garabatos sobre la ventana "curses".

Tienen una guia para principiantes que recomendar?

Basicamente, como se hace la depuracion en una terminal y el desplegado en otra?

John O'G
From: "Mike Aubury"
To: <aubit4gl-discuss@lists.sourceforge.net>
Sent: Thursday, August 12, 2004 9:12 AM
Subject: Re: [Aubit4gl-discuss] problems with port to pg

I don't know the official way - I tend to just use
--logfile=somefilename or --gdb-attach=yes

for the former you'll end up with files somefilename.pid

For the latter - you sometimes need to "stty sane" to get the screen working again..

--- John O'Gorman wrote:
valgrind is new to me. I found that it is on my SuSE 9.1 machine but no man of info pages for it.

When I just ran it with a 4GL program, I got a scrambled screen. Both valgrind and 4GL were scribbling over the curses window.

Do you have an idiot's guide to recommend?

In general, how do debug on one terminal and get the display on another?

John O'G
Yo use los siguientes comandos para ejecutar el valgrind: I use this command to execute valgrind:
valgrind --tool=addrcheck --logfile=<logfile> <prog>.4ae
o
valgrind --tool=memcheck --logfile=<logfile> <prog>.4ae

seguido de

more <logfile>.pid<num>