With the G5 Macs we have a widely-available 64-bit platform.
64 bit systems are a can of worms that I'd like to open as late
as possible, after all other aspects of the code base have been
cleaned up. Once that is the case, we'll *first* have to
systematically identify all the parts of the code where the CPU
type actually makes a difference, and think hard about each
individual one.
Too late, I think; it was open the minute the G5 shipped. If we're lucky, we won't have someone pop up on this list with "I compiled Radiance on my shiny new G5 with -mpowerpc64 and ...". But likely there will be someone out there, even if we don't hear.
Radiance still carries code (and conditionals) from a time when
the differences between unixes were much bigger than they are
today, and we're continuously reducing that historical ballast.
I'm all for that. But let's not make the next leg of the journey in ballast, hunh? Want to carry pay cargo, I do.
The conflicts with MS-Windows are much greater and it would be valuable
to give some code a native Mac OS X interface, as well.
Let's keep things simple. OS X supports posix and X11, so we
don't need to provide any proprietary interfaces for it.
And Cygwin (or Red Hat GNUpro, if that's what it's called now) runs on Microsoft Windows, no need to provide any proprietary interfaces for that system.
If only!
Apple's comments on this:
If you want your application to look identical on all platforms then you should make the abstraction layer thin. However, this tends to result in Mac OS X users throwing your application in a dumpster because it doesn�t feel like a Mac application. Mac OS X has common GUI style rules that most X11 applications don�t follow.
And this also applies to MS-Windows, of course.
By the way, this is from Apple's portability guide, at <http://developer.apple.com/documentation/Porting/Conceptual/PortingUnix/portability/chapter_3_section_1.html>\. I recommend that document.
Peter is right: If we stick with posix, then there's hardly any
noticeable difference between current BSD and other unix systems,
except in rare and pathological cases. In fact, in some cases
it's harder to get the code to work on more than one Windows
version than on all the unix/BSD versions from a dozen different
manufacturers.
In fact, Mac OS X does not support POSIX (I looked it up two days ago--I was hoping it did.) It *provides* some POSIX system calls and programs. Apple makes no promises to *support* POSIX at all (except POSIX threads, go figure). That means no POSIX certification testing and therefore subtle differences that will lead to bugs.
Ironically, Windows POSIX.1 capabilities are certified. It may be that #define'ing "POSIX_SOURCE" to 1 in the compiler will allow the non-X portions of Radiance compile without change on Windows.
I see the following likely platforms:
POSIX (Sun, IBM, DEC Alpha/Compaq), Mac OS X, various Linux, various BSD, SGI
Plan 9 ANSI/POSIX Emulation
various MS-Windows versions
Special-purpose servers (a holodeck server is a likely possibility)
Which to test? Wihtout a user survey, I'd guess the most-used platforms will be Mac OS X, Red Hat and SUSE Linux, and Windows NT and XP. SGI, if we can find an SGI system to test on--later SGIs are 64-bit, btw. POSIX, you will notice, isn't even the list--one doesn't buy Sun and IBM systems for rendering, usually, and the Alpha (another 64-bit platform) has been let to go obsolete by Intel. If someone steps forward and offers to do another platform, I'd be all for signing them up.
There's only a very small number of feature based conditionals
around in Radiance, most prominently the GL stereo/nostereo stuff.
Most of the others distinguish between platforms. Since your
biggest worry with conditionals is about having to test many
seperate versions, that kind of makes those a moot point. We'll
have to run all the tests on all the seperate platforms anyway.
The more of the code is platform-independent, however, the more tests will apply across platforms, providing additional testing for free. Conversely, the more platform dependence (and any file which includes a platform-dependent header is platform dependent) the more possibilities for platform-dependent bugs.
I am not too much concerned with Radiance feature variants, as long as the number is modest and the conditionals manageable; my concern is with the kind of fine-grained platform dependence that the GNU build utilities enable. There are so many variants of such software that most of the configurations it is used in are never tested by the development team at all--much of the testing work falls on the end users or integrators further on in the development process.
Other than Randolph, I don't think this is a difficult change.
"Make build" will have to move all the binaries into a local
ray/bin directory, for "make install" to pick them up there.
There are two possibilities how to organize the library files.
Either we collect them into a local ray/share directory right
away (they're scattered all around the source tree right now),
or "make build" will have to do that as well.
Mmmm...common practice is to simply build in the source directory, then find and move the files for install. But practice varies.
A much more serious problem to my mind is the problem of conditional build--as with the OpenGL support, which I have been wrestling with. One of the biggest porting problems I am aware of is the variant versions of "make" and associated utilities. BSD, POSIX, and GNU all have very different versions of make (doesn't Windows have one, too?), and the only things one can count on--still!--are the features of the 25-year old Unix v7 make. Basic make doesn't provide any conditional building or automatic dependency tracking at all (find the .h files referenced by .c files.) BSD Unix and, usually, Linux, has "mkdep" which can be hacked into providing dependency tracking--it is not part of POSIX--but it's pretty much of a kludge. I have hacked out a GNU makefile for the "common" subdirectory, which allows for conditional building of the OpenGL component; I can find no way to do it on v7 make without changes to the controlling script, and I don't know about BSD or POSIX make--GNU make was quite enough trouble for me.
All of which leads me to think we need more work on the controlling scripts, a decision to use one make (probably GNU) or an improved build tool. I have a friend who thinks well of SCONS <http://www.scons.org/>, but that's a big shift.
How to trigger the tests is a somewhat seperate topic from
creating them first. Anyway, "makeall test" would require to
seperate the building and installing stages in the Rmakefiles.
This is something that I'm missing anyway at the moment, because
it would make testing small changes in a contained environment
much simpler.
Me too. I'm really not testing adequately, and that worries me muchly--field test is *not* the time to find out about all the problems I introduce.
The basis to this should be a new strategy on where Radiance
searches it's binaries and library files. We had a first stab at
this discussion already a few weeks back. I think a reasonable
strategy would go like this:
- For binaries, first look in the directory where the current
executable was loaded from, then look in the $PATH.
- For library files, first look in ../share/ (again based on
the location of the current executable), then in
../share/radiance-<ver>/, and then on $RAYPATH.
How does this work on Mac OS X and MS-Windows?
Thanks for the long & thoughtful reply.
Randolph