How to build Toolbox application using GCC?
Pages: 1 2
Aleksey Murushkin (Cloverleaf) (8233) 41 posts |
Hello. Thanks |
|
Andrew Rawnsley (492) 1445 posts |
I’m not sure if many people have experience of using Toolbox (only supplied with Acorn/Castle/ROOL C tools) and GCC (free). You’d probably need to recompile the Toolbox supporting libraries with GCC maybe first? Might be better to just use ordinary Templates files rather than Toolbox resources and OSLib (or DeskLib?) to do things there. That’d be a closer map to the ROOL programmers’ wiki pages on here (the online Programmers Reference Manuals) as OSlib is very close to the base SWIs. Steve F might also have some suggestions on this, as he wrote some excellent wimp-C-programming guides. Ultimately, the difficulty you’ll have using Toolbox is that only a subset of the community use/understand Toolbox. Most others have older libraries that they use/are familiar with, and haven’t found a need for Toolbox’s more high-level facilities. Also, from personal experience, Toolbox only takes you so far, eventually you’ll be using the low-level SWIs to do something that Toolbox wasn’t envisioned for. Also, for curl, there’s a command-line curl port which can be called from your code (eg. in the background as a taskwindow or something) which could help too. Or, Rick M may be able to document how he’s used the OS-supplied http fetchers to download stuff for use with his Manga application? That’d avoid the need to hook in curl. |
|
Andrew Rawnsley (492) 1445 posts |
Further thought… The toolbox is entirely SWI-based at heart, so the libraries that go with it are merely veneers to the modules. The source for those libraries may be in the C tools distribution, or if not, it’ll be in the RISC OS source tree (or should be). That should allow the libraries to be rebuilt with GCC. If using with ported code, you may wish to use the more recent ELF shared-lib GCC stuff – GCCSDK and possibly cross-compiling. I’m fairly certain that curl already exists as a shared library and if you create a toolbox sharedlib, that would probably be rather elegant solution. |
|
Michael Grunditz (467) 531 posts |
There is a toobox header in oslib (oslib/toolbox.h) so it might work, but I never tried. |
|
Aleksey Murushkin (Cloverleaf) (8233) 41 posts |
Thanks for your answer. unfortunately at the moment i can’t try to compile using GCCSDK from a linux machine as too much dependencies are not building and needs to fix it manually. So that is why i am trying to build from RISC OS machine. I could compile a code which incudes curl using gcc compiler but still was not successfull to build both curl + some ui example. at the moment i tried without success to build the Desklib examples with gcc, hovewer it seems to have an example code and make files for gcc compiler, it did not work for me. where i can read about OS-supplied http fetchers? I cant find anything about it in PRMs |
|
Aleksey Murushkin (Cloverleaf) (8233) 41 posts |
One more question. |
|
Michael Grunditz (467) 531 posts |
Here is a example in using oslib with toolbox: Those headers are for DDE and not GCC (they are not compatible) I strongly recommend using OSLib. If you want to use curl and other uninxy libs , use GCCSDK. I have a VirtualBox VM, that I build in. Just follow the build instructions (which also mentiones a compatible ubuntu version). Don’t expect RISC OS to behave anything near some kind of linux! |
|
Rick Murray (539) 13840 posts |
An example of using the fetchers – but note that the program got messed up in the copy-paste, so note the corrections the follow. https://www.riscosopen.org/forum/forums/4/topics/14691 The actual specs are in the “Docs” directory of the relevant sources. I really ought to write a blog article about this soon…….. |
|
Aleksey Murushkin (Cloverleaf) (8233) 41 posts |
Yes I have installed Ubuntu on VM and build GCCSDK. but i cant to build anything with autobuilder. it always cant patch sources because they are different at the moment and it is a big pain to patch all of them one by one. Thats is why I am trying to find a way how to build something with UI and http sending-receiving libs inside RISC OS. |
|
Chris Gransden (337) 1207 posts |
The patches not applying is probably due to debian buster recently being released. If you edit the file ‘fetch-program’ and look for the line with distros=“stable oldstable” and change it to distros=“oldstable”. If running linux from a VM the most compatible OS to use seems to be Ubuntu 16.0.4. Anything newer can cause problems building certain packages. |
|
Chris Gransden (337) 1207 posts |
If you’re looking for a simple example toolbox wimp app I can make one available for download including an example makefile. It’s a JPEG viewer using the OS routines built with GCCSDK using the OSLib and OSLibSupport library. It’s just a case of building OSLIb using the GCCSDK autobuilder. |
|
Chris Gransden (337) 1207 posts |
You can download jpegview including source and makefile here. |
|
Chris Mahoney (1684) 2165 posts |
At this point I’ll just plug my (admittedly unfinished) HTTPLib, which wraps the system-wide HTTP modules and makes them more “C-like”. |
|
Michael Grunditz (467) 531 posts |
EDIT: link http://www.update.uu.se/~micken/minapp_gcc.zip Here we go , this build with GCCSDK, you just need to add OSLibSupport headers: And ObeyFile: /**************************************************/
#include #define Wimp_MQuit 0×0
int quit_event(int event_code, toolbox_o *id_block,void *handle) } /*
int quit_message(wimp_message *message,void *handle) } int main(void)
#if 1 #endif
} |
|
Aleksey Murushkin (Cloverleaf) (8233) 41 posts |
Thanks to everyone. I will try |
|
Aleksey Murushkin (Cloverleaf) (8233) 41 posts |
Well it seems I have another problem now. unfortunately compiline jpegview sources also failed with error conflicting types for ‘_kernel_oserror’. it comes from Systypes.h and unixlib/local.h. so i removed last one and it was built. did not check yet if it will work or not. so I am glad that something was built. but i cant compile libcurl3 now. dont have much luck for today. |
|
David Pitt (3386) 1248 posts |
OSLibSupport is a separate package. I tried the build on RISC OS and had to do this :- #include <stdlib.h> #include <oslib/wimp.h> #include <oslib/toolbox.h> #include "oslibsupport:h.Event" #include "oslibsupport:h.Wimptypes" gcc minapp.c -IOSLibSupport: -IOSLib: -LOSLib: -LOSLibSupport: -lOSLib32 -lOSLibSupport32 -o min I have not tried with GCCSDK. |
|
Chris Gransden (337) 1207 posts |
libcurl3 should build now if you try it again. Due to stable moving to old-stable the version it was trying to build no longer exists. |
|
Michael Grunditz (467) 531 posts |
In GCCSDK , for me OSLib32 and OSLibSupport32 was built at gcc build time. I just added the support headers from the riscos package (renaming from h.file to file/h). |
|
David Pitt (3386) 1248 posts |
Just in case it is of interest, to get this to work in RISC OS :- #include <stdlib.h> #include <oslib/wimp.h> #include <oslib/toolbox.h> #include <oslibsupport/Event.h> #include <oslibsupport/Wimptypes.h> a slight reorganisation of Add an |
|
Andrew McCarthy (3688) 605 posts |
I’ve downloaded GCC, Make, .., OSLib, including OSLibSupport from Packman and, attempting to compile the example MinApp from minapp_gcc.zip Still, when I compile the code, as expected, I get an error Event library not found. What are the default #include paths to Event.h and Wimptypes.h on RISC OS? The answer above suggests that OSLibSupport package needs a restructure for it to work on RISC OS. |
|
Chris Johnson (125) 825 posts |
I do not think that is true. It works fine if the DDE is being used. The question is what paths have been set up to point to oslib and oslibsupport. Also check that there aren’t any other libraries that have similarly named files. I found it was necessary to make sure that the include paths and lib paths pointed unambiguously to the oslib/support files, and that the appropriate #includes in the source files had the correct path prefix. That was with the DDE. I have never used GCC in anger. |
|
Andrew McCarthy (3688) 605 posts |
Cheers… ;) OSLibSupport works out of the box with the following:
So for path consistency you could also add the directory oslibsupport to the !OSLibSupp.elf-unixlib directory, copying in the associated h directory. |
|
Chris Gransden (337) 1207 posts |
You shouldn’t need to change anything. The correct paths are already set up depending on which setvars file is double clicked on. Just needs the following include paths when compiling.
|
|
Andrew McCarthy (3688) 605 posts |
True. However, the example contains the following
Compiling on RISC OS with GCC
To fix that you need
|
Pages: 1 2