matrixorigin/mo_ctl_standalone

[Bug]: Precheck on gcc is different on mac compared with linux

aronchanisme opened this issue · 1 comments

Is there an existing issue for the same bug?

  • I have checked the existing issues.

Environment

  • Version or commit-id: e.g. v0.1.0
  • OS type: e.g. MacOS 13
  • Other info: e.g. n.a.

Issue Description

on mac, gcc -v or gcc --version will print clang version

xxx-macbookpro:matrixorigin.io.cn nandeng$ gcc -v
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/usr/include/c++/4.2.1
Apple clang version 13.0.0 (clang-1300.0.27.3)
Target: arm64-apple-darwin21.4.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
nandeng-macbookpro:matrixorigin.io.cn nandeng$ which gcc
/usr/bin/gcc
xxx-macbookpro:matrixorigin.io.cn nandeng$ gcc --version
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/usr/include/c++/4.2.1
Apple clang version 13.0.0 (clang-1300.0.27.3)
Target: arm64-apple-darwin21.4.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

while on linux, gcc -v or gcc --version will print gcc version

[root@VM-0-17-centos VM-0-17-centos]# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/8/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --with-isl --disable-libmpx --enable-offload-targets=nvptx-none --without-cuda-driver --enable-gnu-indirect-function --enable-cet --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux
Thread model: posix
gcc version 8.5.0 20210514 (Red Hat 8.5.0-4) (GCC) 
[root@VM-0-17-centos VM-0-17-centos]# gcc --version
gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-4)
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

mo_ctl needs to judge if,

  1. current os = mac, check clang and it's version ≥ 13.0
  2. current os = linux, check gcc and it's version ≥ 8.5.0

Steps to Reproduce

gcc --version

Additional information

none

fixed

xx@xx xx % mo_ctl precheck            
2023-07-24_19:13:51.N    [INFO]    Precheck on pre-requisite: go
2023-07-24_19:13:51.N    [INFO]    Ok. go is installed
2023-07-24_19:13:51.N    [INFO]    Version check on go. Current: 1.20.1, required: 1.20
2023-07-24_19:13:51.N    [INFO]    Ok. go version is greater than or equal to required
2023-07-24_19:13:51.N    [INFO]    Precheck on pre-requisite: gcc
2023-07-24_19:13:51.N    [INFO]    Ok. gcc is installed
2023-07-24_19:13:51.N    [INFO]    Version check on gcc. Current: 14.0.3, required: 13.0
2023-07-24_19:13:51.N    [INFO]    Ok. gcc version is greater than or equal to required
2023-07-24_19:13:51.N    [INFO]    Precheck on pre-requisite: git
2023-07-24_19:13:51.N    [INFO]    Ok. git is installed
2023-07-24_19:13:51.N    [INFO]    Precheck on pre-requisite: mysql
2023-07-24_19:13:51.N    [INFO]    Ok. mysql is installed
2023-07-24_19:13:51.N    [INFO]    All pre-requisites are ok