Failed to build MAVROS packages

I installed Ubuntu 18.04 version to download PX4 Autopilot, Gazebo and QGroundControl, but I cannot install Mavros packages. "failed <<mavros_msgs : cmake " is written in the console and only installing 1 of 7 packages are succeeded. Also, there is a note at the bottom of the console and it says “Workspace packages have changed, please re-source setup files to use them”. Please could you help me if anyone has any ideas? Thanks.