一、问题描述

新装上了ubuntu18.04,安装vmtool时一直出现gcc不可用的错误:

Would you like to change it? [yes] yes
What is the location of the gcc program on your machine? /usr/bin/gcc
The path "/usr/bin/gcc" is not valid path to the gcc binary.

二、解决方案

打开bin/vmware-config-tools.pl,找到对应的代码片段:

sub getValidGccPath {
    my $gcc_path = shift;
    my $modconfig = shift;
    my $appLoaderArgs = shift;
    my $answer;
    my $query;
    my $default;
    while (1) {
        if (system("$modconfig --validate-gcc \"$gcc_path\" $appLoaderArgs " .
                ">/dev/null 2>&1") == 0) {
            $query = "The path \"$gcc_path\" appears to be a valid path to the " .
            "gcc binary.";
            $default = ''no'';
        } else {
            $query = "The path \"$gcc_path\" is not valid path to the gcc binary.";
            $default = ''yes'';
            $gcc_path = '''';
        }
        $answer = get_answer($query . "\n Would you like to change it?",
            ''yesno'', $default);
        if ($answer eq ''yes'') {
            # Get new path.
            $gcc_path = query(''What is the location of the gcc program '' .
                ''on your machine?'', $gcc_path, 0);
        } else
            last;
        }
    }
    return $gcc_path;
}

在倒数第七行直接返回gcc_path

# ...
if ($answer eq ''yes''){
    # Get new path.
    $gcc_path = query(''What is the location of the gcc program '' .
    ''on your machine?'', $gcc_path, 0);
    # 添加代码
    return $gcc_path;
}
# ...

然后重新安装,问题解决。

最后修改:2018 年 06 月 02 日
如果觉得我的文章对你有用,请随意赞赏