Programming on Ubuntu

A place for Ogre users to discuss non-Ogre subjects with friends from the community.
Post Reply
User avatar
Moohasha
Gnoll
Posts: 672
Joined: Fri Dec 07, 2007 7:37 pm
x 8

Programming on Ubuntu

Post by Moohasha »

Note, I'm posting this here instead of in the Help forum because it's not really looking for help with Ogre as much as with Linux

I've decided to try Ubuntu, now that I've learned I can possibly play WoW on it using Wine (the reason I've never bothered before was because I didn't think I could play any of my games :wink: ). Of course, I still want to program, but I have no experience AT ALL programming in Linux, so I'd like some advice, especially in regard to using Ogre:

* Is there a pre-built SDK that will work for Ubuntu, or do I need to compile it myself? The only binaries I saw were for .NET 2008, 2005, 2003, Mac, and CodeBlocks + MinGW.
* I was planning on using Eclipse for my IDE. Some coworkers use it instead of .NET at work (mostly for Java, but also for C++), so I've seen it and it looks nice, and I figured I could get help from coworkers if I can't figure something out. In regard to my first question, is there a SDK that will work for Eclipse? I know that in Windows the release for one version of .NET wouldn't work for another. Not sure if it's the same with for Linux.
* Can anyone give me some general Linux-programming advice? What to expect that's going to be different (either obviously or not so obviously)?
* How do you pronounce "Linux"? (just kidding :wink:)
Black holes are where God divided by 0
User avatar
xavier
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 9481
Joined: Fri Feb 18, 2005 2:03 am
Location: Dublin, CA, US
x 22

Re: Programming on Ubuntu

Post by xavier »

Moohasha wrote: * Is there a pre-built SDK that will work for Ubuntu, or do I need to compile it myself? The only binaries I saw were for .NET 2008, 2005, 2003, Mac, and CodeBlocks + MinGW.
While there are packages for several distros, I highly recommend that you just build from source, as there is no telling how well maintained or how up-to-date those packages might be.
* I was planning on using Eclipse for my IDE. Some coworkers use it instead of .NET at work (mostly for Java, but also for C++), so I've seen it and it looks nice, and I figured I could get help from coworkers if I can't figure something out. In regard to my first question, is there a SDK that will work for Eclipse? I know that in Windows the release for one version of .NET wouldn't work for another. Not sure if it's the same with for Linux.
As mentioned above, there are packages, which are basically headers and libs (more or less what an SDK is), but you are better off just building Ogre from source on Linux.

I would recommend Code::Blocks, since it already has support in Ogre; you are going to find it rough going with Eclipse or KDevelop.
* Can anyone give me some general Linux-programming advice? What to expect that's going to be different (either obviously or not so obviously)?
It's just an operating system. It does the same things that Windows does. For the most part, get used to working with autoconf and configure scripts (or on Ubuntu, apt-get for package management), and I highly recommend getting used to command-line interaction; you will often find it easier than trying to navigate some of the UIs that people come up with (because there really is no standard...because there are so many to choose from ;) ).

Beyond that, this is too vague a question to be able to answer properly.
Do you need help? What have you tried?

Image

Angels can fly because they take themselves lightly.
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: Programming on Ubuntu

Post by jacmoe »

I always end up in bash when I'm in Ubuntu. :wink:
Autotools are great - a lot easier than fighting with Code::Blocks workspaces and projects.
And a heck of a lot easier than trying to figure out KDevelop or Eclipse.
Just do .aclocal ./bootstrap ./configure make sudo make install sudo ldconfig, and enjoy.
In source we trust. I find it easier than hunting down deb's.
But I am growing to like CMake, so I am looking forward to when it goes stable. :)

About Ubuntu: It rocks. Because it gets updated more often than most distros. I like it.
And I've tried a lot of alternatives.
Even built several from scratch (Literally). :wink:

If you enable backports and all the bleeding edge repositories, you will have a mean machine.
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
User avatar
Moohasha
Gnoll
Posts: 672
Joined: Fri Dec 07, 2007 7:37 pm
x 8

Re: Programming on Ubuntu

Post by Moohasha »

jacmoe wrote:I always end up in bash when I'm in Ubuntu. :wink:
Autotools are great - a lot easier than fighting with Code::Blocks workspaces and projects.
And a heck of a lot easier than trying to figure out KDevelop or Eclipse.
Just do .aclocal ./bootstrap ./configure make sudo make install sudo ldconfig, and enjoy.
In source we trust. I find it easier than hunting down deb's.
But I am growing to like CMake, so I am looking forward to when it goes stable. :)

