DeskLib update proposal
Pages: 1 2
Rick Murray (539) 13850 posts |
Does anybody still use DeskLib? Suggestions and comments welcome. While I have (hopefully!) made a 32 bit conversion of v2.30; the library itself is stuck in the era of RISC OS 3.10; so I find myself putting together code to call _kernel_swi() to get a better looking error box. Time for that to change.
|
Philip J Ludlam (50) 21 posts |
It’s cases like that lead to enhancements in Libraries ;) From a quick Google (and yes I’ve found your blog) getting into DADebug could be quite useful. I think the Net(working) additions would be beneficial as well. Also, what’s the licence for DeskLib? I’ve got plans to get Desk back out there and cherry pick changes from your version, the 3.8 that’s on riscos.info and any other ideas while I’m at it. |
Alan Buckley (167) 233 posts |
I believe that programs in the GCCSDK autobuilder that use the ChoX11 X11 emulation also use DeskLib (the version at riscos.info).
It shouldn’t be too difficult to allow DeskLib to be compiled for GCC and the DDE. OSLib manages it. Why restrict your library to the paid for compiler and not allow people who prefer GCC to be allowed to use it as well? I appreciate you can say the same for DDE with the riscos.info version, but I guess with that, it’s being used mainly for the autobuilder and hasn’t got anyone actively maintaining it (as far as I know).
Not sure about this point. ELF is just a different way of creating libraries, they are linked to work on plain regular RISC OS without issue. Plain regular RISC OS doesn’t come with the DDE either. If you are making major changes, why not rename the library while you are at it and say it’s a drop in replacement for DeskLib? |
David Feugey (2125) 2709 posts |
Is not a module – not provided in standard with RISC OS – needed to load elf files? |
Alan Buckley (167) 233 posts |
GCC comes with a program which you can run on your built elf program which converts it to the aof(?) format. Then running the program on RISC OS does not require anything to load elf files as the program is no longer in elf format. It’s how I tend to ship my programs so there are no other dependencies and how most of the autobuilder programs are shipped. As an aside, the elf loader itself is a module and the basic shared libraries come in a RISC OS style application which includes the module and the C shared libraries. If you wanted to ship you program in elf format, you would need this installed as well. It’s an extra step, but not really difficult. |
Rick Murray (539) 13850 posts |
Exactly.
Even moreso if you find my patched version (search the forum for DADebug) that can periodically output the information to the serial port. A cheap PL2302 clone USB serial interface hooked between Pi and PC and Bob’s your uncle.
That would be good – but didn’t the Acorn URL module do that? Was URL replaced? If not, how come it isn’t readily available these days?
I think the GCC version is an MIT licence. The version I have is as follows: This software may be used in the production of any piece of software so long as the authors acknowledge in the final product distribution that DeskLib (or parts thereof) was used. I am ignoring clause 2 because neither Jason Williams nor Julian Smith are actively maintaining DeskLib; it spent a while in limbo. FWIW, I would guess that if the GCC guys were able to sort out all the relevant permissions for making their DeskLib be under the MIT licence, then the same could apply to my version. To be honest, I’m not that fussed about the licence so long as it isn’t GPL, and to that end, if any of my code is later on considered worthy for inclusion into the GCC version, they’re welcome to it.
Desk or DeskLib? I think Desk was an interesting progression for the library, but it might have been a case of “too many changes”. I remember I tried Desk and it utterly didn’t work (so many naming schemes had changed). I guess the DeskLib programmers were too lazy to change? Hehe, I was. But on the other hand I have never used OSLib in my life so the namespace clash (hazy memory, it was long ago) just didn’t affect me.
Hey – don’t look at me! Quoting from the current DeskLib site: Current Release: The current version is 3.00, and is ELF-only for use with latest versions of GCC This implies two things: 1. That further releases of DeskLib will be ELF only. This suggests that future development of DeskLib over there will make things more difficult for those who are using the official development environment. While I did my (somewhat hacky) 32 bit port of DeskLib in 2004, reading the lines quoted just above is why I have a renewed interest in DeskLib.
Actually, stuff does change, but at the speed of frozen treacle. My version is no longer the most recent, though I don’t qualify for the free upgrade as I’ve had it more than 6 months (though that 6 month thing is funny, I’ve never seen the DDE updated anything like that often…). Anyway, point is, it is being updated.
Fair point… but on the other hand I wanted to run cmunge to compare its output with CMHG for some deep nerdy thing I was doing regarding module start entry. Thankfully I was able to, but cmunge (along with asasm, elf2aif, and ln) were the only tools in the bin folder that were in a recognised RISC OS format. gcc itself is about 460K of big-question-mark file. It is ELF, because the first word identifies it as such. And we’re back to this. Different by design. Given the heritage of RISC OS, I might be inclined to say “non standard by design” as well. ;-) AIF, ALF and AOF are standard. While you don’t get the DDE supplied with RISC OS, that is true, you do get AOF, ALF and AIF documented in the PRM (back of book 4).
Because it is DeskLib. Not a replacement, not a clone. Not something that looks and feels like it but isn’t. It is…It. David said:
To which Alan replied:
In other words, YES. ;-) It is good to know that ELF programs can be converted to AIF; however I wonder why GCC doesn’t use AIF natively. It has been said a million or so times here – RISC OS is not Linux. I wonder what actual benefits ELF for executables is supposed to bring to RISC OS? Maybe runtime linking, but this surely risks entering into a miniature version of DLL hell? Linux has a patchy track record with respect to ABI compatibility… |
GavinWraith (26) 1563 posts |
I have never done any programming outside RISC OS land, but I have always wished for some sort of runtime linking. That is because I keep half an eye open on what is available for Lua by way of useful libraries. All of them are designed for runtime linking. If they are to be available in RISC OS they must be statically linked. This is sad, because Lua has been designed to be lean and minimal. RiscLua has the bc bignumber library built in, for example, but if you are just using Lua for tiny StrongED scripts you are unlikely to be needing it. With runtime linking you can adopt the policy of having lots of specialized tools that fit together. Without it you are stuck with monolithic applications that have to carry stuff you never use. |
Gulli (1646) 42 posts |
Wouldn’t it be a good idea to give one of these projects a new name? Don’t know if the license allows that but surely it would be better to avoid a “RISC OS 4/5/6” version number mess. Starting with a new name would solve any version number conflicts that are guaranteed to pop up if they haven’t already. |
Mike Freestone (2564) 131 posts |
Why not look at overlays (in the dde manual) which even use a script interpreter with add on functionality as its example, that way the extra lua bits are only loaded when needed |
Rick Murray (539) 13850 posts |
When you write a program with DeskLib, you are extremely unlikely to be including the entire library. This is because the library is broken into tiny little modules, directly related functions go together, but less related things are separate. For instance, the BBC style graphics. The following C files: ReadPoint, Rectangle; and the following assembler files: Clg, GetClip, Plot, SetClip, SetColour, Vdu, Wait, Write0, WriteN. I had a rough outline I wrote a long time ago for a very simple BASIC(-like) compiler. It had a code library, but I didn’t think including an entire library with every program would be useful, so the library contained a “core” (startup, shutdown, necessary functions) and a set of function libraries afterwards with an index table pointing to them (you know: one for INKEY, one for CLS, one for VDU) and the compiler was supposed to keep a track of which functions were actually used, and they alone would be included in the final executable. Maybe you could use a similar method? |
Rick Murray (539) 13850 posts |
Mine is “DeskLib 2.30/RM” (note the suffix) with the object file “DeskLib32”. If you don’t want my enhanced functions, you can download any version of DeskLib 2.30 for 26 bit machines. As for version numbering, I will probably suffix “release #” or something like that after the /RM and let it always identify itself as DeskLib v2.30. Because, spiritually, that is exactly what it is. Or maybe DeskLib 2.30 ++ ? ;-) |
Gulli (1646) 42 posts |
I have absolutely no objection to yours or any other fork of this excellent project. I’m just thinking of what appears to be a rather “RISC OSy” way of all forks keeping the original name despite the confusion with “versions” and versions that will inevitably arise should more than one of those forks survive for more than a couple of releases. A clean break might be a better way of “marketing” a particular fork, RickLib (for example) could of course mention that it is a fork from DeskLib 2.30 and could even start with new version 1.00 (or 1.0.0 should you want to go for Semantic versions). That would even make breaking backwards compatibility easier should that be needed. |
GavinWraith (26) 1563 posts |
Thanks for that, Mike. An excellent suggestion. I had overlooked overlays all these years and they might be just the ticket. Putting the libraries in ResourceFS might be the way to go. |
Alan Buckley (167) 233 posts |
Rick,
I’m not having a go at you here, the DeskLib on the riscos.info site has gone the ELF route only. I’m not saying that is good. I’m just saying as you are actively maintaining a new version of DeskLib, why not provide a GCC ELF version of the library as well, so users of GCC can use it. It’s entirely up to you of course. Any development of libraries for RISC OS is a good thing.
You seem to be talking about the GCC tools here. I’m talking about the final output program running on RISC OS that doesn’t need any ELF loader. Isn’t that the bit you were complaining about? You don’t expect the DDE to be installed on the end users machines either.
Sorry, I think I’m missing the point here. Of course it’s different, but that makes it no less capable of producing RISC OS programs that are designed for RISC OS.
OK, that’s what you mean by standard. I didn’t realise that all the intermediate formats used by the compiler had to be standard as well.
OK, it was just a suggestion to remove confusion between versions. As you were making changes it seemed it would be easier for you to change, but I wasn’t demanding it.
Why does my aside make it a YES? My main reply was it could build AIF files so the programs don’t need an ELF loader to run on RISC OS.
I’m not a GCCSDK developer, and so can’t really say why they switched to ELF. I think it was something to do with making it easier to port the compiler and associated tools. Not sure why you are mentioning RISC OS is not Linux. RISC OS isn’t just the BASIC interpreter or a compiler for any other language either. Surely if you say we can’t use ELF format we can’t be allowed to run JavaScript or anything else that was first developed on another machine:-) GCC is a good compiler and can be used to produce RISC OS programs, designed for RISC OS, that run on RISC OS without any more dependencies than the programs created by the DDE. So why not support the use of it with your library? Just to be clear – I’m not saying ELF is better than the other formats, or that GCC produces better code. But it gives RISC OS developers a choice of a free compiler that supports some features not supported in the DDE. But, it’s your choice – if you really hate GCC that much, there’s no need for you to do extra work to support it. |
Rick Murray (539) 13850 posts |
The problem with this is that it would entail setting up and learning an entirely new toolchain. The only time I have ever used GCC was in building firmware for my PVR, and that was from a downloaded archive that had everything set up. I did the hard part – I typed “make”. ;-)
Certainly. And IMHO it is important to develop DeskLib just so the world has an alternative to RISC_OSLib. ;-)
It is indeed capable of producing not only ELF programs but RISC OS native. The GCCSDK autobuilder creates plenty of examples. Is there a tool to convert ALF to ELF? If so, this whole discussion is moot.
They don’t have to be standard.
I’m not even sure that I could rename the library. Much of it is not my work. I am continuing something created by others…
I’m not saying you can’t… We can run Lua and perl and all sorts of things that are not part of the “official” RISC OS world. All that is necessary is the software. However, two different pieces of software interacting would benefit from having something in common. If they don’t, then it all gets a bit messy.
What happens if you double-click on a JavaScript file? :-P
I believe so.
Yes.
I would beg to differ. Ceasing support for one of the common and well documented intermediate file formats is… an interesting decision.
…plus SharedUnixLib? Or is that optional?
I would like to, and maybe in the longer term it may come to be.
I don’t hate GCC, I just don’t agree with turning their back on the de facto standard file formats. It risks making GCC only compatible with itself (at object code level). Well – we’ll see how this turns out in the future. I won’t be doing anything on it right now. Too hot. My netbook has its fan hardwired to run at 100%, along with a dual fan cooler widget underneath, and even then it is running at ~65C. There’s a desk fan pointed at my face, and I’m hopefully running at 37C. The Pi has no cooling, and I don’t plan to give it a reason why it might want some. It is hot. Hot enough to cause important electric transformers to overheat and blow up → http://www.ouest-france.fr/coupure-electrique-de-grosses-coupures-en-bretagne-et-pays-de-la-loire-3524643 |
GavinWraith (26) 1563 posts |
I was under the impression that ELF stored more data than ALF, so that ELF → ALF was |
Steve Pampling (1551) 8172 posts |
Which reminds me – I need to connect to work and find out if the comms rooms are back below 32C Yes, there is air-con; no, it isn’t really making the grade.
RPCEmu on the laptop is warming it up a bit… 1 My office however was at a nice 22C. If it wasn’t some people might find bits round their offices not talking on my network. |
Alan Buckley (167) 233 posts |
Rick, Thanks for clarifying things for me.
That’s an entirely reasonable approach. I’d rather you concentrated on the library rather than having to learn a new tool. If the developers existed with the time on their hands it would be nice if we could have both.
OK, I see your point here. But we shouldn’t just stick to something because it’s been around a while. Maybe ELF is better for some reason. I’m assuming the GCCSDK developers were smart enough to think this through and judged the gains outweighed the losses. Even if ELF in itself isn’t better, it could be that by using that format mean the porting process is quicker and easier and allows RISC OS to have a modern free compiler that’s easier for them to maintain.
Fair enough. It’s a pity you can’t update the riscos info version with your new stuff, so we got back to just one version, but I understand that version went off in a different direction anyway regardless of it’s use of ELF format.
I was talking about the final output program being designed for RISC OS. I still don’t believe GCC should be restricted to having to use the same intermediate formats as the DDE. I do agree it would be helpful if it did though.
Not sure. If you link to UnixLib you definitely need the SharedUnixLib as well, but I thought you could use GCC to link to the RISC OS C library and then you didn’t need it. I could be wrong though. I thought we were talking about what the ELF format needed, the SharedUnixLib was needed by GCC linked to UnixLib before they moved to ELF format. |
Steve Fryatt (216) 2105 posts |
that run on RISC OS without any more dependencies than the programs created by the DDE. SharedUnixLib is required if you use UnixLib; it has nothing to do with the compiler. All of my software is compiled using GCCSDK (and goes via ELF object files on the way to AIF), but none requires SharedUnixLib as I link to the SharedCLibrary stubs and not UnixLib. |
Steve Fryatt (216) 2105 posts |
I believe the last point was a key consideration: you can see a discussion of the issues written by Peter Naulls back in 2004 on Drobe at http://www.drobe.co.uk/riscos/artifact1236.html The key point here is that having to maintain RISC OS-specific back-end tools for a compiler that’s already perfectly capable of generating ARM code is massively wasteful in terms of developer resource when all that you actually need is a bunch of off-the-shelf tools that work with the standard ELF format and an unchanging elf2aif tool to convert the end result into something more familiar to RISC OS. The only real downside is the existence of libraries which are only distributed in ALF format (something that Rick seems keen to perpetuate with his new DeskLib). In practice I’ve never really found this to be a problem in around 15 years of using GCC; if you’re using the DDE libraries, you’re probably using Norcroft anyway. I’m not sure that there’s any excuse for current developers refusing to build ELF versions of their libraries. The bigger problem is actually going the other way: a GCC-using developer would need to fork out for the DDE to be able to generate ALF versions of any libraries that they wrote. |
Rick Murray (539) 13850 posts |
As opposed to the other DeskLib moving to ELF only so that it cannot be used with the “official” (as in “used to be Acorn”) tools?
Wow. So supporting the ROOL toolchain is a “bad thing” now?
I can give you two immediately: 1. I don’t have GCC installed.
Or for somebody to make an ELF2ALF tool? I’m writing this on the Pi today. I’m going to look at some parts of DeskLib – and specifically fix the low level serial port code – I’m kind of embarrassed that that got through; plus check that all of the 32 bit assembler has build options for 32 bit or 26 bit behaviour so it will still be possible to make an APCS-R build. [looks: damn, no, it’s straight 32 bit style code – but most of it will need to be changed anyway as As for GCC – would anybody familiar with GCC like to volunteer to help get this working? |
Rick Murray (539) 13850 posts |
Got a little sidetracked with the build process. The current (my revised) method works, but it is a bit messy. So I have decided to write a front-end program that will start when you click on !DLSources that will allow you to select a target (in the future, so RISC OS APCS and GCC will be a click away), the program will then be able to remove all of the object files for a full build, plus verify that the MakeFiles are correct. Once that has been done, a custom build script will be constructed (at runtime) to get the build going. Inspiration, obviously, from RISC OS’s !Builder. But looking at the build process, I thought to myself why isn’t this stuff clicky-clicky too? Unlike the original build helper tools, this will be supplied with all sources. ;-) |
Theo Markettos (89) 919 posts |
There’s a good reason (in general): as the amount of software gets larger, clicky processes don’t scale. If you have a hundred libraries to build (I forget how many RISC OS Firefox needs, it’s in the dozens), it gets very tedious to do it clicky one by one. So I’d suggest just keeping the build to plain Makefiles, no fancy stuff. Makefiles are possible to make cross-platform too (for cross compiling and for porting to other platforms), in the way that piles of Obey files or BASIC programs aren’t. You can pass parameters to Makefiles to select targets etc, they’re quite flexible (if a little arcane at times). I’m in principle happy to advise with the GCC side – a bit busy at the moment, but prod me repeatedly by email and I might have a chance to give it a go. |
Dave Higton (1515) 3534 posts |
Am I correct in thinking that ELF is industry standard and ALF is confined to RISC OS? |
Jeffrey Lee (213) 6048 posts |
Correct. There is actually some limited ELF support in Norcroft, but I don’t think it’s enough to allow it to be used end-to-end like with GCC. |
Pages: 1 2