ladybird
ladybird copied to clipboard
Build instructions fail on Mint Virginia (1. lsb_release gets wrong codename & 2. clang can’t find <iostream>)
I precisely followed the instructions at
https://github.com/LadybirdBrowser/ladybird/blob/master/Documentation/BuildInstructionsLadybird.md
and it failed for two reasons; the second of which I could not solve.
- Adding the repository and GPG key calls
lsb_release -sc, which returns “virginia” here, instead of “jammy” which it is based on. → This was easy to solve, by editingsed 's/virginia/jammy/g' /etc/apt/sources.list.d/llvm.list. Yes, the instructions say Ubuntu, and not Mint. But this is the first time that claused problems, and since Mint is more popular AFAIK, it’s probably a good idea to support it. Should be easy too. - After continuing to follow the instructions with the fixed codename,
./Meta/ladybird.sh run ladybirdfails too, because according to./Toolchain/Build/cmake/Bootstrap.cmk/cmake_bootstrap.log,cmake_bootstrap_109383_test.cxx:2:10: fatal error: 'iostream' file not found.
Here’s the full log: cmake_bootstrap.log
I’m not a C++ programmer, so I have no idea why it can’t find iostream.
OK, I managed to fix it myself.
The reason was, that apparently, clang uses g++ or its libraries or something, and there, an old version was installed because Mint is essentially Ubuntu LTS, and the alternatives system was pointing to the wrong version too. So installing the newest version available, and tinkering with update-alternatives to an uncomfortable level fixed it.
Since I don’t know exactly which steps of what I did were necessary, I can’t post them. I was something along the lines of installing g++-13 (with its library package), and adapting this ask Ubuntu answer: https://askubuntu.com/questions/26498/how-to-choose-the-default-gcc-and-g-version … (I have my doubts that update-alternatives is able to keep this from breaking some time in the future, because of how primitive it is. So this is only a crutch.)
It would of course still be much appreciated, if somebody could update the build instructions to they work and keep working on Mint too… :)
I'm also on Linux Mint 21.3 and did the following after following the normal build instructions:
Install the newest C++ standard library:
sudo apt install libstdc++-12-dev
Install clang-18: (taken from https://ubuntuhandbook.org/index.php/2023/09/how-to-install-clang-17-or-16-in-ubuntu-22-04-20-04/)
wget https://apt.llvm.org/llvm.sh
chmod u+x llvm.sh
sudo ./llvm.sh 18
Not sure if this is required, but you may need to set the CC and CXX environment variables, too:
export CXX=/usr/bin/clang++-18
export CC=/usr/bin/clang-18
After that, you should be able to build & run ladybird.
Thanks @rmg-x, that was the missing piece. For me, the only requirement additional to the official instructions was sudo apt install libstdc++-12-dev. It automatically used clang-18. Although perhaps that's because I only have clang-18 installed.