Ogre3D First Attempts

Today I started experimenting with Ogre3D.

Downloaded the source code:

$sudo apt-get install mercurial
$hg clone http://bitbucket.org/sinbad/ogre/ -u v1-7

Followed the included docs to build:

$sudo apt-get install cmake
$sudo apt-get install libfreetype6-dev libboost-date-time-dev libboost-thread-dev nvidia-cg-toolkit libfreeimage-dev zlib1g-dev libzzip-dev libois-dev libcppunit-dev doxygen libxt-dev libxaw7-dev libxxf86vm-dev libxrandr-dev libglu-dev

To my surprise, one of the dependencies was a complete tex-system.
Used cmake-gui with as build directory a separate directory. Chose to build everything, also the samples and tests, but not static. Generated all the scripts and (in the build-dir):

$make
$make install

Then in

/path/to/builddirectory/bin/Samples

I executed the SampleBrowser, with worked perfectly.
Then I started the tutorials, setting up a build system with autotools and creating the first example. It did compile, but on running an error about not finding a library was thrown, which I solved with:

sudo ldconfig /usr/local/lib

since the shared library _was_ located there.d
I copied resources.cfg and plugins.cfg from the Ogre3D samples build directory to the tutorial directory and looked if the contents were ok.
The first example ran fine.

Eminent 4544 Ubuntu 11.04 No Connection (RT2501/RT2573)

I saw the networks, but connecting was not possible.

After:

$ sudo iwconfig wlan0 power off

i could.

So I

$sudo gedit /etc/rc.local

and added

iwconfig wlan0 power off

.

Done. Thx to ebrato in this post.

Linux 3D Graphics Programming Compilation Problems

I am reading the book “Linux 3D Graphics Programming” by Norman Lin. The source code can be found on sourceforge (l3d). When trying to compile the code provide with the book I stumble ypon some compilation problems. The first big compilation is the following:

$cd l3d/source/app/lib
$make -f makeall.lnx

I got an error about g++-2.95 cannot be found, which is logical, since I have a newer version. The parameters are set in l3d/Makefile.vars. Changing any occurence of “g++-2.95″ to “g++” solved this problem.
Now I get a lot of the following kind of errors:

../../../../../../../../source/app/lib/dynamics/plugins/pyramid/pyramid.cc:36:3: error: extra qualification ‘l3d_plugin_pyramid::’ on member ‘l3d_plugin_pyramid’
make[4]: *** [pyramid.o] Error 1

