This far on Linux, I have follow this tutorial Building SourceMod
and I managed build whole SourceMod, using clang.
Spoiler
PHP Code:
$ dpkg --list | grep compiler
ii clang 1:10.0-50~exp1 amd64 C, C++ and Objective-C compiler (LLVM based)
ii clang-10 1:10.0.0-4ubuntu1 amd64 C, C++ and Objective-C compiler
ii g++ 4:9.3.0-1ubuntu2 amd64 GNU C++ compiler
ii g++-9 9.4.0-1ubuntu1~20.04.2 amd64 GNU C++ compiler
ii g++-9-multilib 9.4.0-1ubuntu1~20.04.2 amd64 GNU C++ compiler (multilib support)
ii g++-multilib 4:9.3.0-1ubuntu2 amd64 GNU C++ compiler (multilib files)
ii gcc 4:9.3.0-1ubuntu2 amd64 GNU C compiler
ii gcc-9 9.4.0-1ubuntu1~20.04.2 amd64 GNU C compiler
ii gcc-9-multilib 9.4.0-1ubuntu1~20.04.2 amd64 GNU C compiler (multilib support)
ii gcc-multilib 4:9.3.0-1ubuntu2 amd64 GNU C compiler (multilib files)
ii libllvm10:amd64 1:10.0.0-4ubuntu1 amd64 Modular compiler and toolchain technologies, runtime library
ii libllvm12:amd64 1:12.0.0-3ubuntu1~20.04.5 amd64 Modular compiler and toolchain technologies, runtime library
ii libxkbcommon0:amd64 0.10.0-1 amd64 library interface to the XKB compiler - shared library
ii llvm-10 1:10.0.0-4ubuntu1 amd64 Modular compiler and toolchain technologies
ii llvm-10-dev 1:10.0.0-4ubuntu1 amd64 Modular compiler and toolchain technologies, libraries and headers
ii llvm-10-runtime 1:10.0.0-4ubuntu1 amd64 Modular compiler and toolchain technologies, IR interpreter
ii llvm-10-tools 1:10.0.0-4ubuntu1 amd64 Modular compiler and toolchain technologies, tools
Next I wanted to try compile metamod source plugin sample
.../alliedmodders/metamod-source/samples/s1_sample_mm/
PHP Code:
.../alliedmodders/metamod-source/samples/s1_sample_mm/build$ python ../configure.py --sdks css
Checking CC compiler (vendor test gcc)... ['clang', 'test.c', '-o', 'test']
found clang version 10.0
Checking CXX compiler (vendor test gcc)... ['clang++', 'test.cpp', '-o', 'testp']
found clang version 10.0
In file included from /home/amd/Asiakirjat/alliedmodders/metamod-source/samples/s1_sample_mm/sample_mm.cpp:16:
In file included from /home/amd/Asiakirjat/alliedmodders/metamod-source/samples/s1_sample_mm/sample_mm.h:18:
In file included from /home/amd/Asiakirjat/alliedmodders/metamod-source/core/ISmmPlugin.h:39:
In file included from /home/amd/Asiakirjat/alliedmodders/metamod-source/core/ISmmAPI.h:45:
In file included from /home/amd/Asiakirjat/alliedmodders/hl2sdk-css/public/eiface.h:16:
In file included from /home/amd/Asiakirjat/alliedmodders/hl2sdk-css/public/tier1/convar.h:21:
In file included from /home/amd/Asiakirjat/alliedmodders/hl2sdk-css/public/tier1/utlvector.h:23:
In file included from /home/amd/Asiakirjat/alliedmodders/hl2sdk-css/public/tier1/utlmemory.h:20:
In file included from /home/amd/Asiakirjat/alliedmodders/hl2sdk-css/public/mathlib/mathlib.h:12:
/home/amd/Asiakirjat/alliedmodders/hl2sdk-css/public/mathlib/vector.h:1857:32: error: implicit conversion from 'int' to 'float' changes value from 2147483647 to 2147483648 [-Werror,-Wimplicit-int-float-conversion]
z = minVal + ((float)rand() / RAND_MAX) * (maxVal - minVal);
~ ^~~~~~~~
/usr/include/stdlib.h:86:18: note: expanded from macro 'RAND_MAX'
#define RAND_MAX 2147483647
^~~~~~~~~~
8 errors generated.
After googling around and make edit in file, I bypassed that problem. Worked
.../alliedmodders/metamod-source/samples/s1_sample_mm/AMBuildScript
# Work around SDK warnings.
if cxx.version >= 'clang-10.0':
cxx.cflags += [
'-Wno-implicit-int-float-conversion',
'-Wno-tautological-overlap-compare',
]