Are you building like FPGA bitstreams or something? 4 hours seems insanely long for software unless it is literally millions upon millions of lines of code
Maybe it's an aggressively optimizing and correctness-checking C++ compiler. GCC, clang can take a long time depending on complexity of code and flags provided.