Cartographer SLAM building fail

Not sure if this is really a documentation error or just me not setting up my computer correctly, so I decide not to post this in General > Website and Documentation errors yet.

I found that the building instruction in Ardupilot wiki

which uses catkin build is not working on my machine. It shows numerous errors such as incomplete type/undefined variables/incorrect format/etc
catkin build

Other packages are fine though.

However, I found the solution was to compile as written in Cartographer’s wiki

which uses catkin_make_isolated --install --use-ninja. The build would be successful

I’m using Ubuntu 18.04 with ROS melodic.

If anyone had worked on something similar, please verify if this only happens on me or not.
If this is not my problem, I would suggest updating the guideline in Ardupilot wiki.