Skip to content

Commit

Permalink
Informative error message in case of missing locale
Browse files Browse the repository at this point in the history
  • Loading branch information
OfekShilon committed Mar 1, 2025
1 parent 9c0336c commit cca9b0d
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,15 @@ AsmParserConfiguration getConfigurationFromCommandline(const int argc, const cha

int main(int argc, const char **argv)
{
std::locale loc("en_US.UTF-8");
std::locale::global(loc);
try {
std::locale loc("en_US.UTF-8");
std::locale::global(loc);
} catch (const std::runtime_error& e) {
std::cerr << "Failed to set locale: " << e.what() << std::endl;
std::cerr << "Please make sure that the locale is installed on your system:" << std::endl;
std::cerr << "$ sudo apt-get install locales" << std::endl;
std::cerr << "$ locale-gen en_US.UTF-8" << std::endl;
}

AsmParser::global_start_timer();

Expand Down

0 comments on commit cca9b0d

Please sign in to comment.