ROMfs error in building px4_sitl after toolchain installation

I have followed the toolchain installation process given for ubuntu 18.04 in Ubuntu Development Environment | PX4 User Guide, however when I try to
make px4_sitl gazebo
I am facing the following error :

FAILED: etc/init.d/rc.serial etc/init.d/rc.autostart etc/init.d/ ROMFS/romfs_copy.stamp 

I had to install gazebo 9 and a couple of modules as it had not been installed by the script in Tools/setup, and I am using the main branch of the px4-autopilot repo.
Here is my terminal output after I execute the make px4-sitl gazebo command :

[0/873] git submodule src/drivers/gps/devices
[2/873] ROMFS: copying, generating airframes
FAILED: etc/init.d/rc.serial etc/init.d/rc.autostart etc/init.d/ ROMFS/romfs_copy.stamp 
cd /home/barracuda/pix/PX4-Autopilot/build/px4_sitl_default/etc && /usr/bin/cmake -E remove_directory /home/barracuda/pix/PX4-Autopilot/build/px4_sitl_default/etc/* && /usr/bin/cmake -E tar xf /home/barracuda/pix/PX4-Autopilot/build/px4_sitl_default/romfs_files.tar && /usr/bin/python3 /home/barracuda/pix/PX4-Autopilot/Tools/ --airframes-path /home/barracuda/pix/PX4-Autopilot/build/px4_sitl_default/etc/init.d --start-script /home/barracuda/pix/PX4-Autopilot/build/px4_sitl_default/etc/init.d/rc.autostart --board px4_sitl && /usr/bin/python3 /home/barracuda/pix/PX4-Autopilot/Tools/serial/ --rc-dir /home/barracuda/pix/PX4-Autopilot/build/px4_sitl_default/etc/init.d --serial-ports --ethernet --config-files /home/barracuda/pix/PX4-Autopilot/src/lib/battery/module.yaml /home/barracuda/pix/PX4-Autopilot/src/drivers/gps/module.yaml /home/barracuda/pix/PX4-Autopilot/src/drivers/osd/msp_osd/module.yaml /home/barracuda/pix/PX4-Autopilot/src/modules/control_allocator/module.yaml /home/barracuda/pix/PX4-Autopilot/src/modules/mavlink/module.yaml /home/barracuda/pix/PX4-Autopilot/src/modules/payload_deliverer/module.yaml /home/barracuda/pix/PX4-Autopilot/src/modules/sensors/module.yaml /home/barracuda/pix/PX4-Autopilot/src/modules/simulation/pwm_out_sim/module_sim.yaml && /usr/bin/cmake -E touch /home/barracuda/pix/PX4-Autopilot/build/px4_sitl_default/ROMFS/romfs_copy.stamp
CMake Error: cmake version 3.10.2
Usage: /usr/bin/cmake -E <command> [arguments...]
Available commands: 
  capabilities              - Report capabilities built into cmake in JSON format
  chdir dir cmd [args...]   - run command in a given directory
  compare_files file1 file2 - check if file1 is same as file2
  copy <file>... destination  - copy files to destination (either file or directory)
  copy_directory <dir>... destination   - copy content of <dir>... directories to 'destination' directory
  copy_if_different <file>... destination  - copy files if it has changed
  echo [<string>...]        - displays arguments as text
  echo_append [<string>...] - displays arguments as text but no new line
  env [--unset=NAME]... [NAME=VALUE]... COMMAND [ARG]...
                            - run command in a modified environment
  environment               - display the current environment
  make_directory <dir>...   - create parent and <dir> directories
  md5sum <file>...          - create MD5 checksum of files
  sha1sum <file>...         - create SHA1 checksum of files
  sha224sum <file>...       - create SHA224 checksum of files
  sha256sum <file>...       - create SHA256 checksum of files
  sha384sum <file>...       - create SHA384 checksum of files
  sha512sum <file>...       - create SHA512 checksum of files
  remove [-f] <file>...     - remove the file(s), use -f to force it
  remove_directory dir      - remove a directory and its contents
  rename oldname newname    - rename a file or directory (on one volume)
  server                    - start cmake in server mode
  sleep <number>...         - sleep for given number of seconds
  tar [cxt][vf][zjJ] file.tar [file/dir1 file/dir2 ...]
                            - create or extract a tar or zip archive
  time command [args...]    - run command and return elapsed time
  touch file                - touch a file.
  touch_nocreate file       - touch a file but do not create it.
Available on UNIX only:
  create_symlink old new    - create a symbolic link new -> old

[12/873] Generating uORB topic headers
ninja: build stopped: subcommand failed.
Makefile:232: recipe for target 'px4_sitl' failed
make: *** [px4_sitl] Error 1