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

cheribuild - Adding a new target

Hi there,

I am trying to add Mosquitto (MQTT) as a cheribuild target. This is my current Python script:

from .crosscompileproject import CrossCompileCMakeProject, GitRepository
from ...config.compilation_targets import CompilationTargets

class BuildMqtt(CrossCompileCMakeProject):
    target = "mqtt"
    repository = GitRepository("">github.com/.../mosquitto")
    supported_architectures = CompilationTargets.ALL_FREEBSD_AND_CHERIBSD_TARGETS + [CompilationTargets.NATIVE]

When running ./cheribuild mqtt-morello-purecap to build the target, I run into this error message:

CMake Error at man/CMakeLists.txt:29 (message):
xsltproc not found: manpages cannot be built


-- Configuring incomplete, errors occurred!

Looking at the MQTT Git repository here and in the "Building from source" section, I can add the CMake option "WITH_DOCS=no" which disables checking for the optional build dependency xsltproc to generate man pages which I don't need. With these changes my build script now looks like this:

from .crosscompileproject import CrossCompileCMakeProject, GitRepository
from ...config.compilation_targets import CompilationTargets

class BuildMqtt(CrossCompileCMakeProject):
    target = "mqtt"
    repository = GitRepository("">github.com/.../mosquitto")
    supported_architectures = CompilationTargets.ALL_FREEBSD_AND_CHERIBSD_TARGETS + [CompilationTargets.NATIVE]

    def setup(self):
    super().setup()
    self.add_cmake_options(WITH_DOCS=no)

Now when I attempt to run ./cheribuild.py mqtt-morello-purecap again, I am presented with multiple errors:

Traceback (most recent call last):
File "./cheribuild.py", line 42, in <module>
main()
File "/home/ubuntu/cheribuild/pycheribuild/__main__.py", line 258, in main
run_and_kill_children_on_exit(real_main)
File "/home/ubuntu/cheribuild/pycheribuild/processutils.py", line 771, in run_and_kill_children_on_exit
fn()
File "/home/ubuntu/cheribuild/pycheribuild/__main__.py", line 248, in real_main
target_manager.run(cheri_config)
File "/home/ubuntu/cheribuild/pycheribuild/targets.py", line 435, in run
target.execute(config)
File "/home/ubuntu/cheribuild/pycheribuild/targets.py", line 129, in execute
self._do_run(config, msg="Built", func=lambda project: project.process())
File "/home/ubuntu/cheribuild/pycheribuild/targets.py", line 107, in _do_run
project.setup()
File "/home/ubuntu/cheribuild/pycheribuild/projects/cross/mqtt.py", line 11, in setup
self.add_cmake_options(WITH_DOCS=no)
NameError: name 'no' is not defined

Any ideas why this section below in particular is occurring? Or any ideas on how to skip the checking for the xsltproc optional dependency?

File "/home/ubuntu/cheribuild/pycheribuild/projects/cross/mqtt.py", line 11, in setup
self.add_cmake_options(WITH_DOCS=no)
NameError: name 'no' is not defined

Thanks!

Parents
  • Another quick question on this. Do I have to use an upstream Git repository as I have with this Python script, or can I use another method such as referencing a local directory if I have already downloaded the source manually? Or maybe another method? Thanks

    If you have a local directory with sources you can use 

    repository = ExternallyManagedSourceRepository()

    to skip the update step for cheribuild. You will have to ensure the sources are in the expected directory or manually set the "<project>/source-directory" config option.

    checking whether printf(3) supports the z length modifier... configure: error: in `/home/ubuntu/tcpdump':
    configure: error: cannot run test program while cross compiling
    See `config.log' for more details

    Autotools is a terrible "build system" so often requires various workarounds when cross-compiling. The same issue happened with PostgreSQL and there the workaround is:

                # tell postgres configure that %zu works in printf()
                self.add_configure_and_make_env_arg("PRINTF_SIZE_T_SUPPORT", "yes")

    However, since autotools build scripts are essentially just shell scripts that use arbitrary variable naming conventions, tcpdump may well be using a different environment variable for this. You'll have to look at the generated configure script to find out which variable they decided to use.

Reply
  • Another quick question on this. Do I have to use an upstream Git repository as I have with this Python script, or can I use another method such as referencing a local directory if I have already downloaded the source manually? Or maybe another method? Thanks

    If you have a local directory with sources you can use 

    repository = ExternallyManagedSourceRepository()

    to skip the update step for cheribuild. You will have to ensure the sources are in the expected directory or manually set the "<project>/source-directory" config option.

    checking whether printf(3) supports the z length modifier... configure: error: in `/home/ubuntu/tcpdump':
    configure: error: cannot run test program while cross compiling
    See `config.log' for more details

    Autotools is a terrible "build system" so often requires various workarounds when cross-compiling. The same issue happened with PostgreSQL and there the workaround is:

                # tell postgres configure that %zu works in printf()
                self.add_configure_and_make_env_arg("PRINTF_SIZE_T_SUPPORT", "yes")

    However, since autotools build scripts are essentially just shell scripts that use arbitrary variable naming conventions, tcpdump may well be using a different environment variable for this. You'll have to look at the generated configure script to find out which variable they decided to use.

Children