Executing "./install_ydk.sh --cpp --core --venv" on Red Hat 8 executes ydk-gen-master/test/dependencies_centos.sh. It is expected that dependencies_centos.sh will not attempt to install gcc 4.8.1 if there is a newer version of gcc already installed.
Current Behavior
When dependencies_centos.sh runs, it attempts to install gcc 7 when gcc 10.X.X is already installed. The error is with the comparison on line 57 (i.e. if [[ $gcc_version < "4.8.1" ]] ). This line fails when comparing against gcc version 10.X.X. Instead of using the string comparison, you could do something like this to get higher version number:
latestVersion=$(echo "4.8.1 $gcc_version" | gawk '{printf("%s\n%s\n", $1, $2)}' | sort -rV | head -1)
and then check to see if latestVersion equals "4.8.1" and then take the appropriate action. Though, I would recommend revamping this section to be more up to date and use a more recent default compiler version than gcc 7. My work around was to comment this section of the script out and just use the currently installed gcc version.
Steps to Reproduce
Run ./install_ydk.sh --cpp --core --venv on Red Hat 8 per the core installation instructions.
Expected Behavior
Executing "./install_ydk.sh --cpp --core --venv" on Red Hat 8 executes ydk-gen-master/test/dependencies_centos.sh. It is expected that dependencies_centos.sh will not attempt to install gcc 4.8.1 if there is a newer version of gcc already installed.
Current Behavior
When dependencies_centos.sh runs, it attempts to install gcc 7 when gcc 10.X.X is already installed. The error is with the comparison on line 57 (i.e. if [[ $gcc_version < "4.8.1" ]] ). This line fails when comparing against gcc version 10.X.X. Instead of using the string comparison, you could do something like this to get higher version number: latestVersion=$(echo "4.8.1 $gcc_version" | gawk '{printf("%s\n%s\n", $1, $2)}' | sort -rV | head -1) and then check to see if latestVersion equals "4.8.1" and then take the appropriate action. Though, I would recommend revamping this section to be more up to date and use a more recent default compiler version than gcc 7. My work around was to comment this section of the script out and just use the currently installed gcc version.
Steps to Reproduce
Run ./install_ydk.sh --cpp --core --venv on Red Hat 8 per the core installation instructions.
System Information
Python 3.6.8 RHEL 8.6 X86_64