Errors of this kind are solved by changing the particular line in the particular file:

 l3d_plugin_pyramid::~l3d_plugin_pyramid(void) {

becomes

 ~l3d_plugin_pyramid(void) {

Another error:

/usr/bin/ld: cannot find -lXmu
collect2: ld returned 1 exit status
make[4]: *** [pyramid.so] Error 1

Easily solved by:

$sudo apt-get install libxmu-dev libxmu6

Another error about not recognizing the option m486, forget to copy the error. Also due to newer versions, nicely solved by:

$find ./ -type f -exec sed -i 's/m486/mtune=i486/' {} \;

Then an error I ran into before:

vidinfo.cc: In function ‘int main(int, char**)’:
vidinfo.cc:41:12: error: ‘exit’ was not declared in this scope
vidinfo.cc:57:37: warning: format not a string literal and no format arguments
vidinfo.cc:188:32: error: ‘assert’ was not declared in this scope
make[1]: *** [vidinfo.o] Error 1

This is solved by putting this in the file:

#include

Next error:

vidinfo.cc:189:32: error: ‘assert’ was not declared in this scope
make[1]: *** [vidinfo.o] Error 1
make[1]: Leaving directory `/home/mrdropd/linux_3d_programming/l3d/source/utils/vidinfo'
make: *** [all] Error 2

Solved by adding to the file:

#include

Finally it compiles :-)

Disable one of two built in Wifi cards Ubuntu.

$sudo lshw -C network
$sudo lsmod

shows us that the driver to blacklist is rt73usb.

Then add

blacklist rt73usb

to /etc/modprobe.d/blacklist.

ELF Format Article

This is a very good introduction to the ELF object file format:

http://www.linuxjournal.com/article/1059

Tagged

ATNGW100 Hello World

First install the (latest) toolchain.
Had some dependency problems, installed these first:


http://no.archive.ubuntu.com/ubuntu/pool/main/b/boost/libboost-date-time1.34.1_1.34.1-11ubuntu1_i386.deb

http://no.archive.ubuntu.com/ubuntu/pool/main/b/boost/libboost-filesystem1.34.1_1.34.1-11ubuntu1_i386.deb

http://no.archive.ubuntu.com/ubuntu/pool/main/b/boost1.38/libboost-filesystem1.38.0_1.38.0-6ubuntu6_i386.deb

http://no.archive.ubuntu.com/ubuntu/pool/main/b/boost1.38/libboost-system1.38.0_1.38.0-6ubuntu6_i386.deb

http://no.archive.ubuntu.com/ubuntu/pool/main/b/boost/libboost-thread1.34.1_1.34.1-11ubuntu1_i386.deb

http://no.archive.ubuntu.com/ubuntu/pool/main/b/boost1.38/libboost-thread1.38.0_1.38.0-6ubuntu6_i386.deb

http://cz.archive.ubuntu.com/ubuntu/pool/universe/x/xerces27/libxerces27_2.7.0-5_i386.deb

http://security.ubuntu.com/ubuntu/pool/main/i/icu/libicu38_3.8-6ubuntu0.2_i386.deb

I have a dirty Ubuntu now, but there was no other way. :-(

Then i downloaded the latest avr32 studio.

Edited Project->Properties->C/C++ Build->Settings-> AVR32/GNU g++ Linker-> libraries to include stdc++ in /usr/lib/gcc/avr32/4.3.2. This includes the static library in the binary that will be build. Necessary because there’s no dynamic libs on the board (resources!). If you don’t change this option, it wil compile with dynamic libs and it won’t run on the device.

AVR32 Studio doesn’t build my Hello World program with the following error:

Internal Builder: Cannot run program "avr32-linux-g++": Unknown reason
Build error occurred, build is stopped

The avr32-linux-g++ does not exist. I had to download the buildroot from http://www.atmel.no/buildroot/ to build the tool chain which includes this binary. I chose the 2.2.1 release to have working drivers for abdac en ac97. This may be handy in my future experiments.
Should be easy with:

$make atngw100
$make source
$make

Got very strange errors, but made sure there were no space in the path to the directory I’m in and now I’m getting further.

During compilation I got the following error:

scripts/unifdef.c:209: error: conflicting types for 'getline'
/usr/include/stdio.h:653: note: previous declaration of 'getline' was
here

I renamed all occurences of ‘getline’ in unifdef.c to ‘parseline’ and the compilation gets beyond this point. This error exists because the next version of glibc changes the default _POSIX_C_SOURCE level, which exposes getline() from stdio.h.

Following error: avr32_linux_user_guide_2.0.0.tar.gz not found.
Downloaded it from:


http://www.atmel.no/buildroot/source/mirror/avr32_linux_user_guide_2.0.0.tar.gz

and put it in the right dir.

Got an error while building Samba. Disabled it with make menuconfig, because I won’t use Samba in this context. Pragmatic thinking!

Another error:

/buildroot-avr32-v2.2.1/build_avr32/makedevs/makedevs.c: In function main:
/buildroot-avr32-v2.2.1/build_avr32/makedevs/makedevs.c:531: error: ignoring return value of system, declared with attribute warn_unused_result

and the solution is (found it somewhere else):
change line 531 to
return system(“/bin/sync”);

The build is complete now!

I added the directory that contains avr32-linux-g++ to Window->Preferences->C/C++->Environment in a PATH variable.

I’m trying to build this program for the ngw100 target:

#include
#include 

int main()
{
	printf("Hello World!\n");
	return 0;
}

I got this error:

In function
> `__gnu_cxx::__verbose_terminate_handler()':
> ../../../../../gcc-4.1.1/libstdc++-v3/libsupc++/vterminate.cc:89:
> undefined reference to `_impure_ptr'
> make: *** [hello] Error 1

I configured the linker to link to the libs that were created with buildroot and it worked. Don’t forget to tick the option ‘static linking’, otherwise it will link with the dynamic libstdc++ library, which doesn’t work on the device.

It works perfectly now! A lot of work for a little Hello World program, but I’m happy with the result.

ATNGW100 Boot Message

I connected the network gateway to the serial port of my computer, started microcom and powered up the device. This is the output in the factory configuration untill the prompt:

U-Boot 1.1.4-at0 (Jan  3 2007 - 10:30:09) 

U-Boot code: 00000000 -> 000144f7  data: 24000000 -> 24002d80
SDRAM: 32 MB at address 0x10000000
Testing SDRAM...OK
malloc: Using memory from 0x11fc0000 to 0x12000000
Flash:  8 MB at address 0x00000000
DRAM Configuration:
Bank #0: 10000000 32 MB
In:    serial
Out:   serial
Err:   serial
Net:   macb0, macb1
Press SPACE to abort autoboot in 1 seconds
### JFFS2 loading 'uImage' to 0x10200000
Scanning JFFS2 FS: ....... done.
### JFFS2 load complete: 912671 bytes loaded to 0x10200000
## Booting image at 10200000 ...
   Image Name:   Linux-2.6.18-atngw
   Image Type:   AVR32 Linux Kernel Image (gzip compressed)
   Data Size:    912607 Bytes = 891.2 kB
   Load Address: 10000000
   Entry Point:  90000000
   Verifying Checksum ... OK
   Uncompressing Kernel Image ... OK

Starting kernel at 90000000 (params at 11fc0040)...

pdc pdc.0: Atmel Peripheral DMA Controller enabled
EIM: External Interrupt Module at 0xfff00000, IRQ 19
EIM: Handling 4 external IRQs, starting with IRQ 64
smc smc.0: Atmel Static Memory Controller at 0xfff03400
pio0: Atmel Port Multiplexer at 0xffe02800 (irq 13)
pio0: Handling 32 external IRQs, starting with IRQ 96
pio1: Atmel Port Multiplexer at 0xffe02c00 (irq 14)
pio1: Handling 32 external IRQs, starting with IRQ 128
pio2: Atmel Port Multiplexer at 0xffe03000 (irq 15)
pio2: Handling 32 external IRQs, starting with IRQ 160
pio3: Atmel Port Multiplexer at 0xffe03400 (irq 16)
pio3: Handling 32 external IRQs, starting with IRQ 192
pio4: Atmel Port Multiplexer at 0xffe03800 (irq 17)
pio4: Handling 32 external IRQs, starting with IRQ 224
dmac0: DesignWare DMA controller at 0xff200000 irq 2
NET: Registered protocol family 2
IP route cache hash table entries: 256 (order: -2, 1024 bytes)
TCP established hash table entries: 1024 (order: 0, 4096 bytes)
TCP bind hash table entries: 512 (order: -1, 2048 bytes)
TCP: Hash tables configured (established 1024 bind 512)
TCP reno registered
JFFS2 version 2.2. (NAND) (C) 2001-2006 Red Hat, Inc.
io scheduler noop registered
io scheduler cfq registered (default)
Serial: Atmel USART3 driver
usart.1: ttyS0 at MMIO 0xffe01000 (irq = 7) is a USART3
loop: loaded (max 8 devices)
eth0: Atmel MACB at 0xfff01800 irq 25 (00:04:25:1c:75:fc)
eth1: Atmel MACB at 0xfff01c00 irq 26 (00:04:25:1c:75:fd)
physmap platform flash device: 00800000 at 00000000
physmap-flash.0: Found 1 x16 devices at 0x0 in 16-bit bank
 Amd/Fujitsu Extended Query Table at 0x0041
number of CFI chips: 1
cfi_cmdset_0002: Disabling erase-suspend-program due to code brokenness.
cmdlinepart partition parsing not available
RedBoot partition parsing not available
Using physmap partition information
Creating 3 MTD partitions on "physmap-flash.0":
0x00000000-0x00020000 : "u-boot"
0x00020000-0x007f0000 : "root"
0x007f0000-0x00800000 : "env"
atmel_spi atmel_spi.0: Atmel SPI Controller at 0xffe00000 (irq 3)
mtd_dataflash spi0.0: AT45DB642x (8448 KBytes)
ip_conntrack version 2.4 (256 buckets, 2048 max) - 204 bytes per conntrack
ip_tables: (C) 2000-2006 Netfilter Core Team
TCP bic registered
NET: Registered protocol family 1
NET: Registered protocol family 17
Time: avr32 clocksource has been installed.
VFS: Mounted root (jffs2 filesystem).
Freeing init memory: 56K (90000000 - 9000e000)
init started:  BusyBox v1.4.2 (2007-04-17 15:34:55 CEST) multi-call binary
 * mounting virtual filesystems: /proc /sys /dev /dev/pts /config /tmp /var/run /var/lib/samba /var/log
 * set mdev hotplug ...          [ OK ]
 * mdev ...                      [ OK ]
 * setting hostname ...          'ngw.example.net'
 * network loopback ...          [ OK ]
 * starting syslogd ...          [ OK ]
 * log messages to syslog ...    [ OK ]
 * starting klogd ...            [ OK ]
 * probing modules ...           vfat loaded, mmc_block loaded, atmel-mci loaded, [ OK ]
 * mounting filesystems:         /usr
 * setup eth0 ...                [ STATIC ] (10.11.12.1)
 * setup eth1 ...                [ OK ]
 * network ...                   [ OK ]
 * starting telnetd ...          [ OK ]
 * enable ipv4 forwarding ...    [ OK ]
 * iptables postrouting ...      [ OK ]
 * iptables incoming trafic ...  [ OK ]
 * iptables outgoung trafic ...  [ OK ]
 * starting dnsmasq ...          [ OK ]
 * running ntpdate ...           [ FAILED ]
 * starting dropbear ...         [ OK ]
 * starting inted ...            [ OK ]
 * starting nmbd ...             [ OK ]
 * starting smbd ...             [ OK ]
 * starting winbindd ...         [ OK ]
 * starting httpd ...            [ OK ]
 * get board type for GPIO ...   'NGW'
 * setup GPIO boot LED ...       [ OK ]
 * setup GPIO LED A ...          [ OK ]
 * setup GPIO LED B ...          [ OK ]

Network Gateway ready

BusyBox v1.4.2 (2007-04-17 15:34:55 CEST) Built-in shell (ash)
Enter 'help' for a list of built-in commands.

~ #

*.flv to *.mp3

To extract the audio from a flv video file (downloaded from youtube for example):


$sudo apt-get install lame ffmpeg

$ffmpeg -i filename.flv -acodec libmp3lame -ac 2 -ab 128 -vn -y filename.mp3

Ping A Range Of IPs

$sudo apt-get install fping
$sudo fping -s -g 192.168.0.1 192.168.0.100 -r 1

Played: Turok

This was the first game I played in a very long time and for me it was ok, despite the bad reviews on the net.
Graphically something bothered me though: the blood on the dinosaurs was all shiny and not really blending in with the dinosaur. It looked more like a plash of glue than real blood.
Maybe the story was a little flat. Well, there is not much of a story now I think about it.
The surroundings are also flat: sometimes you’re outside in the jungle, sometimes you’re inside in this industrial kind of complexes. There’s nothing in between.
I liked fighting the final t-rex. Took me a while though.

Follow

Get every new post delivered to your Inbox.