Any object pascal experts in the house? I've managed to bulldoze my way through all the roadblocks getting the SDK compiled cleanly on Mac OS X ice kitteh (aka 10.6) - it's taken bloody ages because of conflicts between USB library bitness, Java library bitness, and having to literally compile every dependency, none of which are versioned clearly, from scratch.
Part of the blame goes to Apple for having a schizophrenic Java implementation that 'cleverly' decides whether to run 32-bit or 64-bit depending on what you're trying to run. And having re-written Stefan's usblibJava Makefile to actually run on Snow in proper 64 bit mode, at last I had all the Java components compiled and working.
Most of the blame goes to me for not being as good as I think I am
I'm down to the last problem. I can't - for the life of me - get my head round BMP. The problem is simple - an include directive in the macro processor instantiates (recursively) a Macro buffer object which is added to the list of buffers in the object itself. The Macro buffer class is derived from the Text buffer class, and the latest incarnation of the Free Pascal Compiler won't allow a derived class to be passed as parameter to a method expecting the parent class, which is exactly what the code is trying to do.
So we've got object pascal, and an inherited class recursively calling its parent to include its contents.
OK, this isn't a simple problem at all...
I've rewritten the code to take the macro off the derived class, typecast the derived class as its parent and send *that* in the inherited constructor call, adding the macro stuff to the returned instance. Hey presto, it compiles.
However... it only builds a small proportion of the IHXs in the examples section.
What frustrates the hell out of me is that the basic code - UCEcho - compiles and builds a nice Jar file which actually *executes* and runs on my Mac and my FPGA. The USB libraries work, UCEcho tells me the device ID of my nice test board, etc. Hence *most* of the code is OK.
But many of the examples will not build, and neither will the BTCMiner firmware. All of them bomb out leaving a blah.tmp.c file of 64000 bytes (this is Snow Leopard, so may be exactly 64k - Apple confused us all with kilo / kibi and all that BS a while back) and an error of 'failure writing to blah.tmp.c'. No more verbosity can be obtained from the BMP macro processor, and there are virtually NO comments in the code.
Now I haven't been a professional coder for a LONG LONG time but this fucking infuriates me. It's a meta-meta-self-referential fucking parsing machine written in non-type-safe old Pascal and there's no commentary or verbose error messages. I'm trying my hardest here but I have the feeling that the code originally worked only because of some unintentional feature in a specific version of the free pascal compiler... and hence why binaries are included for Linux and Windows. That could be unfair, but anything recursive really needs proper commenting IMO, otherwise it's impossible to follow. The human brain has a stack of 7 items and you're doing well if you can use them all (top coders can, few others train their short term memories to that level)...
I've obviously tried to compile the SDK on Linux and it works immediately using the BMP binary included. Equally I've built the entire SDK from scratch using Ubuntu 11.04 - and it all works. Ubuntu Natty installs FPC 2.4.0...
So that's my final sticking point. It seems to be 100% due to the 'include' issue... which I've had to change. Equally, the entire functioning of the Pascal app may have been scrambled due to the latest version of FPC... comparing the actual bytecode IHX files produced by the Linux version and the OS X versions on the simple UCEcho code (which *does* work on both platforms), there are a bunch of differences and a few extra lines on the OS X side. This could be due to a newer / different version of the SDCC which could lead to faster / slower / non-functional code.
I'm hoping that the SDCC is backward compatible and produces functional code. Equally, now I've nailed Java down so it works properly (unsurprisingly enough, Java and Pascal are not on my CV but C, C++, unix and new scripting languages should suffice to pick anything up), I'm hoping that it's only a question of getting BMP working *properly*. I'm trying to compare output but the Linux builds don't leave the temp files.
I'm going to keep hammering away at this but would appreciate any assistance... for the time being, I'll see if I can remove FPC 2.6.0 from my Mac and install 2.4.0 instead... if this solves the problem then at least I'm up and running, but it's unsatisfactory as it means my main development box becomes instantly fragile - one 'port upgrade all' and everything's fecked...
ETA - Stefan - you beat me to it. The reason I asked about versions is because I thought you'd know and it'd speed up the process. I've solved the Java bindings of libusb for Snow Leopard and it requires a totally different Makefile than the one you supply. Yours assumes that Fink (an old package management system for earlier versions of Mac OS X, superseded largely by MacPorts these days) is installed, hence the references to /sw/lib etc. which give it away. Equally, there are two libusb implementations and the obsolete 'legacy' one is what is required (0.1.3 works - the current 1.0.8 does not).
The SDCC works without problems. BMP does not compile on 2.6.0, the latest version of Free Pascal. Try it. However it works on 2.4.0 as per my latest test on Linux, so I'm going with that for the time being. Apologies for the frustration but life moves pretty fast, as Ferris Bueller said, and FPC 2.2 is ancient, and Mac OS X moves *very* quickly and is perfectly happy to dump backward compatibility...
No offence intended for any of the ranting above, BTW. I don't want to 'just' run the miner pre-packaged... I want to have an SDK that I can compile from scratch whenever I want, and try out some of the examples in your SDK. I'm not your typical Mac user...