Cannot install libsystemd with vcpkg, Redis challenge on C++

Hi everyone,

My work uses libsystemd extensively for its event loop (sd-event) and dbus client (sd-bus) library, so I would like to use it to do the Redis challenge.

I added libsystemd to vcpkg.json, but when building on remote, it failed:

Error log
remote: [build] > CMake Error at scripts/cmake/vcpkg_execute_required_process.cmake:127 (message):
remote: [build] >     Command failed: /usr/bin/python3 -I /vcpkg/downloads/tools/meson-1.3.2-d646d3/meson.py -Dmode=release -Dstatic-libsystemd=pic -Dtests=false -Ddns-over-tls=false -Dlz4=enabled -Dtranslations=false -Dxz=enabled -Dzstd=enabled --backend ninja --wrap-mode nodownload -Dbuildtype=plain -Doptimization=plain --libdir lib --native /vcpkg/buildtrees/libsystemd/meson-x64-linux-dbg.log -Ddebug=true --prefix /vcpkg/packages/libsystemd_x64-linux/debug --includedir ../include -Dcmake_prefix_path=['/app/vcpkg_installed/x64-linux/debug','/app/vcpkg_installed/x64-linux'] /vcpkg/buildtrees/libsystemd/src/v255-948a7f2e81.clean
remote: [build] >     Working Directory: /vcpkg/buildtrees/libsystemd/x64-linux-dbg
remote: [build] >     Error code: 1
remote: [build] >     See logs for more information:
remote: [build] >       /vcpkg/buildtrees/libsystemd/config-x64-linux-dbg-meson-log.txt.log
remote: [build] >       /vcpkg/buildtrees/libsystemd/config-x64-linux-dbg-out.log
remote: [build] > 
remote: [build] > Call Stack (most recent call first):
remote: [build] >   /app/vcpkg_installed/x64-linux/share/vcpkg-tool-meson/vcpkg_configure_meson.cmake:436 (vcpkg_execute_required_process)
remote: [build] >   /root/.cache/vcpkg/registries/git-trees/a69dc63dcb8666fd4fb3885193dc67889fe65c72/portfile.cmake:17 (vcpkg_configure_meson)
remote: [build] >   scripts/ports.cmake:192 (include)
remote: [build] > 
remote: [build] > 
remote: [build] > error: building libsystemd:x64-linux failed with: BUILD_FAILED
remote: [build] > See https://learn.microsoft.com/vcpkg/troubleshoot/build-failures?WT.mc_id=vcpkg_inproduct_cli for more information.
remote: [build] > Elapsed time to handle libsystemd:x64-linux: 7.4 s
remote: [build] > Please ensure you're using the latest port files with `git pull` and `vcpkg update`.
remote: [build] > Then check for known issues at:
remote: [build] >   https://github.com/microsoft/vcpkg/issues?q=is%3Aissue+is%3Aopen+in%3Atitle+libsystemd
remote: [build] > You can submit a new issue at:
remote: [build] >   https://github.com/microsoft/vcpkg/issues/new?title=[libsystemd]+Build+error+on+x64-linux&body=Copy+issue+body+from+%2Fapp%2Fvcpkg_installed%2Fvcpkg%2Fissue_body.md
remote: [build] > 
remote: [build] Error: process "/bin/sh -c vcpkg install --no-print-usage" did not complete successfully: exit code: 1.

My guess would be missing libtool and autoconf in the system path for vcpkg to build libsystemd correctly. Is there anyway to install those things on remote?

For now, I guess I will just put apt install libsystemd-dev inside the build script

You might want to tweak things in the .codecrafters folder. This doc explains how you can do that.

Yes, my current workaround is just install and git clone submodule inside the compile.sh script. But this seems like something that can be cached by Docker, hopefully there is some better way

1 Like