Java 2 Ada

NetBSD 6.1.5 upgrade

By stephane.carrez

Once every year I try to upgrade one of my virtual machine which is running NetBSD. This description is a short reminder for the major steps for the upgrade process.

System upgrade

The NetBSD system is upgraded by using the following command:

poseidon$ sudo sysupgrade auto ftp://ftp.NetBSD.org/pub/NetBSD/NetBSD-6.1/i386
During the upgrade it will ask whether some system files have to be replaced, merged or kept unmodified.

GCC Ada Package Upgrade

The GCC Ada compiler is now based on GCC 4.9. I did the upgrade by using the following command:

poseidon$ sudo pkg_add -uu gcc-aux-20140422nb3 pkg_add: Warning: package `gcc-aux-20140422nb3' was built for a platform: pkg_add: NetBSD/i386 6.0 (pkg) vs. NetBSD/i386 6.1.4 (this host)
The gprbuild package must also be upgrade:
poseidon$ sudo pkg_add -u gprbuild-aux-20130416 pkg_add: Warning: package `gprbuild-aux-20130416' was built for a platform: pkg_add: NetBSD/i386 6.0 (pkg) vs. NetBSD/i386 6.1.4 (this host) pkg_add: Warning: package `gnat_util-20140422' was built for a platform: pkg_add: NetBSD/i386 6.0 (pkg) vs. NetBSD/i386 6.1.4 (this host)
And because I also use some other packages such as xmlada, the following package is also upgrade:
poseidon$ sudo pkg_add -u xmlada-4.4.0.0nb1 pkg_add: Warning: package `xmlada-4.4.0.0nb1' was built for a platform: pkg_add: NetBSD/i386 6.0 (pkg) vs. NetBSD/i386 6.1.4 (this host)

Before running an Ada program compiled by GCC 4.9

The GCC 4.9 Ada compiler works very well but it comes with a specific libgcc_s.so file installed in /usr/pkg/gcc-aux/lib. By default libgcc_s.so is installed on the system in /usr/lib/libgcc_s.so or /usr/pkg/lib/libgcc_s.so and they were compiled by GCC 4.5.3 or GCC 4.6.4.

If you use the wrong libgcc_s.so, the program will almost work except when a exception is raised: none of the exception can be caught and the program terminates as though there was no exception handler.

What happens is that the GCC 4.6 frame unwinder is unable to correctly identify the frames generated by GCC 4.9. The solution is of course to use the correct library and we can do this by setting the following environment variable before starting any program:

poseidon$ export LD_LIBRARY_PATH=/usr/pkg/gcc-aux/lib

To add a comment, you must be connected. Login to add a comment

Upgrading to NetBSD 6.1.4

By stephane.carrez

I'm using NetBSD for few years now but I've never took time to upgrade the system to a new version. To remember what I did for the upgrade, I've collected below the main steps.

Setup

The system upgrade can be made from the running NetBSD system by using the sysupgrade tool. I have installed the tool by using:

sudo pkgin install sysupgrade

Edit the file /usr/pkg/etc/sysupgrade.conf and setup the RELEASEDIR to point to the new release:

RELEASEDIR="ftp://ftp.NetBSD.org/pub/NetBSD/NetBSD-6.1.4/$(uname -m)"

NetBSD upgrade

Now, we just have to run the sysupgrade command to upgrade the base system and NetBSD kernel and then upgrade the packages by using the pkgin command.

sudo sysupgrade auto
sudo pkgin upgrade
sudo pkgin full-upgrade

And after the upgrade reboot the new kernel:

sudo shutdown -r now

Upgrading FreeBSD for a GCC 4.9 Ada compiler

By stephane.carrez

After the recent announcement of the GCC 4.9 Ada compiler availability on FreeBSD by John Marino, I decided to do the upgrade and give it some try.

After a quick investigation, I´ve performed the following two simple steps on my FreeBSD host:

sudo pkg update
sudo pkg upgrade

Among several upgrade notifications, I've noted the following messages. The gcc-aux package corresponds to the GCC 4.9 compiler and the gnat-aux package contains the GCC 4.6.4 compiler.

Upgrading gcc-aux: 20130411_3 -> 20140416
Upgrading gnat-aux: 20130412_1 -> 20130412_2
Upgrading aws: 3.1.0.0 -> 3.1.0.0_2

The GCC 4.9 Ada compiler is located in /usr/local/gcc-aux/bin and the GCC 4.6.4 Ada compiler is located in /usr/local/bin.

Once the upgrade was finished, I've rebuilt all my FreeBSD jenkins projects and... it's done.

It worked so well that I wasn't sure whether the right compiler was used. Looking at the generated ALI file there was the V "GNAT Lib v4.9" tag that identifies the new compiler.

Next step is to perform a similar upgrade on NetBSD...

To add a comment, you must be connected. Login to add a comment

Fixing the blank screen on Ubuntu 10.04 with an ATI Radeon HD5450 after a distribution upgrade

By stephane.carrez

After upgrading my Ubuntu desktop with sudo apt-get upgrade, the X11 server was unable to start. Indeed, the AMD Catalyst driver was made unusable due to a missing symbol.

If this happens to you, check the file /var/log/kdm.log and if you see some error such as:

/usr/bin/X: symbol lookup error: /usr/lib/xorg/modules/drivers/fglrx_drv.so: undefined symbol: GlxInitVisuals2D
xinit /etc/gdm/failsafeXinit /etc/X11/xorg.conf.failsafe -- /usr/bin/X  -br -once -config /etc/X11/xorg.conf.failsafe -logfil
e /var/log/Xorg.failsafe.log

Then you have to re-install the proprietary AMD Catalyst driver (AMD just released a new driver yesterday).

After re-installation and a reboot, the dual screen configuration was running again. To configure the dual screen, it may be necessary to launch the AMD Catalyst Control Center with:

$ sudo amdcccle

Check out my xorg.conf file in case of problem.

To add a comment, you must be connected. Login to add a comment

Fixing the setError and hasError migration issue in Symfony 1.2

By stephane.carrez 1 comment

Foreword on error management in the controller and the view

The controller verifies the form parameters and it can check some error message. For this, Symfony 1.0 was providing the setError method that you use as follows:

$this->getRequest()->setError('username',
  "Sorry, usernames may contain only letters... and dashes.");

Then, in the view template file, you would use the form_error helper to check and report the error message.

<div class="username">
  <label for="username">User name: </label>
  <div class="content">
  <?php echo form_error('username') ?>
  <?php echo input_tag('username') ?>
</div>

The goal is to keep the controller and the view as simple as possible by using the same mechanisms. Here is how in two steps.

Step 1: Provide your own sfWebRequest

First, we override the sfWebRequest to implement the missing operations and we use the setAttribute method to associate the message with the error field. To avoid conflicts with other attributes, the error fields are prefixed with error_.

class myRequest extends sfWebRequest {
    public function hasError($name) {
        return $this->getAttribute("error_" . $name) != null;
    }
    public function setError($name, $msg) {
        $this->setAttribute("error_" . $name, $msg);
    }
    public function getError($name) {
        return $this->getAttribute("error_" . $name);
    }
}

Step 2: Update factories.yml

Now we have to tell Symfony to use our own request class:

all:
  request:
    class: myRequest

Then, clear the symfony cache by running the command:

$ symfony cc

Conclusion

The fix is really simple and if you find other methods that you use and have been removed (hasErrors, getErrors, ...) you just have to add them to you request class!

1 comment
To add a comment, you must be connected. Login to add a comment