About Ubuntu: It rocks. Because it gets updated more often than most distros. I like it.
And I've tried a lot of alternatives.
Even built several from scratch (Literally). :wink:

If you enable backports and all the bleeding edge repositories, you will have a mean machine.
Dude, I have no idea what you just said!! :lol:
Black holes are where God divided by 0
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: Programming on Ubuntu

Post by jacmoe »

Moohasha wrote:Dude, I have no idea what you just said!! :lol:
Well, you're not alone.
Just do it. :D
That's just a series of innocent commands, one after another.
It is simpler than setting up a project in an IDE, trust me.

Besides: it makes you look cool. :wink:
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: Programming on Ubuntu

Post by jacmoe »

You'll love the new Ogre CMake build system, then: It's only two commands: ccmake ./ & make. :wink:
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
User avatar
Nauk
Gnoll
Posts: 653
Joined: Thu May 11, 2006 9:12 pm
Location: Bavaria
x 36
Contact:

Re: Programming on Ubuntu

Post by Nauk »

Using preconfigured projects is very easy and a real breeze even on MSYS, I am everytime impressed how flawless things work with ./configure & make, but how 'hard' is it to setup your own projects and dependencies?
hpesoj
Halfling
Posts: 99
Joined: Fri Dec 07, 2007 8:47 pm
Location: Bristol, UK

Re: Programming on Ubuntu

Post by hpesoj »

As others have said, using the usual "sh bootstrap", "./configure", "make", "sudo make install" (get used to typing "sudo" to administrator permissions) will get you everywhere with Linux.

apt-get is a godsend, with the graphical version "Synaptic Package Manager", being very useful sometimes. More often than not you will find any libraries you need with apt-get, though get used to downloading and compiling the source with aforementioned commands; however, sometimes software has a different build system in place, and you can usually find instructions in an "INSTALL" or "README" file (type "cat filename" at the terminal to print a file). I highly recommend using svn to download source where possible.

I have found that linking to be troublesome in Linux, especially when installing libraries manually. User-installed libraries are usually copied to /usr/local/lib, with /usr/local/include and /usr/local/bin for headers and binaries respectively. A useful command when your linker fails to find a library is "sudo ldconfig", which seems to rebuild info about libraries in standard locations. If this doesn't work, your library may lack executable status (search "chmod", also "chown").

Anyway, I'm sure you'll find this all out by yourself as I did. Stick at it, I find the conveniences of Linux as a development platform far outweigh the negatives.

Joe
Image
User avatar
volca
Gnome
Posts: 393
Joined: Thu Dec 08, 2005 9:57 pm
x 1
Contact:

Re: Programming on Ubuntu

Post by volca »

Eclipse works very well on Ubuntu. The CDK packed with 8.10 is old though, so it's better to download and use the new version unpacked somewhere in your home directory. CMake supports Eclipse now, so you can use it to build project files (then just import the resulting project and you're done!).

A side note: If you'll be doing ogre installation from source, you should better unpack the ogre source code into some persistent directory so it does not get lost when you'd like to uninstall (many use /usr/src directory for these). Also you could want to run checkinstall instead of "make install" part, as it will help you with the removal of the package later on, among other things (it integrates better with apt and dpkg). Or wait for the new CMake version of Ogre build scripts, it could be able to build deb package via cpack.
Image
User avatar
nikki
Old One
Posts: 2730
Joined: Sat Sep 17, 2005 10:08 am
Location: San Francisco
x 13
Contact:

Re: Programming on Ubuntu

Post by nikki »

Believe me, I was a total Visual C++ Express guy, and just in a month I was using gvim + premake. You're gonna love gvim man, it's utter coolness. I do all my usual editing stuff in one command now. :roll: You have to get a really good config file, and some good plugins, and you're off.

And once you're done with the Ubuntu per-6-month-hell, come over to Arch Linux. 8)

Also, Ogre is as simple as 1) Get depends (all depends are in official Arch repos, or AUR), 2) svn co <ogre-url>, 3) mkdir build && cd build && cmake .. && make -j3 && sudo make install
User avatar
Kencho
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4011
Joined: Fri Sep 19, 2003 6:28 pm
Location: Burgos, Spain
x 2
Contact:

Re: Programming on Ubuntu

Post by Kencho »

Nikki, you certainly love Linux! :lol:

