GDCC: An Alternative ACS Compiler [0.15.0]

Any utility that assists in the creation of mods, assets, etc, go here. For example: Ultimate Doom Builder, Slade, WadSmoosh, Oblige, etc.
Forum rules
The Projects forums are ONLY for YOUR PROJECTS! If you are asking questions about a project, either find that project's thread, or start a thread in the General section instead.

Got a cool project idea but nothing else? Put it in the project ideas thread instead!

Projects for any Doom-based engine (especially 3DGE) are perfectly acceptable here too.

Please read the full rules for more details.
User avatar
DavidPH
Posts: 382
Joined: Fri Aug 28, 2009 1:46 pm

Re: GDCC: An Alternative ACS Compiler

Post by DavidPH »

To put it simply, locals in the ACS front have the same problem as globals. It needs to be in an array to access array members. In this case, unfortunately, you would need to copy it into one like:

Code: Select all

function FPlayerHUD _H_CreateRainDroplet(FPlayerHUD playerHUD_, int type, int x, int y)
{
   FPlayerHUD playerHUD[1] = {playerHUD};
   // etc
   return playerHUD[0];
}
Simply declaring the parameter as an array would cause it to be have a pointer type as in C.

The more technical explanation, for anyone curious, is that the compiler sees the address of playerHUD being used dynamically and changes it to be stored on the automatic storage stack. But the calling convention for ACS functions does not have a stack pointer, which makes the resulting IR code impossible to translate to ZDACS bytecode. The exact error occurring when it tries to determine which register index holds the stack pointer. To which I should probably improve the error message to something other than just the name of the function.
User avatar
Nash
 
 
Posts: 17481
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia

Re: GDCC: An Alternative ACS Compiler

Post by Nash »

Okay got it, thanks!
User avatar
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia

Re: GDCC: An Alternative ACS Compiler

Post by Matt »

I'm getting this, anyone have any idea what's going on?

Code: Select all

[  5%] Building CXX object src/Core/CMakeFiles/gdcc-core-lib.dir/Number.cpp.o
In file included from /home/[user]/doom/GDCC-master/src/Core/Number.cpp:13:0:
/home/[user]/doom/GDCC-master/inc/Core/Number.hpp:17:19: fatal error: gmpxx.h: No such file or directory
 #include <gmpxx.h>
                   ^
