Page 1 of 1
Programming on Ubuntu
Posted: Fri Apr 24, 2009 12:56 am
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

). 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
)
Re: Programming on Ubuntu
Posted: Fri Apr 24, 2009 1:08 am
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.
Re: Programming on Ubuntu
Posted: Fri Apr 24, 2009 1:22 am
by jacmoe
I always end up in bash when I'm in Ubuntu.

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).
If you enable backports and all the bleeding edge repositories, you will have a mean machine.
Re: Programming on Ubuntu
Posted: Fri Apr 24, 2009 3:07 am
by Moohasha
jacmoe wrote:I always end up in bash when I'm in Ubuntu.

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).
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!!

Re: Programming on Ubuntu
Posted: Fri Apr 24, 2009 3:11 am
by jacmoe
Moohasha wrote:Dude, I have no idea what you just said!!

Well, you're not alone.
Just do it.

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.

Re: Programming on Ubuntu
Posted: Fri Apr 24, 2009 3:14 am
by jacmoe
You'll love the new Ogre CMake build system, then: It's only two commands: ccmake ./ & make.

Re: Programming on Ubuntu
Posted: Fri Apr 24, 2009 10:05 pm
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?
Re: Programming on Ubuntu
Posted: Sun Apr 26, 2009 2:53 am
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
Re: Programming on Ubuntu
Posted: Mon Apr 27, 2009 7:20 am
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.
Re: Programming on Ubuntu
Posted: Thu Apr 30, 2009 12:54 am
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.

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.
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
Re: Programming on Ubuntu
Posted: Thu Apr 30, 2009 1:16 am
by Kencho
Nikki, you certainly love Linux!
Have nothing to add here. Moving to Linux as my development platform made me a happier person

(though I've been away from serious development for a looooong time now!)
Re: Programming on Ubuntu
Posted: Thu Apr 30, 2009 1:28 am
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.

Re: Programming on Ubuntu
Posted: Thu Apr 30, 2009 7:31 am
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.
Re: Programming on Ubuntu
Posted: Thu Apr 30, 2009 6:51 pm
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:-

Re: Programming on Ubuntu
Posted: Thu Apr 30, 2009 9:48 pm
by Kencho
That's the sexiest Vim I've ever seen

Re: Programming on Ubuntu
Posted: Thu Apr 30, 2009 10:28 pm
by jacmoe
Kencho wrote:That's the sexiest Vim I've ever seen

I really hate to say this, but Nikki almost won me over.

Re: Programming on Ubuntu
Posted: Thu Apr 30, 2009 10:28 pm
by jacmoe
Almost.

Re: Programming on Ubuntu
Posted: Fri May 01, 2009 2:12 pm
by nikki
jacmoe wrote:Almost.

Bah.
...
Wait. You mean you're not using vim already? Unbelievable.

Re: Programming on Ubuntu
Posted: Sat May 02, 2009 10:02 am
by Nauk
You certainly know how to advertise it Nikki, very tempting and seems to be quite productive too.
Re: Programming on Ubuntu
Posted: Wed May 06, 2009 6:37 am
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).
Re: Programming on Ubuntu
Posted: Wed May 06, 2009 2:55 pm
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.