Have nothing to add here. Moving to Linux as my development platform made me a happier person :D (though I've been away from serious development for a looooong time now!)
Image
User avatar
nikki
Old One
Posts: 2730
Joined: Sat Sep 17, 2005 10:08 am
Location: San Francisco
x 13
Contact:

Re: Programming on Ubuntu

Post by nikki »

The best thing about Linux is that you can't waste your time playing games. I can only play TF2 at night when I boot into Windows. :lol:
User avatar
volca
Gnome
Posts: 393
Joined: Thu Dec 08, 2005 9:57 pm
x 1
Contact:

Re: Programming on Ubuntu

Post by volca »

Guys, as you talk about Linux as a development platform - maybe you'll be able to help me with one minor annoyance that's been bugging me for the start - gdb is used as a base for all graphical debuggers and it is too "aspiring" - when stepping it will trace all the inlined code from all the header files involved which makes it hard to walk through code. Does someone please know how to stop this behavior? I'd like it ignore the inlines from the standard libraries.
Image
User avatar
nikki
Old One
Posts: 2730
Joined: Sat Sep 17, 2005 10:08 am
Location: San Francisco
x 13
Contact:

Re: Programming on Ubuntu

Post by nikki »

If you just execute a 'next' command over such a line it should work fine.

Also, do try out cgdb. It's awesome if you're a vim addict. ;)

I'm placing a link to my .vimrc and .vim directory in case you guys want it. There's a lot of stuff there, including a file browser, code completion (you must make proprer tag files though, and use '--c++-kinds=+p --fields=+iaS --extra=+q -I --languages=c++' options with ctags), a cool colour scheme, some nice bindings for building etc. tags may seem a roundabout way of code completion, but in the long run I found it quite nice. VC intellisense often kept messing up, but omnicpp and ctags work good. I can also easily load up tags files whenever I want to with the ',t' binding I made. I put all my tags files in a common place ('~/Development/Tags' in the .vimrc I posted). Here they are:-
nikki-vim.tar.bz2

Here's what it looks like:-

Image
User avatar
Kencho
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4011
Joined: Fri Sep 19, 2003 6:28 pm
Location: Burgos, Spain
x 2
Contact:

Re: Programming on Ubuntu

Post by Kencho »

That's the sexiest Vim I've ever seen :D
Image
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: Programming on Ubuntu

Post by jacmoe »

Kencho wrote:That's the sexiest Vim I've ever seen :D
I really hate to say this, but Nikki almost won me over. :D
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: Programming on Ubuntu

Post by jacmoe »

Almost. :wink:
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
User avatar
nikki
Old One
Posts: 2730
Joined: Sat Sep 17, 2005 10:08 am
Location: San Francisco
x 13
Contact:

Re: Programming on Ubuntu

Post by nikki »

jacmoe wrote:Almost. :wink:
Bah.

...

Wait. You mean you're not using vim already? Unbelievable. :roll:
User avatar
Nauk
Gnoll
Posts: 653
Joined: Thu May 11, 2006 9:12 pm
Location: Bavaria
x 36
Contact:

Re: Programming on Ubuntu

Post by Nauk »

You certainly know how to advertise it Nikki, very tempting and seems to be quite productive too.
User avatar
volca
Gnome
Posts: 393
Joined: Thu Dec 08, 2005 9:57 pm
x 1
Contact:

Re: Programming on Ubuntu

Post by volca »

Very nice vim setup, Nikki! If only I was patient enough to learn all the specifics of vim - as "hjkl" to move cursor, etc. GVim is much better I suppose (I also tried cream and that was quite ordinary editor on a first look, which is a successful masking for a vim editor :) ).
I always fail to do the basic things - block copy, deleting empty line, etc., lose patience and skip vim in favor of nano (when editing configuration files, that is).
Image
User avatar
nikki
Old One
Posts: 2730
Joined: Sat Sep 17, 2005 10:08 am
Location: San Francisco
x 13
Contact:

Re: Programming on Ubuntu

Post by nikki »

volca wrote:I always fail to do the basic things - block copy, deleting empty line, etc., lose patience and skip vim in favor of nano (when editing configuration files, that is).
Block copy:-

yap -> yank a paragraph
yi{ -> yank in block (between braces) ({ .. })
ya{ -> yank a block (including braces) ({..})

Paste:-

p

Delete empty lines:

:g/^$/d

How the above works:
You must've noticed that many ':' (command-line) commands take in line numbers. Like, you can do :0,10d to delete from line 0 to line 10, or you can do a visual select and do :'<,'>d to delete the visual selection ('< stands for visual begin, and '> for visual end). Now, g/<stuff>/ just stands for 'find <stuff>'. So, you can use it in place of the line number. Something like :g/word/s/bla/blah/g would replace all occurences of 'bla' with 'blah' on lines containing 'word'.

g/^$/ just matches a line start followed by line end (which would be an empty line) and sends them to the next command, that is, the delete command in this case.
Post Reply