AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Coding MM:S Plugins & SM Extensions (https://forums.alliedmods.net/forumdisplay.php?f=75)
-   -   Solved How do I tell AMBuild to compile with Clang instead of GCC? (https://forums.alliedmods.net/showthread.php?t=332485)

Sappykun 05-15-2021 13:15

How do I tell AMBuild to compile with Clang instead of GCC?
 
OS: Ubuntu 18.04
Sourcemod version: 1.10.6502
Metamod version: 1.11.1144
AMBuild version: 2.0

I am trying to build this Late Downloads extension for TF2 and L4D2. While someone has kindly compiled the binaries for me, I would still like to be able to compile it myself so I can edit it later.

When I run configure.py from the latedl/build folder, the script returns this information:

PHP Code:

l4d2@ns531866:~/metamod/latedl/buildpython ../configure.py --hl2sdk-root=/home/l4d2/metamod --mms-path=/home/l4d2/metamod/metamod-source --sm-path=/home/l4d2/metamod/sourcemod --sdks=l4d2,tf2
Checking CC compiler 
(vendor test gcc)... ['cc''test.c''-o''test']
found gcc version 7.5
Checking CXX compiler 
(vendor test gcc)... ['c++''test.cpp''-o''testp']
found gcc version 7.5 

However, when I try to compile the code using ambuild, I get an error. The same error occurs when I use GCC 10.3.

Spoiler


Zynda suggested that Clang would work better for compiling Sourcemod extensions and supports this extension out of the gate.
From what I've been able to gather, if my system has Clang installed (it does, version 6.0.0-1ubuntu2), AMBuild should be trying to use that first. However, I don't see that.

How do I tell AMBuild to compile the extension with Clang? Is there something I need to edit in the build script, or an environment variable I need to change?
Alternatively, what should I try changing in my environment to get GCC to compile the project properly?

asherkin 05-16-2021 06:00

Re: How do I tell AMBuild to compile with Clang instead of GCC?
 
AMBuild uses the standard CC and CXX environment variables to select a compiler.

Code:

CC=clang CXX=clang++ python ../configure.py --sdks=l4d2,tf2

Sappykun 05-16-2021 12:08

Re: How do I tell AMBuild to compile with Clang instead of GCC?
 
Quote:

Originally Posted by asherkin (Post 2746946)
AMBuild uses the standard CC and CXX environment variables to select a compiler.

Code:

CC=clang CXX=clang++ python ../configure.py --sdks=l4d2,tf2

This worked perfectly. Thank you!


All times are GMT -4. The time now is 17:58.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.