Raised This Month: $12 Target: $400
 3% 

Solved How do I tell AMBuild to compile with Clang instead of GCC?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Sappykun
Member
Join Date: Nov 2019
Old 05-15-2021 , 13:15   How do I tell AMBuild to compile with Clang instead of GCC?
Reply With Quote #1

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?

Last edited by Sappykun; 11-04-2021 at 12:51.
Sappykun is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 05-16-2021 , 06:00   Re: How do I tell AMBuild to compile with Clang instead of GCC?
Reply With Quote #2

AMBuild uses the standard CC and CXX environment variables to select a compiler.

Code:
CC=clang CXX=clang++ python ../configure.py --sdks=l4d2,tf2
__________________
asherkin is offline
Sappykun
Member
Join Date: Nov 2019
Old 05-16-2021 , 12:08   Re: How do I tell AMBuild to compile with Clang instead of GCC?
Reply With Quote #3

Quote:
Originally Posted by asherkin View Post
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!
Sappykun is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 07:15.


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