Error Translator

I’m pleased to introduce you the www.error-translator.com www.errors.someting.pl. It’s my project to create a base of error messages from various sources, explanations for these errors and solutions for them. Something like error dictionary.

How many times did you got error message from for example compiler and didn’t know what does it mean? The project aims to help in such situates.

I hope you’ll like that and contribute in explaining more and more error messages.

errors.something.pl

Posted on August 4, 2009 at 1:52 am by Lubiluk · Permalink · Leave a comment
In: Uncategorized

HowTo: Setup PhysX SDK on Linux

PhysXbyNV_Black_200Nvidia PhysX can be run under Linux, but unfortunately there is not documentation how to do it. Binaries are available (only 32bit) but that’s all what is given to Linux users. I will describe step by step how to setup and begin development with PhysX in Ubuntu with use of Eclipse CDT. Users of other distributions and editors will find here useful informations too.

Article covers installation of PhysX SDK 2.8.1 and compiling sample program on 64bit machine (Ubuntu x86_64). On 32bit systems it will require little less effort so I will mark the parts which can be omitted on that systems with “64bit:” prefix.

Installation

First thing to do is download PhysX package from this site:  http://developer.nvidia.com/object/physx_downloads.html
It looks like Nvidia doesn’t provide packages for linux any more (because of coming sdk 3, they say), but you can still find it on Internet by googling for: PhysX_2.8.1_SDK_CoreLinux_deb.tar.gz or PhysX_2.8.1_SDK_CoreLinux_rpm.tar.gz

When you have package ready, go to download directory, unpack and install all packages.  64bit users will need to do it from command line to force installation.

64bit:

sudo dpkg -i --force-architecture *.deb

Shared libraries are installed in version specific directory “/usr/lib/PhysX/v2.8.1/”, so we need to link them to “/usr/lib”.

sudo ln -s /usr/lib/PhysX/v2.8.1/libNxCharacter.so.1 /usr/lib/libNxCharacter.so.1
sudo ln -s /usr/lib/PhysX/v2.8.1/libNxCooking.so.1 /usr/lib/libNxCooking.so.1
sudo ln -s /usr/lib/PhysX/v2.8.1/libPhysXCore.so.1 /usr/lib/libPhysXCore.so.1

PhysX is now installed and we can try run some samples from Nvidia which are placed in “/usr/sbin/PhysX_Samples_2.8.1_FC4/Bin/linux/”. Note that not all samples will work. I don’t know why they didn’t pay attention to make sure everything works. Source code for samples are not available on Linux too. Sample that should work is for example SampleBoxes.

/usr/sbin/PhysX_Samples_2.8.1_FC4/Bin/linux/SampleBoxes

Compile own project

So, now we have working PhysX, let’s try to compile something with use of it. I will describe how to do it with Eclipse CDT.

Before start, on 64bit machines ensure that you have 32bit gcc extensions installed:

64bit:

sudo apt-get install g++-multilib lib32stdc++6

Create a new C++ Empty Project and go to its properties. Go to “Settings” in “C/C++ Build” section. We will configure g++ flags to compile project properly. In “GCC C++ Compiler” in “Preprocessor” add these “Definied symbols”:

LINUX, NX32, CORELIB, NX_DISABLE_FLUIDS

(Last one is needed to make physics simulation work. I think it’s some kind of bug in PhysX but I’m not sure why it happens. I’ve found solution for it on some Italian or Spain site so I could not understand what it was about.)

In “Directories”  enter these paths:

/usr/include/PhysX/v2.8.1/SDKs/Physics/include

/usr/include/PhysX/v2.8.1/LowLevel/API/include

/usr/include/PhysX/v2.8.1/SDKs/Cooking/include

/usr/include/PhysX/v2.8.1/SDKs/PhysXLoader/include

/usr/include/PhysX/v2.8.1/LowLevel/hlcommon/include

/usr/include/PhysX/v2.8.1/SDKs/Foundation/include

/usr/include/PhysX/v2.8.1/SDKs/NxCharacter/include

64bit: In “Miscellaneous” add flag to “Other flags”

64bit:

-m32

This flag tells compiler to make 32 bit binary instead of 64.

Now go to “GCC C++ Linker” and in “Libraries” add libs:

dl, pthread, PhysXLoader

GLU, GL, glut

Second line of libraries listed above are for OpenGL and GLUT, you’ll need them if you’re going to compile source code that I will list below.

64bit: In “Library search path” should be:

/usr/lib32

64bit: Same as in compiler section add flag in “Miscellaneous”

64bit:

-m32

Ok, enviroment set up properly, let’s compile something and see how it works. Because there is no sample code from Nvidia to try I’ve prepaired one taken from SDK for Windows and modified it a little for easier compilation under Linux. Here are source files: SampleBoxes.tar

And here is entire CTD project with proper configuration: SampleBoxesCDT.tar

Compile, run, enjoy.

You may compile these sources from command line with:

