Raised This Month: $32 Target: $400
 8% 

How to build SourceMod extensions on Windows?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Naleksuh
Member
Join Date: Dec 2018
Old 12-09-2022 , 01:24   How to build SourceMod extensions on Windows?
Reply With Quote #1

Hi guys,

I am trying to figure out how to build a SourceMod extension on Windows. Information on this online is limited, and mostly containing to instructions on building SourceMod itself.

I have ambuild set up but when I run configure.py on the extension I get this:

Exception: Could not find a valid path for HL2SDKTF2

Not sure what I am supposed to do to fix it. I thought it might be because I did not have TF2 installed (I am using a VDS since my machine runs Linux but I need a Windows build) but even after I installed Steam, TF2, and Source SDK 2013 I still get this. My only other idea is something in the Windows PATH but I'm not sure what I would put there. I also looked in the ambuild setup.py to see if I need to run something to put there, but I couldn't find anything that looks like it would fix that.

if anyone knows how, please help!
Naleksuh is offline
nosoop
Veteran Member
Join Date: Aug 2014
Old 12-09-2022 , 03:28   Re: How to build SourceMod extensions on Windows?
Reply With Quote #2

tl;dr: The checkout-deps scripts in the SourceMod repository will download the appropriate dependencies into the layout it expects; you then need to pass the correct paths to configure.py.

