• Re: DeskLib and GCCSDK

    From Steve Fryatt@news@stevefryatt.org.uk to comp.sys.acorn.programmer on Tue Jun 16 15:28:13 2020
    From Newsgroup: comp.sys.acorn.programmer

    Well, I finally got back to looking at this...

    I can now mostly build WinEd from source, although I've had to comment
    some code out for now to make it compile.

    One oddity is that it seems to include an Error.c source file which GCC
    thinks duplicates the Error.c in DeskLib. This appears to be to allow
    WinEd to set its own error box titles, but there seems to be no way to
    get the linker to pick WinEd's Error.o over the one in DeskLib (although
    the DeskLib notes suggest that this is what should be done).

    On 2020-05-13, Martin <News03@avisoft.f9.co.uk> wrote:

    On 13 May in article <mpro.qa9ji90172vg40c85.news@stevefryatt.org.uk>,
    Steve Fryatt <news@stevefryatt.org.uk> wrote:

    This is version 3.20 (September 2008). The latest that I'm aware of
    is 3.21 (alpha), if you build from source.

    I would love to see WinEd made a little more stable, as it is my
    favourite template editor. Currently using a Titanium, previously
    RPi3 and Iyonix.

    [snip]

    But I maybe have the advantage of having v3.22a (Oct 2008) here!

    I don't suppose that you have the source to it and the associated
    DeskLib? Even the 3.20 tag from SVN references what I take to be a
    DeskLib function call (Pointer_SetPosition) which isn't in the DeskLib
    sources in SVN; it's not used in the 3.10 tag of WinEd, so it looks like
    a newish feature.

    It doesn't look like a big deal to recreate, but having the original
    code would be better.

    Also, the version of WinEd in SVN reports itself to be 3.21a, so
    presumably there are some other code mods that never made it into SVN.

    I was feeding back issues and suggestions to Adam before he lost
    interest, so it may be worth trying to contact hime if you have not
    already tried.

    I managed to find an address today which didn't bounce back immediately,
    so fingers crossed.
    --
    Steve Fryatt - Leeds, England

    http://www.stevefryatt.org.uk/
    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From Theo@theom+news@chiark.greenend.org.uk to comp.sys.acorn.programmer on Tue Jun 16 16:09:32 2020
    From Newsgroup: comp.sys.acorn.programmer

    Steve Fryatt <news@stevefryatt.org.uk> wrote:
    Well, I finally got back to looking at this...

    I can now mostly build WinEd from source, although I've had to comment
    some code out for now to make it compile.

    One oddity is that it seems to include an Error.c source file which GCC thinks duplicates the Error.c in DeskLib. This appears to be to allow
    WinEd to set its own error box titles, but there seems to be no way to
    get the linker to pick WinEd's Error.o over the one in DeskLib (although
    the DeskLib notes suggest that this is what should be done).

    I'm a bit puzzled by that - normally linking is done on a per-function
    basis, rather than a per-file basis. In other words you might have foo.o
    twice but if the functions don't overlap it's not a problem.

    I assume you're doing -lDeskLib rather than trying to link all the *.o from Desklib? Where does it talk about this in the Desklib notes?

    The other thing I'd try is changing the order on the link line so that it detects the right one first.

    Quick test (on a Mac):

    $ cat > test1.c
    int foo(int x) { return x*2; }
    $ mkdir subdir
    $ cat > subdir/test1.c
    int bar(int x) { return x*4; }
    $ cat > main.c
    int main(void) { return foo(bar(99)); }
    $ gcc -o test1 main.c test1.c subdir/test1.c
    [warnings about no prototypes for foo and bar]
    2 warnings generated.
    [succeeded]

    If I make a static library:

    $ gcc -c -o subdir/test1.o subdir/test1.c
    $ ar -r libtest1.a subdir/test1.o
    ar: creating archive libtest1.a
    $ gcc -o test1 main.c test1.c libtest1.a
    [succeeded]

    $ gcc -o test1 -L. main.c test1.c -ltest1
    [succeeded]

    It is possible to have 'weak symbols' by which the linker will pick a
    fallback function if one isn't explicitly declared - perhaps this is what
    it's talking about?
    https://en.wikipedia.org/wiki/Weak_symbol
    (Unixlib has used them for years, but I'm not sure if Norcroft supports
    them)

    I don't suppose that you have the source to it and the associated
    DeskLib? Even the 3.20 tag from SVN references what I take to be a
    DeskLib function call (Pointer_SetPosition) which isn't in the DeskLib sources in SVN; it's not used in the 3.10 tag of WinEd, so it looks like
    a newish feature.

    It doesn't look like a big deal to recreate, but having the original
    code would be better.

    Also, the version of WinEd in SVN reports itself to be 3.21a, so
    presumably there are some other code mods that never made it into SVN.

    If anyone wants commit access to SVN to tidy things up, I'm happy to arrange that...

    Theo
    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From Martin@News03@avisoft.f9.co.uk to comp.sys.acorn.programmer on Tue Jun 16 17:28:36 2020
    From Newsgroup: comp.sys.acorn.programmer

    On 16 Jun in article <slrnrehlnt.mvq.news@stevefryatt.org.uk>, Steve
    Fryatt <news@stevefryatt.org.uk> wrote:
    But I maybe have the advantage of having v3.22a (Oct 2008) here!

    I don't suppose that you have the source to it and the associated
    DeskLib? Even the 3.20 tag from SVN references what I take to be a
    DeskLib function call (Pointer_SetPosition) which isn't in the
    DeskLib sources in SVN; it's not used in the 3.10 tag of WinEd, so
    it looks like a newish feature.

    It doesn't look like a big deal to recreate, but having the
    original code would be better.

    No, sorry. Although I have lots of emails from 2008/9 about bugs and developments, and several different beta versions, the last source I
    have is v3.20

    When you get to the stage of having a compilable working version I
    would be happy to dig out any info about bugs & changes after that
    point in development - and even to beta test it, if that would help.
    There are certainly some ZeroPain bugs which could do with sorting!

    Adam's snowstone riscos website page is still available, so I would
    have expected the associated emails to still work - but maybe not.

    I hope you manage to make progress!

    Martin
    --
    Martin Avison
    Note that unfortunately this email address will become invalid
    without notice if (when) any spam is received.
    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From Steve Fryatt@news@stevefryatt.org.uk to comp.sys.acorn.programmer on Tue Jun 16 19:03:16 2020
    From Newsgroup: comp.sys.acorn.programmer

    On 16 Jun, Theo wrote in message
    <Coy*RGJUx@news.chiark.greenend.org.uk>:

    Steve Fryatt <news@stevefryatt.org.uk> wrote:

    One oddity is that it seems to include an Error.c source file which GCC thinks duplicates the Error.c in DeskLib. This appears to be to allow
    WinEd to set its own error box titles, but there seems to be no way to
    get the linker to pick WinEd's Error.o over the one in DeskLib (although the DeskLib notes suggest that this is what should be done).

    I'm a bit puzzled by that - normally linking is done on a per-function
    basis, rather than a per-file basis. In other words you might have foo.o twice but if the functions don't overlap it's not a problem.

    I assume you're doing -lDeskLib rather than trying to link all the *.o
    from Desklib? Where does it talk about this in the Desklib notes?

    Yes, that's what I thought... The Error.h in DeskLib says

    : This header provides centralised error reporting routines, and a few
    : macros to help with error reporting.

    : This idea is that if you want to replace these with your own error
    : reporting routines you can just link against your set instead and keep the
    : function prototypes the same. An example of this is linking against
    : Desklib:o.Other.SmError which provides command-line output of errors by
    : writing them to stderr.

    Then WinEd has its own Error.c file, which contains duplicates of some of
    the routines defined in DeskLib's Error.c and Error.h, which appear to do
    most of the same things in different ways.

    The other thing I'd try is changing the order on the link line so that it detects the right one first.

    The Makefile does

    linkflags = -mlibscl -o ../!RunImage,ff8
    libraries = -L$(GCCSDK_INSTALL_ENV)/lib -lDesk-scl -lFlexLib32

    # Default rule
    ../!RunImage,ff8 : $(objects)
    $(CC) $(linkflags) $(objects) $(libraries)

    The order of $(objects) $(libraries) in the parameter list just affects
    which of the two definitions GCC reports as being the original. $(objects) contains the Error.o from WinEd, amongst the other WinEd object files.

    Also, the version of WinEd in SVN reports itself to be 3.21a, so
    presumably there are some other code mods that never made it into SVN.

    If anyone wants commit access to SVN to tidy things up, I'm happy to
    arrange that...

    It might be useful... :-)

    I've already got access to the Tokenize repo, although it's been a while
    since I used it.
    --
    Steve Fryatt - Leeds, England

    http://www.stevefryatt.org.uk/
    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From Theo@theom+news@chiark.greenend.org.uk to comp.sys.acorn.programmer on Tue Jun 16 22:24:04 2020
    From Newsgroup: comp.sys.acorn.programmer

    Steve Fryatt <news@stevefryatt.org.uk> wrote:
    On 16 Jun, Theo wrote in message
    <Coy*RGJUx@news.chiark.greenend.org.uk>:
    Yes, that's what I thought... The Error.h in DeskLib says

    : This header provides centralised error reporting routines, and a few
    : macros to help with error reporting.

    : This idea is that if you want to replace these with your own error
    : reporting routines you can just link against your set instead and keep the : function prototypes the same. An example of this is linking against
    : Desklib:o.Other.SmError which provides command-line output of errors by
    : writing them to stderr.

    Then WinEd has its own Error.c file, which contains duplicates of some of
    the routines defined in DeskLib's Error.c and Error.h, which appear to do most of the same things in different ways.

    Hmm, so SmError comes from:
    !DLUser.Libraries.SmallError.Error/c
    in websvn: http://www.riscos.info/websvn/listing.php?repname=DeskLib&path=%2Ftrunk%2F%21DLUser%2FLibraries%2FSmallError%2F&#a0df80822861e2ae3e282c05e0ce1f455

    However that just puts it in a library and doesn't link with anything.

    The Makefile does

    linkflags = -mlibscl -o ../!RunImage,ff8
    libraries = -L$(GCCSDK_INSTALL_ENV)/lib -lDesk-scl -lFlexLib32

    # Default rule
    ../!RunImage,ff8 : $(objects)
    $(CC) $(linkflags) $(objects) $(libraries)

    The order of $(objects) $(libraries) in the parameter list just affects
    which of the two definitions GCC reports as being the original. $(objects) contains the Error.o from WinEd, amongst the other WinEd object files.

    I wonder if Norcroft will pick the first function it finds and ignore the others. For GCC you can try:
    -Wl,--allow-multiple-definition

    which will pass that the --allow-multiple-definition flag to the linker.

    It might be useful... :-)

    I've already got access to the Tokenize repo, although it's been a while since I used it.

    I've given you access to the WinEd and DeskLib repos, have fun :)

    Theo
    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From Steve Fryatt@news@stevefryatt.org.uk to comp.sys.acorn.programmer on Tue Jun 16 22:19:14 2020
    From Newsgroup: comp.sys.acorn.programmer

    On 16 Jun, Martin wrote in message
    <5881986a94News03@avisoft.f9.co.uk>:

    No, sorry. Although I have lots of emails from 2008/9 about bugs and developments, and several different beta versions, the last source I have
    is v3.20

    I've made contact with Adam; he was very helpful, but doesn't have the
    sources any more. There's a chance that he didn't commit the DeskLib changes needed by WinEd 3.20 and later, but it was a long time ago!

    That said, I think I've now filled in the missing function[1], so with the Error.c file removed from WinEd's makefile and one other hack to get around what the WinEd source describes as a "bodge", I can build an apparently
    working version 3.21a.

    It still crashes on my system in the usual places, however!

    When you get to the stage of having a compilable working version I would
    be happy to dig out any info about bugs & changes after that point in development - and even to beta test it, if that would help. There are certainly some ZeroPain bugs which could do with sorting!

    If you have any info, it would be useful. I'm not going to promise to
    recreate 3.22a, but knowing what was being done might be handy.

    For now, I'll go hunting an Abort on Data Transfer. :-)


    1. I won't lie: it wasn't a difficult one. :-)
    --
    Steve Fryatt - Leeds, England

    http://www.stevefryatt.org.uk/
    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From Steve Fryatt@news@stevefryatt.org.uk to comp.sys.acorn.programmer on Tue Jun 16 23:47:42 2020
    From Newsgroup: comp.sys.acorn.programmer

    On 16 Jun, Theo wrote in message
    <Coy*D4KUx@news.chiark.greenend.org.uk>:

    I wonder if Norcroft will pick the first function it finds and ignore the others. For GCC you can try: -Wl,--allow-multiple-definition

    which will pass that the --allow-multiple-definition flag to the linker.

    That's brilliant... thank you! It sorts all of the linker errors, apart from the missing DeskLib function. :-)

    With that, plus Lee's help on the GCCSDK list with the <DeskLib$Path> stuff, I'm down to one problem with AsAsm, which I can look into further.

    I've given you access to the WinEd and DeskLib repos, have fun :)

    Thanks!

    I've branched both, stuck the missing Pointer_ function into DeskLib and
    will start committing the the necessary changes to WinEd once I've sorted
    out the remaining little niggles with the build.
    --
    Steve Fryatt - Leeds, England

    http://www.stevefryatt.org.uk/
    --- Synchronet 3.21d-Linux NewsLink 1.2