Blender Hello World

I’m learning blender by taking the design course at here. This is the first exercise I did. I know it’s very basic :-) .

 

Image

 

CUDA Second Attempt

In a previous post on CUDA I ran a hello world-example, but it wasn’t running any code on the device (gpu) processor yet. When I tried to do that, I ran into several problems which led to installing the nvidia experimental driver. I have a nvidia geforce 555M and the driver simply doesn’t work. I recovered the original graphical configuration as described in the previous post. Then I installed the nvidia-current driver:

sudo apt-get install nvidia-current

Then I removed the ironhide packages and installed the bumblebee packages:

$sudo apt-get purge ironhide*
$sudo add-apt-repository ppa:mj-casalogic/bumblebee
$sudo usermod -a -G bumblebee $USER

Then I downloaded the CUDA SDK to try out some examples.

When compiling, I ran into errors like ‘undefined reference to `gluErrorString’, although glut was installed properly. This error was solved by chaning the order of $(RENDERCHECKGLLIB) and ${OPENGLLIB} when they occur on the same line in NVIDIA_GPU_Computing_SDK/C/common/common.mk and common_cudalib.mk. Some examples ran fine after compiling, but some complained about not finding libcuff. I did a simple find and added a file to /etc/ld.so.conf.d with the appropriate library directory.

All examples run fine now and I’m ready to start experimenting. Especially the oceansFFT example is nice.

Ubuntu Video Card Mayhem

I was experimenting with the “developer driver” form nVidia, needed for running CUDA programs. Black screen on reboot. Hell.

This is a way to restore the video configuration to it’s just-after-installation state:

$sudo apt-get purge nvidia*
$sudo rm /etc/X11/xorg.conf
$sudo apt-get install --reinstall xserver-xorg-core libgl1-mesa-glx:i386 libgl1-mesa-dri:i386 libgl1-mesa-glx:amd64 libgl1-mesa-dri:amd64
$sudo dpkg-reconfigure xserver-xorg
$sudo reboot

in the recovery root console.

CUDA Hello World

I started reading “CUDA By Example” by Sanders & Kandrot and got up to setting up the environment and running a hello world program.

I installed CUDA by downloading the toolkit here and running the file (as root user). I temporarily edited the PATH and LD_LIBRARY_PATH variables (specific to a 64 bit computer):

$export PATH=$PATH:/usr/local/cuda/bin
$export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64:/usr/local/cuda/lib

and added the example source files of the book in the compiling directory.

When compiling with the following command:

$nvcc hello_world.cu

I stumbled upon the following error:

unsupported GNU version! gcc 4.6 and up are not supported!

which was solved by installing the previous gcc version and creating a softlink to it in the bin-directory of CUDA:

$sudo apt-get install gcc-4.5
$sudo ln -s /usr/bin/gcc-4.5 /usr/local/cuda/bin/gcc

Compiling went fine now and running the program prints “Hello World” as expected.

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.

Follow

Get every new post delivered to your Inbox.