g++ -DNX_DISABLE_FLUIDS -DCORELIB -DNX32 -DLINUX -I/usr/include/PhysX/v2.8.1/SDKs/Physics/include -I"" -I/usr/include/PhysX/v2.8.1/LowLevel/API/include -I/usr/include/PhysX/v2.8.1/SDKs/Cooking/include -I/usr/include/PhysX/v2.8.1/SDKs/PhysXLoader/include -I/usr/include/PhysX/v2.8.1/LowLevel/hlcommon/include -I/usr/include/PhysX/v2.8.1/SDKs/Foundation/include -I/usr/include/PhysX/v2.8.1/SDKs/NxCharacter/include -O3 -Wall -c -fmessage-length=0 -m32 -o"SampleBoxes.o" "./SampleBoxes.cpp"
g++ -L/usr/lib32 -m32 -o"physx_test"  ./SampleBoxes.o   -lPhysXLoader -lGLU -lGL -lglut -ldl -lpthread

Documentation

Last, very useful thing to do is install PhysX SDK Documentation viewer. The documentation files in PhysX packages for Linux are taken from Windows literally, so they are in Microsoft’s “.chm” extension and cover installation and setup under Windows, but still it’s very useful. PhysX API is platform independ. In Ubuntu there is a nice “.chm” file viewer “gnochm”. Documentation main file is “/usr/share/doc/libphysx-2.8.1/PhysXDocumentation.chm”

Maybe some day we will get drivers from Nvidia that run PhysX on GPU and better support for Linux. In near future there will be release of 3.0 PhysX SDK. It will support 64bit architectures natively.

Posted on June 27, 2009 at 2:16 am by Lubiluk · Permalink · 7 Comments
In: Uncategorized · Tagged with: , , ,

Why linux?

linux_logoThat’s a very common question and later you may notice that i use Linux to very most things. I would like to cover this subject to view some very nice advantages of this OS. I will not denigrate other (commercial especially) operating systems, that’s not the point. I hope to present you Linux as a promising and useful OS.

So… why to use Linux?

First of all – because it’s free (as in freedom).  I hear you saying “Oh, that’s all?!”, but think about opportunities that gives you free operating system. You are not dependent of any company standing behind it, you can do whatever you want with your software and hardware, it’s yours. End users, especially desktop computer users may not notice this as a big deal, but for developers and huge software consumers it is really blessing to not have to be dependent of anybody, especially big companies.

In my opinion the most popular platform that runs various software should be the free platform (opposite to the  current situation). Thanks to this progress in software development and computer science would be much faster than it is on closed platforms. That’s because when everybody works on open platform then everybody cares of it and generally pushes it toward.

Imagine situation that you want to write your own application. Fine, you can do it for every platform that gives you compiler, but to run your own program on closed platforms first you have to buy it. The more programs you have for this platform the more dependent of company that distributes it you become. That’s of course great situation for this company, not for you. The situation touches not only developers but also consumers that use software dedicated for commercial platforms.

That was economical part of subject, now take a look at technical issues. Closed platforms are unchangeable, the only way to improve it is ask it’s producer for features or fixes and wait if he’s going to make your wishes come true. When you work on free platform like Linux you can do improvements by yourself with no waiting or asking anybody, its your platform. You don’t have to pay someone to develop your software. You can even distribute entire operating system with your software if it’s needed.

Ok, that could be said about every free operating system. The thing that makes me pick Linux from other open OSes is it’s popularity and availability. In fact, Linux is the most developed free operating system. Of course there are other good OSes like FreeBSD or OpenSolaris, but these are popular for servers, on desktop there is no good hardware support. Linux works on almost every architecture and supports most hardware. I has support (not big but always something) from hardware producers like Intel or Nvidia. It runs on servers, desktop computers, laptops, mobile devices and many other devices. Linux make use of every processor if it’s possible. That’s why it is good candidate to make some kind of standard of it. Worth to say is that Linux is compatible with other POSIX compliant operating systems so usually it’s very easy to port programs from Linux to other free OSes and vice versa.

Finally thing that concerns end users. Sometimes you may hear phrases like “this will be year of Linux on desktops”. Actually Linux got this level when it runs really well on popular desktop computers and laptops. It runs well and offers plenty nice features for everybody, from programming tools through office programs to multimedia players. Beside this Linux distributions has great software package managers like APT in Debian or Ubuntu. After some time of using that tools you never want to go back to Windows style messy installers.  Linux is chasing Windows with useful software and often offers even better features. Everyday more software producers consider writing for this platform. The only thing that is needed to make it the finest operating system is popularity. So start to use it and show others how cool can it be :) .

I had a dream

Imagine how cool it could be if Linux was not only very popular on desktops so you have all useful programs like Photoshop on it but also was used as a gaming platform.  Open platforms works in this way that companies which are developing for it and using it are also developing the parts of the OS. So if open platform like Linux would be the most popular platform then it would be developed not only by one company like Microsoft but by all software and hardware  producers. I don’t mean that everybody will give his software for free. No, developers have to earn on their software but it is their interest to make the OS a bit better all the time.

Posted on June 24, 2009 at 10:39 pm by Lubiluk · Permalink · Leave a comment
In: Uncategorized · Tagged with: 

Hello world!

I think the default wordpress title for this post is just fine.

Here I start this blog. I will write here some of my cogitations, tutorials and whatever will come to my mind to write here. Articles will cover software development and other subjects connected with computer science.

I hope you’ll find this useful. Comments and feedback would be appreciated.

Posted on June 11, 2009 at 1:55 am by Lubiluk · Permalink · Leave a comment
In: Uncategorized