Building and linking mbedTLS
Dave Gardner (8786) 27 posts |
Hi all, I’m trying to build and link to mbedTLS library. Here’s what I’ve tried to do so far.. Found the source within the “DiscDev” sources, and thus tried to build using Builder. Selected environment ROOL.BCM2835. Selected options: Clean, Export headers, Export libraries, Export resources. These options are mostly guesswork rather than an informed opinion on my part. This finishes up with: Error running make clean on module ‘Messages’ I’m not really sure what to expect here; I guess I was sort of hoping that somehow it would generate me an `o` and `h` for mbedTLS. The second thing I tried was just dragging the Makefile inside RiscOS.Sources.Lib.mbedTLS directly onto Amu. This seems to do a fair amount of stuff; generating many `o` files :) But then ends up failing with: cc -Wp -c -depend !Depend -DMBEDLS_CONFIG_FILE=“\”h.ro_config\"" -DRISCOS -ITCPIPLibs: -ff -fah -zM -o oz.entropy_poll c.entropy_poll Wondering if anyone else has managed to link against mbedTLS and can offer me some guidance to save me stumbling around in the dark! Thanks Dave |
Martin Avison (27) 1494 posts |
Just out of interest, why bother linking another copy of the library, rather than use the AcornSSL module which already includes it? |
Rick Murray (539) 13850 posts |
That thought crossed my mind, but then perhaps he needs access to the lower level stuff that AcornSSL doesn’t export? In an ideal world, the mbedTLS library will be its own module and other things (including AcornSSL) could make use of it, precisely to stop the need for multiple copies of the same thing (especially if things get out of step). But, this world is far from ideal… |
David Pitt (3386) 1248 posts |
Possibly a typo? Environment should be DiscDev.
This is not required for a DiscDev build, see the end of this page A bit later. |
Julie Stamp (8365) 474 posts |
Here’s how I did it:
|
Dave Gardner (8786) 27 posts |
Thanks for all the replies. I think that all I needed to do was change `ROOL.BCM2835` to `DiscDev`. I also got rid of Export resources. Then the disc built completely. My key error here being failing to read to the end of the documentation before diving in. :( Then changing the wimp-slot allowed me to run !MkExport successfully! The reason for wanting this is indeed to get access to bits of the low-level library. |
Dave Gardner (8786) 27 posts |
Follow up question (I think I’m nearly there) … As mentioned, I did manage to !MkExport, and now I’ve written a bunch of code that uses mbedTLS; I’ve even made it compile successfully! The final hurdle is a linker error. My assumption is there is some shared library I need to add to my LIBS. Right now I have this in my Makefile: LIBS = SFLib:o.SFLib OSLib:o.OSLib32 MbedTLS:o.mbedTLS But when I run Mk (this is all with Norcroft/DDE by the way) I get: ARM Linker: (Error) Undefined symbol(s). Does anyone know what library I need to be linking against for the `gettimeofday` function? Thanks in advance! All help most appreciated! |
Julie Stamp (8365) 474 posts |
That’s in TCPIPLibs:o.unixlib |
Dave Gardner (8786) 27 posts |
Amazing! Thanks Julie my app now builds! Really appreciate all the help. I think I now have most of the basic pieces I need integrated and building (mbedTLS, SQLite) so it’s now just a question of building the thing! |