Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I'm not happy with our build environment for our Linux based (Ubuntu 10.04) equipment. It is embedded software we are developing. What I would like is to have the optimal mix of these wishes:

  • Use proven tools and libraries
  • Be able to develop on both Linux and Windows
    • Ideally: use the same tooling on both platforms
  • Have a fast development cycles, especially on Windows

Note that paying for good stuff is definitely an option. Note also that C++ and Linux are the only two hard requirements, everything else is open for debate.

We currently use Boost and STL libraries for obtaining as much platform independence as possible. CodeBlocks is our cross-platform IDE and we use the gcc tool-chain (compiler, linker, debugger, not make). All are excellent open source projects but they have their limitations.

Biggest problems with the current environment:

  1. Compared with MS Visual C++, I feel gcc is very slow. A lot of time is spent compiling and especially linking. gcc's pre-compiled header support gives you no way near the same performance gain as with VC and with boost you really need it. Also, statically linking a few boost libraries takes forever. (Would using dynamic linking change much?)
  2. CodeBlocks has no support for what in VC are property files. This makes it difficult to enforce that build options are the same for all projects in the workspace.
  3. Related to build speed: CodeBlocks has no "compile this project only" support like VC has. When changing a single source file, CodeBlocks spends too much time checking for the need to compile files I know haven't changed.

Some of my own thoughts so far:

  • Biggest issue is having a fast, reliable compiler and linker on all platforms we develop on. If this is solved what about doing development on multiple platforms? Are Intel C++ compilers an option (we don't really need the performance optimization of those compilers)? Should we consider doing cross compilation?
  • Should we use a make based build? It seems a solution when it proves difficult to use the same IDE/build tooling on windows and Linux. I find make difficult so that is holding me back.
  • Is there a single product of equivalent maturity as Visual Studio (IDE and tool chain) available for Windows and Linux? Or for that matter, for Linux only?
  • How much simpler would life be if we decided develop only on Linux? Right now we all use Windows as it is supported by IT, our non-development software is all windows and we have limited Linux expertise in our company.

Your thoughts please.

share|improve this question

closed as off-topic by gnat, MichaelT, Dan Pichelman, GlenH7, Jonathan Eunice Dec 10 at 19:09

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions asking us to recommend a tool, library or favorite off-site resource are off-topic for Programmers as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it." – gnat, MichaelT, Dan Pichelman, GlenH7, Jonathan Eunice
If this question can be reworded to fit the rules in the help center, please edit the question.

2 Answers 2

I've heard the "best" IDE for C++ dev on Linux is Netbeans. Of course, Code:Blocks is open source, so you could see what its doing when deciding what to compile and fix it :) There's no open bugs about speed that I could seein their bugtracker.

Compilation: you can speed this up with makefiles, but I would assume (ha!) that Code::Blocks uses makefles under the covers. Certainly, I'd expect that you have a problem with your setup, and a bit of investigation is in order. If not, splitting your environment up into libraries and compiling them separately would benefit you.

I'm not sure why you think the GCC pch is so bad. Visual Studio works by comping everything referenced by stdafx.h into a pch file, so why don't you organise yuor code the same way - build a 'stdafx.h' file that includes all your other headers and, with the -x flag, let it build into a precompiled header. It should be very fast then.

Project files: don't you have 'workspace' files that have all the details in them. If so, surely updating properties across projects is a really simple task of updating these files in notepad! I sometimes do this for visual studio .vcproj files - edit many of them using notepad (or winmerge) to apply a project setting to multiple project files when clicking my way through property dialogs would be incredibly time consuming and tedious.

Make: make is really easy. So much so that your VS project files are (now) an xml-based representation of makefiles. Most makefiles simply specify the compiler options to use, and then have a section saying "turn all .cpp into .o files" with a line that then says which .o files to link together to make the app. Real easy, spend 10 minutes figuring it out and it'll be worth it. If you prefer not to use makefiles, try something like Ant.

You'll find that gcc is quite a good compiler, often generating code that is faster than VC++! Switching to Intel's compiler (another good choice) would still leave you with requiring an IDE, unless you like Eclipse which it comes with.

If you have Windows and write code for Windows, and you have more experience with Windows and VS, then why aren't you just using VS entirely? Cross compilation is an option, but if you create some makefiles and a build server, then you could have a linux box compile the code automatically for you while you develop of Windows. You'd still have to test and understand the cross-platform nature of your code, but if you know what you're doing then you wouldn't really need to develop on Linux. (mid you, you could do the opposite and build windows binaries automatically and do all your dev on Linux). I recommend Hudson for the build server, really easy to set up and get running.

share|improve this answer
    
The reason why I think GCC is not great with precompiled header files is from personal experience. With VC++ I included boost's shared pointer and threading support. This added 6 (or even 8?) seconds to the compilation per file. When I added those boost libraries to the stdafx.h, the compilation per file went back to the old compilation time of about a second or less (visual observation). Granted, with GCC I worked with a somewhat different set of boost include files but the difference between with and without PCH was like going back from 8 to 6 seconds. I'll try the -x option though. :) –  Mark Jul 26 '11 at 21:38
    
why do you think using make would speed things up? Every build tool does the same thing: have a bunch of settings and rules, see if files are present, or require an update, then create or update and do all of this in the right order. Why should make be faster than for instance CodeBlocks? –  Mark Jul 26 '11 at 21:52
    
And of course: thanks for taking the time to answer this question! –  Mark Jul 26 '11 at 21:53

You could use MinGW to get the same tools you use in the Linux/Unix environment into the windows environment. You could also use cygwin on windows to accomplish the same. I would write my own makefiles and use gcc (but it looks like you don't like gcc). I'm not sure of a better, free alternative to gcc. Personally, I would just use VIM or Emacs, GDB and use these tools on all environments (or learn to love Code::Blocks).

The idea with *nix and C development is that the whole environment is your build/development environment... windows, not so much.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.