Skip to content

Commit

Permalink
Fix the compilation of blaze_startup_options.cc on old Ubuntu systems.
Browse files Browse the repository at this point in the history
Ubuntu LTS has a gcc version that generates broken code for certain newer C++
constructs. Change the code to avoid those constructs.

Fixes #68.

--
Change-Id: 4a0420a
MOS_MIGRATED_REVID=90739507
  • Loading branch information
ulfjack committed Apr 10, 2015
1 parent 9b43c60 commit 6379d2e
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/main/cpp/blaze_startup_options.cc
Original file line number Diff line number Diff line change
Expand Up @@ -126,15 +126,13 @@ string BlazeStartupOptions::GetJvm() {
}
exit(1);
}
for (string rt_jar : {
// If the full JDK is installed
GetHostJavabase() + "/jre/lib/rt.jar",
// If just the JRE is installed
GetHostJavabase() + "/lib/rt.jar"
}) {
if (access(rt_jar.c_str(), R_OK) == 0) {
return java_program;
}
// If the full JDK is installed
string jdk_rt_jar = GetHostJavabase() + "/jre/lib/rt.jar";
// If just the JRE is installed
string jre_rt_jar = GetHostJavabase() + "/lib/rt.jar";
if ((access(jdk_rt_jar.c_str(), R_OK) == 0)
|| (access(jre_rt_jar.c_str(), R_OK) == 0)) {
return java_program;
}
fprintf(stderr, "Problem with java installation: "
"couldn't find/access rt.jar in %s\n", GetHostJavabase().c_str());
Expand Down

0 comments on commit 6379d2e

Please sign in to comment.