Skip to content

Verilator build fails with “requires a C++14 or newer compiler” due to hard-coded -std=gnu++11

Is there an existing core-v-verif task for this?

  • I have searched the existing task issues

Task Description

While building cv32e40p/sim/core testbench using Verilator (v5.040), the generated makefiles still compile with -std=gnu++11, even when newer compilers and flags are provided. This causes the build to fail with:

/usr/local/share/verilator/include/verilatedos.h:281:3: error: #error "Verilator requires a C++14 or newer compiler"

Environment:

Verilator: 5.040 (built with g++-11)

GCC: g++-11 (C++17 default)

Host: Ubuntu 24 / VirtualBox

Description of Done

Verilator builds should use a modern C++ standard (≥ C++14). Either:

Allow overriding -std via Makefile variables (VERI_FLAGS, VERI_COMPILE_FLAGS, etc.), or

Pass --compiler-flags to Verilator instead of -CFLAGS so user-defined flags appear after internal defaults.