Closed joaoseidel closed 4 years ago
This wouldn't be an issue with sampctl, all sampctl does is invoke the compiler, pass in the entry file along with include paths and any extra flags defined in the config file.
Sampctl does nothing to impact how the compiler works.
If you are CERTAIN that the code is the same (and I'd double-check that), there are some more things to check:
1) Paths passed are using \
not /
.
2) Include paths are correct.
3) You're building the correct file.
4) Flags.
5) You added all dependencies.
I believe sampctl can show you the compiler command it called, so have a look at that. Because as @ADRFranklin said sampctl doesn't change code.
Actually I started coding this gamemode last week, so the code IS the same.. This is a rly weird thing.
I have checked all the steps @Y-Less told and its all correct, guys. I don't know what's happening.
Here is the repo for my coding: https://github.com/joaoseidel/realworld/ If you guys can help me pls :)
You have added dependencies to the pawn.json file, but you have also manually added them to a legacy folder, and included that legacy folder when building. This will cause a duplicate include error in sampctl and it will prevent you including both paths.
You seem to have both a pawn.json file and a samp.json file, samp.json has been deprecated for a long time now, and should be removed entirely.
Your repo seems to include stuff like a pawno folder which also contains binaries (which is a git no no) including the pawn compiler, you do not need this, as sampctl will download the pawn compiler to it's cache directory to build gamemodes for you.
If you want to see exactly what is happening when sampctl is building, ensuring or running your gamemode, you can pass the --verbose
flag to sampctl and it will give a huge amount of output telling you what it is doing at every step.
I noticed you have not added the "local": true
to your config file in order to tell sampctl that you are working on a local package (aka a gamemode) and not a remote package such as a library or plugin. You can learn more here: https://github.com/Southclaws/sampctl/wiki/Package-Definition-Reference
I was trying different solutions to fix those errors, none of what you said is related to those errors, firstly I've tried to move manually all my gamemode to a new package (generated by sampctl p init), but the same errors happen, then I give up and that's why that repo is a completely a mess (I'm just searching for a solution rn).
My legacy folder does not contain duplicated includes, instead, sampctl will show me an error and don't let me compile, the samp.json is generated by sampctl s init, which I've followed this tutorial (https://github.com/sampctl/tutorial-migration) when trying to figure out what's happening.
The fact that my repo has a pawno folder does not meddle in sampctl building.
"local": true was added when I'm trying to fix these errors.
At least, I searched the entire web before I decide to open this issue, ok? I'm not dumb and I'm here to ask why these errors occurred while I tried to compile with sampctl. You can try by yourself compiling with a standalone Zeex compiler and it'll work.
@joaoseidel I have found a lot of problems with the way you have written your gamemode, I noticed the lack of include guards, and inclusion of required files that contain definitions, this is mainly due to the incorrect order of inclusion, which is a problem you'll run into often.
I see you are taking a modular design for your package, however the way you have done it, is not going to work the way you expect it to. Please refer to gamemodes such as TradeWars for understanding the best way to write modules without leaving yourself vulnerable to issues like this.
https://github.com/TradeWars/gamemode https://github.com/TradeWars/gamemode/blob/master/docs/Style-Guide.md
@joaoseidel Also I never said you where dumb? You provided me with a link to a repository you had made, and told me this was what you where working with. At no time did you say this wasn't the current code you where working with, so what did you expect me to come back with?
The repository you have provided me was riddled with issues, all I did was observe them and point them out to you. I have no idea who you are, or your skill level. I can only observe and report back on what I found to best help you.
Well, thank you for your feedback. I'm still not understanding why those errors occurred with sampctl, but ok..
And sorry for being rude
Hello, i have same problem why compiling this gamemode https://github.com/adri1336/vc-rp with sampctl
When i use compiler 3.10.10, that show me many errors like this: (error) undefined symbol "......."
With compiler 3.10.8, compilation failed: exit status 3221225477
I can compile this gamemode with pawno compiler (3.10.8 gui windows version) without errors.
There is my configuration in pawn.json
` line 4 -> 16
"entry": "gamemodes\\main.pwn",
"output": "gamemodes\\main.amx",
"local": true,
"dependencies": [
"sampctl/samp-stdlib:0.3.DL-R1",
"pawn-lang/YSI-Includes:v4.0.2",
"maddinat0r/sscanf:v2.8.2",
"samp-incognito/samp-streamer-plugin:v2.9.4",
"kristoisberg/samp-gps-plugin:1.4.0",
"pBlueG/SA-MP-MySQL:R41-4",
"urShadow/Pawn.Regex:1.1.2",
"maddinat0r/samp-mysql-yinline-include:v1.0.1"
],
` between 16 and 61 there are runtime
` line 61 -> 70
"build": {
"args": ["-d3", "-;+", "-(+", "-Z+"],
"version": "3.10.8",
"includes": ["includes"]
},
"builds": [
{
"name": "main"
}
]
`
You can either use build
or builds
not both. I think the first item in builds
takes precedence so you're compiling with no flags or custom include paths. Remove builds
entirely unless you intend for multiple build configurations.
No you can use both, what happens is, if you do sampctl p build
it will run the build
stuff only, however if you run sampctl p build main
it will run the main stuff, however all objects inside the builds
array, inherit fields from the build
object.
An example of how this works is simple.
{
"build": {
"args": ["-d3", "-;+", "-(+", "-Z+"],
"includes": ["includes"],
"compiler": {
"version": "3.10.8"
}
},
"builds": [
{
"name": "local",
"includes": ["includes", "dev"]
},
{
"name": "testing",
"mode": "y_testing"
},
{
"name": "prod",
"rcon_password": "my_password_2020"
}
]
}
So if you where to run sampctl p build
you would be using the build
object data to build it, if you where then to run sampctl p build local
you would be using the local object under builds
which inherits all of it's properties from the build
object.
Thanks for your replies, ADRFranklin you've right, ut this is not where the problem comes from because I have tried many examples of build configuration, I just show that I have the dependencies and that my file is correct, so I do not know where comes the error. @joaoseidel seems to have the same problem, my server compiles fine without going through sampctl. It's a shame since sampctl is a great tool for samp servers.
@didi110296 The issue comes from the file player/toys/header
and the problem is this 4 dimensional array
new pToys_Clothes[MAX_PLAYERS][MAX_PLAYER_TOYS][MAX_CLOTHING_CLOTHES_PER_CHAR][E_pToys_Clothes];
if you comment out the code for toys, it gives the correct errors.
@ADRFranklin thanks for helping me, I do not know why you find that this is the problem but as I said above I manage to compile very well without sampctl, the compilation with sampctl results with 150 problems (most of which are simply warnings) the errors are undefined symbol
.
sampctl p build results: https://pastebin.com/GuvcMFXY
I tried to change the version of the dependences of pawncc, but not worked.
Probably an incompatible gamemode structure with sampctl?
sampctl isn't an actual compiler, all it does is execute the pawnc compiler binary and you can see which arguments it passes to the process with --verbose
, because of this there are no requirements of specific structures. The issue may be related to updated libraries or include order. Try building with -l
as an arg and analyse the result.
@didi110296 The problem I found, is that the gamemode is written based around the old compiler and it's flaws, specially with include guards, when switching over to the new compiler there is a flag called -Z+
however, this enables some compatibility with the old compiler, but there seems to still be issues, regarding include guards. I found that un-defining the generated include _inc_<file_name>
and then having your own custom include guard is the best solution that works across both compilers. For example:
// The old compiler (and new compiler when built with +Z- flag) generates a include guard based on the files name
// in this case the file is test.inc
#if defined _inc_test
#undef _inc_test
#endif
// Make our own custom include guard that we control
#if defined test_included
#endinput
#endif
#define test_included
This is not going to be an easy change, and I am unsure if there is any further way to improve the compatibility with the old compiler in such a way where it just works (There might be, but if there is, I am unaware of it).
@Southclaws i've tried to build with -l
as arg
With compiler 3.10.10 INFO: Build default successful with 0 problems
That created a list file (main.lst)
On compiler 3.10.8 failed to compile package entry: exit status 3221225477
I changed includes order one by one but build always failed with 150 problems.
@ADRFranklin ok thanks for your analysis, that must be it, i will try to make it compatible for 3.10.10.
But can i make it work on sampctl (pawncc 3.10.8) without the error code failed to compile package entry: exit status 3221225477
? Because outside sampctl pawncc 3.10.8 works well
I'm not sure what the exit status 3221225477
is about, it always occurred with 3.10.8 and only that version. There might be more support on the compiler repo as it's probably a compiler issue rather than a sampctl issue.
If it's not compiler related, it might be a missing directory.
Thanks for your help, i've solved the problem by replacing all args in pawn.json with -d3
and compilation success with 3.10.8.
Why when I compile with sampctl does I get these errors:
All these functions that the compiler says undefined are stocks, but stocks can be placed wherever I want and still work, right?
I'm migrating for sampctl and I already use the Zeex compiler 3.10.10. When compiling just using the pawncc it works.
These tests were made in Windows 10 and ArchLinux, both give me the same errors.