Slashdot Mirror


Competitive Cross-Platform Development?

Avalonia asks: "I work for a software company in the oil and gas exploration industry with a software development team of seven. Our software and development environment is cross-platform on Solaris, Irix, Linux and Windows. Most of our customers are on Solaris and Irix 64-bit systems, but Linux and Windows are increasingly important. Our environment is based around an elaborate command-line system of Makefiles controlling four different compilers (gcc 3.1, Sun Forte, Irix MIPSpro and Visual C++ 7). Needless to say, maintaining this system and producing modern multi-threaded C++ that will go through the four build systems is time-consuming in the extreme. A large proportion of our time is spent finding C++ code that just works rather than being creative and competitive with new functionality. What tools and strategies can we use to increase our productivity and regain our competitive advantage, without going for Windows only?"

"Our recent single-platform competitors (Windows only) can seriously outrun us in terms of productivity by using a single modern IDE development environment - such as C++ builder or Visual Studio - although we can scale onto larger multiprocessor Unix systems. With Windows 64-bit imminent we may lose our 'big-iron' scalability advantage. Java is not currently an option for the high-performance numerical and immersive graphical aspect of our applications."

23 of 410 comments (clear)

  1. Re:Might I suggest... by Anonymous Coward · · Score: 2, Interesting

    Python? :)

    Platform independent, it's highly creative, and damn if you can't prototype stuff quickly.

    P.S. And you can actually understand the code months after you wrote it. ;)

  2. Without joining any holy wars about language... by buysse · · Score: 4, Interesting
    It sounds like your biggest problem isn't the cross-platform code as much as the Makefiles and the compiler differences.

    I would suggest first using gcc on all UN*X platforms, and also trying out something like ant instead of the various forms of make you're dealing with now.

    Also, have you considered using a library like Qt to handle most of the porting details? It's not free, but it is good if you can deal with it's oddities (I personally consider preprocessing to be evil).

    Good luck.

    --
    -30-
  3. Numerics in Fortran, Front-end in Java by PseudononymousCoward · · Score: 2, Interesting

    Check out the latest edition of OilIT. Applications like this are why Fortran is still a very popular language among those who use computers for numerically-intensive work. Fortran9x is so easily portable, its not even funny. Bindings exist for all of the major threading standards (OMP, MPI, etc) and it is FAST. Further, is there any language with a better selection of libraries available for number-crunching? I doubt it. Develop your 'work' code in Fortran, and your front-end in Java. Both highly portable. The interface between the two will be platform specific, but this will only be a small portion of the total project & much easier to maintain than the large #ifdef heavy project you now have. $0.02

  4. Re:Might I *STILL* suggest... by XaXXon · · Score: 5, Interesting

    In defense of my previous post:

    As for graphics, there is a QT binding for perl that will allow you to do cross platform GUI work (and it looks nice, too)

    As for speed, making C/C++ plugins for perl is not hard, and if you can break out your high-speed numerical pieces into small bits of code, it's relatively easy to call them from perl.

    That said, perl isn't that slow. After you break out a few critical routines into their own XSUB modules, I bet you'd be surprised how fast perl is.

    Also, perl 5.8 has very good threading support, and it isn't a global mutex around the interpreter like it is with some other interpreted languages.

  5. ACE (or Rogue Wave) and gmake by demiurg · · Score: 2, Interesting

    Just rewrite all your makefiles for gmake - which is cross platform and can use any compiler and use one of these libraries (ACE or Rogue Wave) along witg STL - and you are set.

    I've done this... it works...

  6. Hmm... by Fugly · · Score: 3, Interesting

    I've seen a few shows on TV recently that featured some really wicked looking oil and gas exploration software. Stuff that let geologists view layers of terrain collected by seismic data in 3d, moving around in realtime... If that's the kind of stuff you're into, I can understand why java isn't an option for display right now.

    However, java is exactly what you need. You can scale it across processors on the big iron or run it on the desktop without recompiling.

    Have you considered only writing your display logic in C++ and using java for the backend number crunching? For raw floating point math, I've read that java is barely slower than native code at this point. It's my understanding that talking to the OS so you can get to the hardware is where you take the major performance hits using java. If you could do your raw crunching in multi-threaded java code, you could then deliver the data through one of many different mechanisms to your display logic and have that be the only code that you need to port from OS to OS...

    Another thing you could possibly look at is licensing 3rd party libraries made for cross-platform development. From your post, the only thing I know you're definitely having trouble porting is thread-related code. I'm sure there are multi-platform threading libraries for C++ out there somewhere.

  7. Qt by neonstz · · Score: 5, Interesting

    Have you looked at Qt? It supports all the platforms you are developing for. It is primarily a platform independent GUI toolkit, but it also got a lot of other stuff like container classes (if you for some reason won't use stl), thread support, sql classes, xml classes and socket classes, all which are platform independent. It is not only just a portable GUI toolkit, I think it is the best GUI toolkit there is. I recommend it even if you're writing for Windows only. If you think of Qt more as a platform than a GUI toolkit, writing applications that run on multiple platforms (with native speed) may be easier than you think. (I'm not an employee of trolltech, although I am wearing a Qt t-shirt as I write this :)

  8. Re:Gcc? by Dog+and+Pony · · Score: 3, Interesting

    http://www.mingw.org/ || http://www.cygwin.com/
    - using GCC on Windows is not a problem anymore. I do it often, with no problems, and then you should keep in mind that I'm not very good at this stuff on any platform. :)

  9. We don' need no stinkin' tools by seniorcoder · · Score: 2, Interesting

    I have written many cross-platform projects in C++ without a problem. All I did was identify low-level platform dependent issues and encapsulate them within subroutines, typedefs & #defines etc. Then write software using regular C++ code and use portability library. Example: typedef unsigned long PORTA_PID; // This function returns the current process ID. PORTA_PID getProcessID(void); As a previous respondent said, GUIs are a different matter. I would suggest to standardize on one GUI environment such as Java (or even MFC) and split the functionality so the GUI was a thin shell that communicates with the main business logic that exists in other C++ processes. You don' need no stinkin' tools, the amount of code required in the portability library is very small. That's my 2$. I'm worth more than 2c (just).

  10. Program with Java, build with Ant. by AugstWest · · Score: 3, Interesting

    I don't understand why people even look at Makefiles anymore now that Ant exists. We've completely automated all of our builds and deploys across NT, Linux and Solaris with it, across different architectures and different locations.

    I'm not going to expound on using Java, since it is fairly ubiquitous these days and if it would work for you, I'm sure you would have already considered it.

  11. Re:Gcc? Speed. by gillbates · · Score: 4, Interesting
    gcc is built for portability, not speed. VC++'s code is faster

    You're joking, right? Perhaps I'm a little behind the times, but I was under the impression that GCC used a register based architecture where VC++ uses a stack based architecture. While GCC might spit out some average performing code with the default options, using -O3 will produce very fast running code. I've compared the performance of code compiled with GCC vs. the same program written in assembler, and at its best, GCC is only 50% slower than hand coded assembly, which is very good considering that some very well respected compilers will produce code that is 10 times slower than hand coded assembly.

    I've also looked at the assembly language output of VC++, and it's a joke. VC++ often inserts large sections of extraneous instructions into the code. I've managed to follow function calls in VC++, and it is not uncommon for a function call to have prolog and epilog code of several dozen instructions. Interestingly, GCC uses a register based schema, and I can actually follow the code pretty easily, in spite of the fact that it uses the AT&T syntax. GCC just produces cleaner code.

    --
    The society for a thought-free internet welcomes you.
  12. Re:gcc cross platform? by The+Snowman · · Score: 3, Interesting

    The latest version of GLibC is standards-compliant and faster than MSVCRT, Microsoft's implementation of the standard libraries.

    Actually they use an old version of someone else's libraries, I think the Dinkam libraries.

    Anyway, I haven't run into any problems with GCC/G++ and GLibC in a while. I think version 3 of the GCC fixed a lot of the standards-related issues, and GCC compiled code is plenty fast. It runs circles around the VC++ compiler.

    --
    24 beers in a case, 24 hours in a day. Coincidence? I think not!
  13. Have you tried Java? by Big+Man+on+Campy · · Score: 2, Interesting
    A colleague of mine is in the same boat as you. He asked me to implement some of his numerical calculations in java. We then benchmarked both. Java was the clear winner for us. You should consider trying the same.

    Go out and download and install Java's sdk. Also, take a look at jama.

  14. cmake and cygwin by cant_get_a_good_nick · · Score: 3, Interesting

    As far as makefiles go, cmake looks promising. It seems to be a generalized Imake replacement. I haven't used it, but looks interesting. It is now part of the cygwin toolchain.

    as far as tools go, look at cygwin. My company uses gnumakefiles on NT and UNIX, with generalized Makefiles for each project, and platform specific build rules in universal gmake include heeaders. We use ACE for a lot of the cross platform C++ stuff, a lot of our things are servers so we avoid the cross platform GUI stuff.

  15. Re:Visual C++ Everett by Tony+Hoyle · · Score: 3, Interesting

    It doesn't mention Linux compatibility, only that it has been 'designed to appeal to the Unix and Linux communities' - basically they're pushing the standards compliance a lot.

    There will always be compatibility issues... VC.NET is a lot better than VC6 but there are holes, like MS' continued habit of putting underscores in front of 'unix compatible' names (snprintf for example), and calling other things completely differntly (eg. strcasecmp).

  16. Use Java & C++ native libraries by Crazen · · Score: 2, Interesting

    For the hevily computational stuff use C++ native libraries if the java "prototype" doesn't work for you everything else (persistance, interface, brokering) use Java.

  17. Abstractions, abstractions, abstractions. by AxelTorvalds · · Score: 4, Interesting
    Bummer, when you ask about this stuff, it's usually pretty late and there are often legacy decision that have been made that are hard to break free from. Or your young and naive and don't like something at work..

    This stuff is done for real. At IBM I worked on a very large project that compiled on AIX (several distinct versions that we were sensitive to) Solaris, Windows NT, Linux, HPUX, and supposedly OS/400 although I never actually built the OS/400 piece nor have I seen it operate. First things first, you need good coding conventions, don't let some punk break them either. Secondly you have to design some abstractions and build some foundation classes; or buy a really good set or downlaod some good free ones, I've heard positive things about ACE. This is mostly a problem with windows any more, back a few years you might support win16, win32, PM, and UNIX now it's pretty much just POSIX and Windows. You need to abstract the machine stuff out. Threads, possibly strings and such (Unicode vs. non-unicode..) possibly basic types (big endian vs. little) networking code.. A rule of thumb is that on this kind of project you should never talk to the OS directly without something in between, it's a huge effort to make that OS abstraction layer or learn the ins and outs of an off the shelf one but it's worth it, even if you pay with a little performance. Nothing sucks more than coding away on AIX building some cool classes and adding some cool new stuff, then checking it in and finding that it doesn't compile on any other platforms.. and you've got to figure that crap out ASAP to make a deadline. If you build one from scratch, as IBM usually does or did, you can tune some things for your application; your OS abstraction layer can be a great "helper" or "utility" layer.

    Typically well coded C and C++ can go from compiler to compiler pretty easily. Then you can use Pro64 on Mips, ACC on sparc, Intel C on Windows for performance critical portions of code. You have to be smart about it though and use some good conventions. The biggest rule would be avoid MS Visual Studio which is by far the most non-standard setup out there and if you do use it don't use their projects unless you have to. Some good make files with some good rules can help make this pretty easy. I don't know why more people don't do it but look at the Linux kernel's rules file. I have a Rules.make that I've built up and it includes things like different options for debug builds, profiled builds, and optimized builds, sets up some common rules for compiling C++ code and C code and what have you. My makefile include that file and then they are usually pretty short, generally not much more than a list of .cxx files and a library name. Then it's easy to make sweeping changes too. I think a good build system, one that will last should usually take a day or two to kind of put together pretty early on in a project, unless you can carp some good stuff from another project. The goal is a flexable and reliable build system that you don't have to worry about. Far too often people start cobbeling a build system together and then after 6-9 months it's broken and britle and hard to change because so many things have been changed and added through out the project. Put some effort in up front, consolidate your rules in to one place, use some environment variables to control some build switches. Use some shell scripts to figure out various things, not hundreds of lines of Bourne shell code, just little bits. Do this until AAP is ready and rocking and then use that. Also, if it needs to be said, use GNU Make; it runs damn near everywhere and it's pretty good at what it does the 15 minutes it takes to learn it will save you hours and even days worth of time in the long run.

    I'm a huge advocate of a solid and strong build. Mozilla is a project that festered for weeks or maybe even months becuase you couldn't build the damn thing when it went open source. Building code is something that can be done so well by tools that if you're worried about it then you need to fix the build. Building software is hardwork so take the pieces you can out of the equation, the build is the first one.

    Next, I assume you've abstracted out the GUI from the meat. If not, make this job one if you wish to have any chance in hell against your one platform competitors or even your mulitplatform competitors when you get down to it. View/Data Model and client/server: learn it, live it, love it. Or switch to a web based interface, lot's of people do it.

    While we're on abstraction. If you guys are really serious then you're probably going to have machine specific components. Look at /usr/src/linux/include and /usr/src/linux/arch for a starting point of reference. I would envision a project like this have a set of small Mips, Wintel, Linux-x86, etc. directories. Everything else can probably be compiled with GCC and then in those directories you'd have your assembly and machine specific compiled code.

    Lastly, you want to have a staged check in process. People hate not being able to commit code but at the same time you don't want them to commit code for real until it compiles on all of your platforms. Honestly, I don't know of a really good way to do this. Set up a build lab, do nightlies against the real code. Do nightlies against the "staged" code. Then have some kind of weekly merge meeting. That's how I've seen it, it's time consuming and somewhat painful. You bite off too much and you're spending a shitload of time merging stuff.

  18. Re:Gcc? Speed. by aminorex · · Score: 3, Interesting

    gcc 3.2 is generally superior to VC++ emitted code,
    in my experience.

    Mingw32 is the target of choice if you don't want
    to license Cygwin.

    --
    -I like my women like I like my tea: green-
  19. Try the Apache Portable Runtime Project by Anonymous Coward · · Score: 1, Interesting
  20. Mac OS X is the best for programming by afantee · · Score: 2, Interesting

    I have been programming C++ professionally for over 10 years on many Unix and Windows platforms (Sun Forte, MS Visual Studio, etc), and I can tell you that nothing comes close to ProjectBuilder, InterfaceBuilder, and dozens of other tools on OS X. The good news (for those who always think everything Apple must be expensive) is that they are absolutely free, so save that $2500 for Visual Studio.NET and buy yourself a decent G4 TiBook with a real OS and all those free tools.

    With GCC 3.1, you can programming in mixed C / C++ and Objective C / C++ in the same file or project. ProjectBuilder provides the best IDE and CLI for building multiple projects with dependency and multi-targets and multi-phases, apart from editing source files, icons, graphics, sound, document, etc.

    InterfaceBuilder is the only tool on earth that actually allows you to design and test professional UI with virtually no user code.

    1. Re:Mac OS X is the best for programming by Trillan · · Score: 2, Interesting

      I admit I have a Mac bias, but even so I found this part ridiculous "InterfaceBuilder is the only tool on earth that actually allows you to design and test professional UI with virtually no user code." Off the top of my head... Visual Basic, Delphi, Prograph, RealBasic, C++ Builder...

  21. I recommend looking at ICU4C by Anonymous Coward · · Score: 1, Interesting

    I recommend looking at the ICU4C (International Components for Unicode for C) libraries, which are available at http://oss.software.ibm.com/icu/. ICU is a set of thread-safe cross-platform open source Unicode libraries. The project has some examples of how it builds and tests on multiple platforms.

    It's being used by many other projects and companies. For example, it works very well with the Xerces C++ project. The ICU readme.html has the list of platforms that can build ICU.

  22. Multiplatform Support Tools in C++ by MrWizard510 · · Score: 2, Interesting

    We use the 'understand C++' tool (www.SCITools.com) to provide a window into 1.5 million lines of C and C++ code. You configure this tool by telling it the subdirectory trees of your source code, and this tool builds a database of every file, object, line of source. It then provides both textual and graphical navigation tools for your code, including dependency trees.

    It has an integrated editor with syntax highlighting, and shows what code is #ifdef'ed out.

    I don't work for the company, but I've found the tool very useful. For your purposes, it should help locate where mods should be done, and what mods to do differently based on your different compilers and platforms. There are versions that run on Windows and Unix -- I use the Windows version, and 'point' it at my Windows and DEC VMS code.