compilation terminated.
[  5%] Building CXX object src/Core/CMakeFiles/gdcc-core-lib.dir/Option.cpp.o
src/Core/CMakeFiles/gdcc-core-lib.dir/build.make:169: recipe for target 'src/Core/CMakeFiles/gdcc-core-lib.dir/Number.cpp.o' failed
make[2]: *** [src/Core/CMakeFiles/gdcc-core-lib.dir/Number.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
CMakeFiles/Makefile2:898: recipe for target 'src/Core/CMakeFiles/gdcc-core-lib.dir/all' failed
make[1]: *** [src/Core/CMakeFiles/gdcc-core-lib.dir/all] Error 2
Makefile:117: recipe for target 'all' failed
make: *** [all] Error 2
User avatar
Marrub
 
 
Posts: 1202
Joined: Tue Feb 26, 2013 2:48 pm
Preferred Pronouns: No Preference
Operating System Version (Optional): Arch Linux
Graphics Processor: ATI/AMD with Vulkan/Metal Support

Re: GDCC: An Alternative ACS Compiler

Post by Marrub »

Vaecrius wrote:I'm getting this, anyone have any idea what's going on?

Code: Select all

[  5%] Building CXX object src/Core/CMakeFiles/gdcc-core-lib.dir/Number.cpp.o
In file included from /home/[user]/doom/GDCC-master/src/Core/Number.cpp:13:0:
/home/[user]/doom/GDCC-master/inc/Core/Number.hpp:17:19: fatal error: gmpxx.h: No such file or directory
 #include <gmpxx.h>
                   ^
compilation terminated.
[  5%] Building CXX object src/Core/CMakeFiles/gdcc-core-lib.dir/Option.cpp.o
src/Core/CMakeFiles/gdcc-core-lib.dir/build.make:169: recipe for target 'src/Core/CMakeFiles/gdcc-core-lib.dir/Number.cpp.o' failed
make[2]: *** [src/Core/CMakeFiles/gdcc-core-lib.dir/Number.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
CMakeFiles/Makefile2:898: recipe for target 'src/Core/CMakeFiles/gdcc-core-lib.dir/all' failed
make[1]: *** [src/Core/CMakeFiles/gdcc-core-lib.dir/all] Error 2
Makefile:117: recipe for target 'all' failed
make: *** [all] Error 2
Do you not have libgmp?
User avatar
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia

Re: GDCC: An Alternative ACS Compiler

Post by Matt »

I did not! Thanks! (and I think I might be learning how to read these things...)

And now I've got a new problem: It can't find zcommon.acs no matter what I do.

Is there a manual or something?
User avatar
Nash
 
 
Posts: 17481
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia

Re: GDCC: An Alternative ACS Compiler

Post by Nash »

Please... option for error on forward declared function... this time it's not even about my custom build scripts anymore. I was putting something together in SLADE and I wasted almost half an hour wondering why do my scripts not even work, turns out I accidentally forward declared a function. SLADE happily compiles this and doesn't display any errors.

Please.
User avatar
DavidPH
Posts: 382
Joined: Fri Aug 28, 2009 1:46 pm

Re: GDCC: An Alternative ACS Compiler

Post by DavidPH »

Vaecrius wrote:And now I've got a new problem: It can't find zcommon.acs no matter what I do.
Under non-Windows systems, the default library path is /usr/share/gdcc/lib. You can override it using the --lib-path option.
Vaecrius wrote:Is there a manual or something?
No, but a usage overview document would probably be a good idea. I would appreciate input people who have the perspective of learning to use GDCC, actually.
Nash wrote:Please... option for error on forward declared function... this time it's not even about my custom build scripts anymore. I was putting something together in SLADE and I wasted almost half an hour wondering why do my scripts not even work, turns out I accidentally forward declared a function. SLADE happily compiles this and doesn't display any errors.
I have made it an error if a forward declared function is not defined at the time of codegen, although this may have undesired consequences for other projects. Ideally, SLADE would have the ability to display compiler warnings, but I suspect this would conflict with how acc always prints stuff.
User avatar
Nash
 
 
Posts: 17481
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia

Re: GDCC: An Alternative ACS Compiler

Post by Nash »

DavidPH wrote:I have made it an error if a forward declared function is not defined at the time of codegen, although this may have undesired consequences for other projects. Ideally, SLADE would have the ability to display compiler warnings, but I suspect this would conflict with how acc always prints stuff.
Thank you thank you thank you thank you... although you didn't have to change it... I did say "option"... so a command line parameter, so that other projects won't break with this change...
User avatar
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia

Re: GDCC: An Alternative ACS Compiler

Post by Matt »

Under non-Windows systems, the default library path is /usr/share/gdcc/lib. You can override it using the --lib-path option.
Okay, just tried

Code: Select all

gdcc-acc _zip/acs/hdacs.acs _zip/acs/hdacs.o --lib-path ~/doom/acc/
and I still get the same error even though it is most definitely in that folder. (I also copied the gdcc-acc binary into that folder and am attempting to run that - is that the problem?)
DavidPH wrote:
Vaecrius wrote:Is there a manual or something?
No, but a usage overview document would probably be a good idea. I would appreciate input people who have the perspective of learning to use GDCC, actually.
So far, I've had some snags on...

- what dependencies are required
- how to compile (I just extrapolated from how to compile (G)ZDoom)
- where the executables are once you've compiled them
- what to do with those things
- how it looks for ACS libraries and how to customize that
User avatar
DavidPH
Posts: 382
Joined: Fri Aug 28, 2009 1:46 pm

Re: GDCC: An Alternative ACS Compiler

Post by DavidPH »

The directory that you point --lib-path at has to contain the lib/inc directory from the repository (or, of course, a copy of it). For example, if you have gdcc checked out at ~/src/gdcc, then you would use --lib-path ~/src/gdcc/lib.
User avatar
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia

Re: GDCC: An Alternative ACS Compiler

Post by Matt »

I'm trying this

Code: Select all

gdcc-acc _zip/acs/hdacs.acs _zip/acs/hdacs.o --lib-path ~/doom/GDCC-master/lib/
and it doesn't work.
User avatar
DavidPH
Posts: 382
Joined: Fri Aug 28, 2009 1:46 pm

Re: GDCC: An Alternative ACS Compiler

Post by DavidPH »

Assuming something hasn't gone catastrophically wrong and ~/doom/GDCC-master/lib/inc/ACS/zcommon.acs exists, does --sys-include ~/doom/GDCC-master/lib/inc/ACS make it able to find zcommon.acs?
User avatar
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia

Re: GDCC: An Alternative ACS Compiler

Post by Matt »

DavidPH wrote:Assuming something hasn't gone catastrophically wrong and ~/doom/GDCC-master/lib/inc/ACS/zcommon.acs exists, does --sys-include ~/doom/GDCC-master/lib/inc/ACS make it able to find zcommon.acs?
Still no luck, but that folder most definitely has a zcommon.acs.

EDIT: Sorry, my bad! It was a problem with my bash shortcut!

I am now getting this error, however:

Code: Select all

ERROR: _zip/acs/hdacs.acs:5:19: non-constant initializer for static storage object
User avatar
Marrub
 
 
Posts: 1202
Joined: Tue Feb 26, 2013 2:48 pm
Preferred Pronouns: No Preference
Operating System Version (Optional): Arch Linux
Graphics Processor: ATI/AMD with Vulkan/Metal Support

Re: GDCC: An Alternative ACS Compiler

Post by Marrub »

Stupid question: Have you tried reordering the argument to before the source name? I don't know why this would work, but try it: gdcc-acc --lib-path ~/doom/GDCC-master/lib/ _zip/acs/hdacs.acs _zip/acs/hdacs.o
User avatar
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia

Re: GDCC: An Alternative ACS Compiler

Post by Matt »

Same "non-constant initializer for static storage object" error... my prior problem was actually that I was running gdcc from a script that only contained room for 2 parameters so the path was being ignored.

Return to “Creation, Conversion, and Editing”