The process of building an extension is effectively the same as building SourceMod itself; you need to clone the SDK repository and checkout each branch into its own folder (if you're doing TF2, you just need to checkout tf2 into hl2sdk-tf2), then pass --hl2sdk-root with the directory containing the parent of all of those folders.

The standard directory layout is below:

/path/to/alliedmodders
├─ hl2sdk-blade
├─ hl2sdk-bms
├─ [... more hl2sdk branches omitted for brevity]
├─ hl2sdk-proxy-repo
├─ hl2sdk-sdk2013
├─ hl2sdk-tf2
├─ mmsource
└─ sourcemod

So once you've downloaded the code dependencies you'd likely want to pass the following to configure.py (using the VS x86 tools command prompt):

--hl2sdk-root /path/to/alliedmodders --mms-path /path/to/alliedmodders/mmsource --sm-path /path/to/alliedmodders/sourcemod --sdks tf2

You may also want to run configure.py --help to list available options, as they may be slightly different between projects.
__________________
I do TF2, TF2 servers, and TF2 plugins.
I don't do DMs over Discord -- PM me on the forums regarding inquiries.
AlliedModders Releases / Github / TF2 Server / Donate (BTC / BCH / coffee)
nosoop is offline
Naleksuh
Member
Join Date: Dec 2018
Old 12-09-2022 , 19:42   Re: How to build SourceMod extensions on Windows?
Reply With Quote #3

Thank you for the help. I was able to run configure.py (also needed to install Visual Studio 2015 because it doesn't work with 2013, but didn't say that until I was on the last step) and was able to configure it and using VS2015 Native Tools command prompt run ambuild. However, the build has failed and it seems like there are a bunch of errors in SM's core.

c:\users\administrator\desktop\alliedmodders\ hl2sdk-tf2\public\mathlib/mathlib.h(32: error C2369: 'PTR': redefinition; different subscripts
c:\users\administrator\desktop\alliedmodders\ hl2sdk-tf2\public\mathlib/mathlib.h(321): note: see declaration of 'PTR'
c:\users\administrator\desktop\alliedmodders\ hl2sdk-tf2\public\mathlib/mathlib.h(339): error C2296: '*': illegal, left operand has type 'float *'
c:\users\administrator\desktop\alliedmodders\ hl2sdk-tf2\public\mathlib/mathlib.h(1089): error C4235: nonstandard extension used: '__asm' keyword not supported on this architecture
c:\users\administrator\desktop\alliedmodders\ hl2sdk-tf2\public\mathlib/mathlib.h(1092): error C2065: 'fld': undeclared identifier
c:\users\administrator\desktop\alliedmodders\ hl2sdk-tf2\public\mathlib/mathlib.h(1092): error C2146: syntax error: missing ';' before identifier 'f'
c:\users\administrator\desktop\alliedmodders\ hl2sdk-tf2\public\mathlib/mathlib.h(1092): error C2146: syntax error: missing ';' before identifier 'fistp'
c:\users\administrator\desktop\alliedmodders\ hl2sdk-tf2\public\mathlib/mathlib.h(1093): error C2065: 'fistp': undeclared identifier
c:\users\administrator\desktop\alliedmodders\ hl2sdk-tf2\public\mathlib/mathlib.h(1093): error C2146: syntax error: missing ';' before identifier 'nResult'
c:\users\administrator\desktop\alliedmodders\ hl2sdk-tf2\public\mathlib/mathlib.h(1093): error C2143: syntax error: missing ';' before '}'
c:\users\administrator\desktop\alliedmodders\ hl2sdk-tf2\public\mathlib/mathlib.h(1126): error C4235: nonstandard extension used: '__asm' keyword not supported on this architecture
c:\users\administrator\desktop\alliedmodders\ hl2sdk-tf2\public\mathlib/mathlib.h(1129): error C2065: 'fld': undeclared identifier
c:\users\administrator\desktop\alliedmodders\ hl2sdk-tf2\public\mathlib/mathlib.h(1129): error C2146: syntax error: missing ';' before identifier 'f'
c:\users\administrator\desktop\alliedmodders\ hl2sdk-tf2\public\mathlib/mathlib.h(1129): error C2146: syntax error: missing ';' before identifier 'fistp'
c:\users\administrator\desktop\alliedmodders\ hl2sdk-tf2\public\mathlib/mathlib.h(1130): error C2065: 'fistp': undeclared identifier
c:\users\administrator\desktop\alliedmodders\ hl2sdk-tf2\public\mathlib/mathlib.h(1130): error C2146: syntax error: missing ';' before identifier 'nResult'
c:\users\administrator\desktop\alliedmodders\ hl2sdk-tf2\public\mathlib/mathlib.h(1130): error C2143: syntax error: missing ';' before '}'
c:\users\administrator\desktop\alliedmodders\ hl2sdk-tf2\public\mathlib/mathlib.h(1165): error C4235: nonstandard extension used: '__asm' keyword not supported on this architecture
c:\users\administrator\desktop\alliedmodders\ hl2sdk-tf2\public\mathlib/mathlib.h(116: error C2065: 'fld': undeclared identifier
c:\users\administrator\desktop\alliedmodders\ hl2sdk-tf2\public\mathlib/mathlib.h(116: error C2146: syntax error: missing ';' before identifier 'f'
c:\users\administrator\desktop\alliedmodders\ hl2sdk-tf2\public\mathlib/mathlib.h(116: error C2146: syntax error: missing ';' before identifier 'fistp'
c:\users\administrator\desktop\alliedmodders\ hl2sdk-tf2\public\mathlib/mathlib.h(116: error C2065: 'fistp': undeclared identifier
c:\users\administrator\desktop\alliedmodders\ hl2sdk-tf2\public\mathlib/mathlib.h(116: error C2146: syntax error: missing ';' before identifier 'qword'
c:\users\administrator\desktop\alliedmodders\ hl2sdk-tf2\public\mathlib/mathlib.h(116: fatal error C1003: error count exceeds 100; stopping compilation

Build failed.

This is just a sample, it goes on for a LONG time. And I'm not sure what exactly I've done wrong, or how to fix this. The Building SourceMod page makes no mention of these problems, or how to resolve them. This is also not problems with my own code, but the errors are from SM core (I'm also building an already existing extension)... leading me to believe the problem is the build setup. If anyone knows how to fix these build errors, that would be appreciated.
Naleksuh is offline
nosoop
Veteran Member
Join Date: Aug 2014
Old 12-10-2022 , 05:28   Re: How to build SourceMod extensions on Windows?
Reply With Quote #4

Quote:
Originally Posted by Naleksuh View Post
Thank you for the help. I was able to run configure.py (also needed to install Visual Studio 2015 because it doesn't work with 2013, but didn't say that until I was on the last step) and was able to configure it and using VS2015 Native Tools command prompt run ambuild. However, the build has failed and it seems like there are a bunch of errors in SM's core.

[...]
The following error message:

nonstandard extension used: '__asm' keyword not supported on this architecture

suggests that you are not using the correct command prompt. In your case you'll want to use the "VS2015 x86 Native Tools Command Prompt", and neither the x64 nor cross tools prompts.
__________________
I do TF2, TF2 servers, and TF2 plugins.
I don't do DMs over Discord -- PM me on the forums regarding inquiries.
AlliedModders Releases / Github / TF2 Server / Donate (BTC / BCH / coffee)

Last edited by nosoop; 12-10-2022 at 05:28.
nosoop is offline
Naleksuh
Member
Join Date: Dec 2018
Old 12-10-2022 , 12:49   Re: How to build SourceMod extensions on Windows?
Reply With Quote #5

Thanks. I thought I was already using that one. But this time I did double-check and made sure I was using VS2015 x64 Native Tools and got a different result, so I guess I wasn't before?

This time I got errors which appear to be from SM's core, but one warning from the extension itself.

I had thought for a bit that maybe the extension I was trying to build had errors in it, so I tried a different one, but couldn't get that one to work either (they are here and here respectively). It's possible that both of them are broken, but it's also possible the build environment is wrong.

For some reason, there are errors in the hl2sdk-tf2 folder itself:

Code:
C:\Users\Administrator\Downloads\PathFollower-master\obj-windows-AMD64>ambuild
Spawned worker (pid: 7156)
Spawned worker (pid: 7140)
[7156] cl /Zi /FS /DWIN32 /D_WINDOWS /DSE_EPISODEONE=1 /DSE_ORANGEBOX=3 /DSE_CSS=6 /DSE_HL2DM=7 /DSE_DODS=8 /DSE_SDK2013=9 /DSE_TF2=11 /DSE_LEFT4DEAD=12 /DSE_NUCLEARDAWN=13 /DSE_LEFT4DEAD2=15 /DSE_DARKMESSIAH=2 /DSE_ALIENSWARM=16 /DSE_BLOODYGOODTIME=4 /DSE_EYE=5 /DSE_CSGO=20 /DSE_DOTA=21 /DSE_PORTAL2=17 /DSE_BLADE=18 /DSE_INSURGENCY=19 /DSE_CONTAGION=14 /DSE_BMS=10 /DSOURCE_ENGINE=11 /DRAD_TELEMETRY_DISABLED /DCOMPILER_MSVC /DCOMPILER_MSVC32 /I ..\..\..\..\desktop\alliedmodders\sourcemod\public /I ..\.. /I ..\..\sdk /I ..\..\..\..\desktop\alliedmodders\sourcemod\public /I ..\..\..\..\desktop\alliedmodders\sourcemod\public\extensions /I ..\..\..\..\desktop\alliedmodders\sourcemod\sourcepawn\include /I ..\..\..\..\desktop\alliedmodders\sourcemod\public\amtl\amtl /I ..\..\..\..\desktop\alliedmodders\sourcemod\public\amtl /I ..\..\..\..\desktop\alliedmodders\mmsource-1.10\core /I ..\..\..\..\desktop\alliedmodders\mmsource-1.10\core\sourcehook /I ..\..\..\..\desktop\alliedmodders\hl2sdk-tf2\public /I ..\..\..\..\desktop\alliedmodders\hl2sdk-tf2\public\engine /I ..\..\..\..\desktop\alliedmodders\hl2sdk-tf2\public\mathlib /I ..\..\..\..\desktop\alliedmodders\hl2sdk-tf2\public\vstdlib /I ..\..\..\..\desktop\alliedmodders\hl2sdk-tf2\public\tier0 /I ..\..\..\..\desktop\alliedmodders\hl2sdk-tf2\public\tier1 /I ..\..\..\..\desktop\alliedmodders\hl2sdk-tf2\public\game\server /I ..\..\..\..\desktop\alliedmodders\hl2sdk-tf2\public\toolframework /I ..\..\..\..\desktop\alliedmodders\hl2sdk-tf2\game\shared /I ..\..\..\..\desktop\alliedmodders\hl2sdk-tf2\common /showIncludes /nologo /c C:\Users\Administrator\Downloads\PathFollower-master\sp_natives.cpp /Fosp_natives.obj
sp_natives.cpp
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\xlocale(341): warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
C:\Users\Administrator\desktop\alliedmodders\hl2sdk-tf2\game\shared\GameEventListener.h(42): error C2065: 'gameeventmanager': undeclared identifier
C:\Users\Administrator\desktop\alliedmodders\hl2sdk-tf2\game\shared\GameEventListener.h(42): error C2227: left of '->AddListener' must point to class/struct/union/generic type
C:\Users\Administrator\desktop\alliedmodders\hl2sdk-tf2\game\shared\GameEventListener.h(42): note: type is 'unknown-type'
C:\Users\Administrator\desktop\alliedmodders\hl2sdk-tf2\game\shared\GameEventListener.h(50): error C2065: 'gameeventmanager': undeclared identifier
C:\Users\Administrator\desktop\alliedmodders\hl2sdk-tf2\game\shared\GameEventListener.h(50): error C2227: left of '->RemoveListener' must point to class/struct/union/generic type
C:\Users\Administrator\desktop\alliedmodders\hl2sdk-tf2\game\shared\GameEventListener.h(50): note: type is 'unknown-type'
c:\users\administrator\downloads\pathfollower-master\Nav/nav_mesh.h(204): warning C4838: conversion from 'unsigned int' to 'int' requires a narrowing conversion

Build failed: PathFollower.ext.2.tf2\sp_natives.obj

C:\Users\Administrator\Downloads\PathFollower-master\obj-windows-AMD64>
I had thought for a bit about reading the hl2sdk-tf2 folder and trying to fix errors, but that seems intuitively wrong-- it is probably fine and the build steps that are wrong. But I am not really sure what else I can do. I did try updating AMBuild 2.1 > 2.2, but that didn't seem to do anything (it failed either way).

Anyone knows how to resolve these problems? (Hope I am not being too dumb. but you know, give a man a fish...)
Naleksuh is offline
nosoop
Veteran Member
Join Date: Aug 2014
Old 12-12-2022 , 10:09   Re: How to build SourceMod extensions on Windows?
Reply With Quote #6

I'm unable to reproduce your findings. That said it looks like Pelipoika added a fix for the project to compile successfully against the current TF2 SDK.

It looks like REST in Pawn has additional steps outside of running ambuild.

Seems like your configuration is fine.
__________________
I do TF2, TF2 servers, and TF2 plugins.
I don't do DMs over Discord -- PM me on the forums regarding inquiries.
AlliedModders Releases / Github / TF2 Server / Donate (BTC / BCH / coffee)
nosoop is offline
Reply



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 09:45.


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