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
  • 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.

    I'm not sure what you mean by this above.

    Also, what is the CheriConfig module imported in the postgres.py script and what is the purpose of this?

    And looking at the configure script, the portion of the script that is erroring out is this:

    #
    # Define HAVE_NO_PRINTF_Z to make it possible to disable test cases that
    # depend on %zu.
    #
    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether printf(3) supports the z length modifier" >&5
    $as_echo_n "checking whether printf(3) supports the z length modifier... " >&6; }
    if test "$cross_compiling" = yes; then :
    { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
    $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
    as_fn_error $? "cannot run test program while cross compiling
    See \`config.log' for more details" "$LINENO" 5; }
    else
    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
    /* end confdefs.h. */

    However, I'm not sure which environment variable I have to manipulate to bypass these checks. I am guessing it is HAVE_NO_PRINTF_Z but I am not sure if that is even an environment variable, or how to define that in the Python build script. In the configure.ac file, the following is defined:

    AC_DEFINE(HAVE_NO_PRINTF_Z, 1,
    [Define to 1 if printf(3) does not support the z length modifier.])

    So my question is how do I manipulate the configure.ac file through the Python build scripts for my project?

Reply
  • 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.

    I'm not sure what you mean by this above.

    Also, what is the CheriConfig module imported in the postgres.py script and what is the purpose of this?

    And looking at the configure script, the portion of the script that is erroring out is this:

    #
    # Define HAVE_NO_PRINTF_Z to make it possible to disable test cases that
    # depend on %zu.
    #
    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether printf(3) supports the z length modifier" >&5
    $as_echo_n "checking whether printf(3) supports the z length modifier... " >&6; }
    if test "$cross_compiling" = yes; then :
    { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
    $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
    as_fn_error $? "cannot run test program while cross compiling
    See \`config.log' for more details" "$LINENO" 5; }
    else
    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
    /* end confdefs.h. */

    However, I'm not sure which environment variable I have to manipulate to bypass these checks. I am guessing it is HAVE_NO_PRINTF_Z but I am not sure if that is even an environment variable, or how to define that in the Python build script. In the configure.ac file, the following is defined:

    AC_DEFINE(HAVE_NO_PRINTF_Z, 1,
    [Define to 1 if printf(3) does not support the z length modifier.])

    So my question is how do I manipulate the configure.ac file through the Python build scripts for my project?

Children