Hi there,
I am trying to add Mosquitto (MQTT) as a cheribuild target. This is my current Python script:
from .crosscompileproject import CrossCompileCMakeProject, GitRepositoryfrom ...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:
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 setupself.add_cmake_options(WITH_DOCS=no)NameError: name 'no' is not defined
Thanks!
After researching further into this, it seems to not be a problem at all with printf() supporting the z length modifier, but instead, the configure script is erroring out because it is trying to run tests, which it cannot do because the target binary is being cross-compiled and doesn't understand it. Output from the configure script:
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 compilingSee \`config.log' for more details" "$LINENO" 5; }else cat confdefs.h - <<_ACEOF >conftest.$ac_ext/* end confdefs.h. */
Is there a way I can amend the Python build script to include a Site Default which includes: cross_compiling=no to skip this test?
cross_compiling is being set to yes at this portion of the configure script when checking if the build machine is the same as the target machine:
elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes
So I managed to disable this from happening manually by editing out....as_fn_error
from the configure script to stop it erroring and cancelling the build. It now builds just fine. I am still unsure how this would equate to amendments to a Python build script.
That is far from a fix, and may be causing subtle mis-compiles. The correct thing to do is to find out what the test is doing, find out what variable it's using for the test result and manually specify the value for the variable so the test is skipped, normally via something like self.add_configure_vars(ac_cv_foo="bar") in your target's setup function.