This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

CheriBSD Morello FVP Pure-Capability - How to cross-compile from source?

Hi there,

I am trying to cross-compile curl from source to CheriBSD Morello FVP Pure-Capability. I have made a note of all the library and package dependencies listed here: https://packages.ubuntu.com/focal/curl and downloaded the original source files for each using the download links provided.

Normally, when compiling for the host system I'm on, I would just use the ./configure scripts provided with each source download, then run make to compile, and make install to install the software. How would I go about cross-compiling curl for CheriBSD Pure-Capability with the Morello FVP? I heard it is possible to make a new target for cheribuild, but looking at the wiki and the guide there on how to do so, I have no idea where to start or what is required. Or maybe it is still possible to use the ./configure scripts, but cross-compile with them?

Thanks in advance!

Parents
  • Several points:

    1. Downloading Ubuntu's package sources is not a great idea. If you download and extract the .dsc then you'll get all the Ubuntu patches applied plus all the debian/ folder containing Debian/Ubuntu packaging stuff that's irrelevant. If you just download the .orig.tar.gz/xz then you might as well just get the sources from upstream. Moreover, it's generally best to clone upstream git repositories; if you need to make modifications then you actually can do so easily and push to a fork, without being stuck without a VCS.

    2. That page lists the binary run-time dependencies, not the build-time dependencies, which are on the *source* package page at https://packages.ubuntu.com/source/focal/curl. However, those dependencies are just for whatever Ubuntu's curl configuration needs, they don't reflect the minimal set required by upstream. Given the wide portability of curl my guess is you don't need any dependencies for the core functionality beyond what's in the FreeBSD (and thus CheriBSD) base system (which includes OpenSSL), but when looking at things like this it's generally best to look at upstream documentation as it often lists what's required and what's optional, rather than just an arbitrary list a distribution decided on.

    3. You can absolutely use ./configure just as with any other cross-compiler, you just have to make sure you set CC, CFLAGS and LDFLAGS appropriately, and whatever else the configure script might need, to point at your Morello LLVM and tell Morello LLVM to target pure-capability Morello (and with --sysroot=/path/to/rootfs-morello-purecap so all the headers and libraries needed during the build can be found). The autoconf-specific part of this is widely documented online, and the Morello-specific flags you need are documented in Arm's Morello LLVM user guide at https://git.morello-project.org/morello/llvm-project-releases/-/blob/morello/release-docs-1.1/UserGuide.pdf. Of course, cheribuild deals with all this for you if you want to use that instead. The wiki page's libffi example should be a good starting point, as both curl and libffi are autotools-based projects whose git repositories require you to first generate the configure script (though curl doesn't have a script for it, the documentation just says to run autoreconf -fi).

Reply
  • Several points:

    1. Downloading Ubuntu's package sources is not a great idea. If you download and extract the .dsc then you'll get all the Ubuntu patches applied plus all the debian/ folder containing Debian/Ubuntu packaging stuff that's irrelevant. If you just download the .orig.tar.gz/xz then you might as well just get the sources from upstream. Moreover, it's generally best to clone upstream git repositories; if you need to make modifications then you actually can do so easily and push to a fork, without being stuck without a VCS.

    2. That page lists the binary run-time dependencies, not the build-time dependencies, which are on the *source* package page at https://packages.ubuntu.com/source/focal/curl. However, those dependencies are just for whatever Ubuntu's curl configuration needs, they don't reflect the minimal set required by upstream. Given the wide portability of curl my guess is you don't need any dependencies for the core functionality beyond what's in the FreeBSD (and thus CheriBSD) base system (which includes OpenSSL), but when looking at things like this it's generally best to look at upstream documentation as it often lists what's required and what's optional, rather than just an arbitrary list a distribution decided on.

    3. You can absolutely use ./configure just as with any other cross-compiler, you just have to make sure you set CC, CFLAGS and LDFLAGS appropriately, and whatever else the configure script might need, to point at your Morello LLVM and tell Morello LLVM to target pure-capability Morello (and with --sysroot=/path/to/rootfs-morello-purecap so all the headers and libraries needed during the build can be found). The autoconf-specific part of this is widely documented online, and the Morello-specific flags you need are documented in Arm's Morello LLVM user guide at https://git.morello-project.org/morello/llvm-project-releases/-/blob/morello/release-docs-1.1/UserGuide.pdf. Of course, cheribuild deals with all this for you if you want to use that instead. The wiki page's libffi example should be a good starting point, as both curl and libffi are autotools-based projects whose git repositories require you to first generate the configure script (though curl doesn't have a script for it, the documentation just says to run autoreconf -fi).

Children
No data