Closed newapok69 closed 1 year ago
So what is the issue exactly? Are you using latest code for bots? There were many fixes for Linux compile last weeks
Hey new,
Thanks for posting this. Some warnings do point to valid issues. I'll have to look at them each in turn to determine proper solutions. As celg said bots do work with this code and we don't get these warnings in windows so they are hard to get right. But this helps.
if (!sServerFacade.isSpawned(go) || !go->GetGoState() == GO_STATE_READY || !bot->CanInteract(go)) Here for example the line should be if (!sServerFacade.isSpawned(go) || (go->GetGoState() != GO_STATE_READY) || !bot->CanInteract(go)) !something == something else just isn't a valid construct.
reverse == ADDED_POINTS || reverse == REMOVED_POINTS should be (reverse == ADDED_POINTS) || (reverse == REMOVED_POINTS) This is semantics.. the code works properly but it's nice to be clear.
return AI_VALUE2(uint8, "health", "self target") > 1000; This one should be bot->GetHealth() > 1000; like a little above in the same file.
MyThreatValue(PlayerbotAI ai, string name = "my threat") : LogCalculatedValue(ai, name) { minChangeInterval = 0.5; } This one probably should be MyThreatValue(PlayerbotAI ai, string name = "my threat") : LogCalculatedValue(ai, name) { minChangeInterval = 1; }
ect.
I'll see if I can resolve some of these later when I got time.
@celguar please leave this one open for now. I'll look at then.
Some issues have been fixed. The rest are core changes or are (probably) no problem and can be ignored.
Please comfirm. :D
@celguar @mostlikely4r
Thanks for the feedback and quick changes. I tried compiling with the updates and got this error message:
error: use of undeclared identifier 'LogAnalysis'; did you mean 'ai::LogAnalysis'?
void LogAnalysis::AnalysePid()
^~~
ai::LogAnalysis
/mangos-classic/src/modules/Bots/playerbot/BotTests.h:7:11: note: ai::LogAnalysis' declared here
class LogAnalysis
Thanks
I have the same issue. I commented out that addition for now, so it will compile. I had to alter some includes on various files in order to get a clean build on Ubuntu 20.04 with latest cmangos wolk core. (was a lot of work.. lol)
I still get crashes constantly like every 10-30 minutes. possible? Map::PlayerRelocation? . still trying to figure out why.
Any ideas ?
I am taking out the log analysis portion of the build for now also.
If you have any included needed for linux compile please put them in a PR. We can add them to the code and it will save us some time trying to find and add them.
It's fine to disable log analysis as it's not needed for normal use of the server. Better though to find the includes needed and let us know.
We try to work on linux compatibility on our end but it's rather painfull as any fix needs to be put in git where it's compile run let us know what errors still persist.
I am still a beginner with Github. Is PR a patch request or pull request? Do you know of any good examples or tutorials I could look at to learn how to use it?
Also, I had two additional errors but they were just case issues, and I was able to fully compile. GCC had fewer warnings then Clang but it looks a lot better.
Thanks.
Sorry I meant pull request. You can probably Google a good tutorial with 'git pull request' but it's pretty simple:
1) create a branch for your bot reppo. 2) Push your changes to this branch. 3) In git go to pull requests and select new 4) the source should be your branch and the destination celgulars master branch 5) create!
Keep in mind anything you push to this branch will be included in the PR. That's why it's better to make a branch so you can use your master for other stuff. You can PR from your master to your branch or vice versa if you have trouble pushing to a branch but not your master.
Alright, I will look up some tutorials and try it out.
Thanks
Hi @mostlikely4r , so I think I understand the pull request workflow. I am going to experiment with it a little more but I have some questions.
Thanks
Hey @newapok69,
The amount of commits is up to you. Personally I usually try to group commits based on logical changes. So a commit for all Linux warning fixes and a commit for all Linux compile fixes is fine. Or just 1 commit with both or 1 commit per type of fix. See something you missed, fine to make it an new commit. For reviewing purpose it's nice if there isn't a lot of mixed changes in 1 commit (ie. Fixes + new spell casting + druid changes + mob behavior) where it's not obvious what's part of what.
The commit comment should describe what's in the commit. 'Linux compile fixes' is enough but fine to explain something if you think it's needed. For many commits it's nice to have -short description:long description... so it's easy to glance over but still has a full sentence for the long description.
You can create PRs whenever you want. Keep in mind that for the bot reppo I can review and merge so PR whenever. For the core reppos Celg has to merge which might take some time. Better to make 1 larger PR.
Thank you in advance for anything you'll share with us.
Alright. Sounds good. You can close this case.
Ubuntu 22.04 gcc 12.1 clang 14
cmake ../ -DCMAKE_INSTALL_PREFIX=/home/mangos/crun -DPCH=0 -DDEBUG=1 -DBUILD_IKE3_BOTS=1 -DBUILD_AHBOT=1
mangosbot-bot -- master branch cmangos-classic -- ike3-bots branch
clang_errors.pdf
gcc_errors.pdf
I have been trying for several weeks now to get the mangos-classic/bots compiled in Linux, and after several "fixes" I was finally able to; My C++ knowledge is old and some of my "fixes" are based on educated guesses and google searches. So I'm not actually sure whether or not the changes are correct. But I have a number of warnings still that I would like to fix, but I'm not sure what the solution would be; especially since some of them are logic or precedence issues. I have tried both GCC and Clang to check the errors, but they different errors. I don't know if that means these are false positive issues, or one or the other aren't capturing everything. I am attaching two compile logs so you can see the errors/warnings.
For me the most pressing concern are the logic issues like these from using the Clang compiler:
/home/mangos/apokdev/mangos-classic/src/modules/Bots/playerbot/strategy/actions/GenericActions.h:41:53: warning: logical not is only applied to the left hand side of this comparison [-Wlogical-not-parentheses] _if (!sServerFacade.isSpawned(go) || !go->GetGoState() == GO_STATEREADY || !bot->CanInteract(go))
/home/mangos/apokdev/mangos-classic/src/modules/Bots/playerbot/RandomPlayerbotMgr.cpp:850:25: [0;1;35mwarning: add explicit braces to avoid dangling else [-Wdangling-else] else
/home/mangos/apokdev/mangos-classic/src/modules/Bots/playerbot/Talentspec.cpp:411:17: warning: add explicit braces to avoid dangling else [-Wdangling-else] else if (reverse == ADDED_POINTS || reverse == REMOVED_POINTS)
/home/mangos/apokdev/mangos-classic/src/modules/Bots/playerbot/strategy/triggers/../values/../actions/../values/Stances.h:41:39: [0;1;35mwarning: delete called on 'ai::Stance' that is abstract but has non-virtual destructor [-Wdelete-abstract-non-virtual-dtor] ~StanceValue() { if (value) { delete value; value = NULL; } }
/home/mangos/apokdev/mangos-classic/src/modules/Bots/playerbot/strategy/values/Stances.cpp:181:16: warning: delete called on 'ai::Stance' that is abstract but has non-virtual destructor [-Wdelete-abstract-non-virtual-dtor] if (value) delete value; [0;1;32m ^
/home/mangos/apokdev/mangos-classic/src/modules/Bots/playerbot/strategy/triggers/../values/ThreatValues.h:9:120: [0;1;35mwarning: implicit conversion from 'double' to 'uint32' (aka 'unsigned int') changes value from 0.5 to 0 [-Wliteral-conversion] MyThreatValue(PlayerbotAI* ai, string name = "my threat") : LogCalculatedValue(ai, name) { minChangeInterval = 0.5; } [0;1;32m
/home/mangos/apokdev/mangos-classic/src/modules/Bots/playerbot/strategy/actions/AhAction.cpp:253:17: [0;1;35mwarning: add explicit braces to avoid dangling else [-Wdangling-else] else
/home/mangos/apokdev/mangos-classic/src/modules/Bots/playerbot/strategy/actions/ChooseTravelTargetAction.cpp:48:9: [0;1;35mwarning: add explicit braces to avoid dangling else [-Wdangling-else] else if (AI_VALUE2(bool, "group or", "should sell,can ah sell,following party,near leader") && bot->GetLevel() > 5) [0;1;32m
/home/mangos/apokdev/mangos-classic/src/modules/Bots/playerbot/strategy/actions/EmoteAction.cpp:439:48: [0;1;35mwarning: expression result unused [-Wunused-value] emoteText = "Right back at you, bub!", LANG_UNIVERSAL; [0;1;32m ^
~~~~~/home/mangos/apokdev/mangos-classic/src/modules/Bots/playerbot/strategy/actions/SuggestWhatToDoAction.cpp:329:27: [0;1;35mwarning: logical not is only applied to the left hand side of this comparison [-Wlogical-not-parentheses] if (flags != 0 && !chn->GetFlags() != flags) [0;1;32m ^ ~~ /home/mangos/apokdev/mangos-classic/src/modules/Bots/playerbot/strategy/actions/SuggestWhatToDoAction.cpp:329:27: [0;1;30mnote: add parentheses after the '!' to evaluate the comparison first if (flags != 0 && !chn->GetFlags() != flags) [0;1;32m ^ ( ) /home/mangos/apokdev/mangos-classic/src/modules/Bots/playerbot/strategy/actions/SuggestWhatToDoAction.cpp:329:27: [0;1;30mnote: add parentheses around left hand side expression to silence this warning if (flags != 0 && !chn->GetFlags() != flags)
/home/mangos/apokdev/mangos-classic/src/modules/Bots/playerbot/strategy/actions/TravelAction.cpp:44:13: [0;1;35mwarning: logical not is only applied to the left hand side of this comparison [-Wlogical-not-parentheses] if (!newTarget->GetEntry() != target->getDestination()->getEntry()) [0;1;32m ^ ~~ /home/mangos/apokdev/mangos-classic/src/modules/Bots/playerbot/strategy/actions/TravelAction.cpp:44:13: [0;1;30mnote: add parentheses after the '!' to evaluate the comparison first if (!newTarget->GetEntry() != target->getDestination()->getEntry()) [0;1;32m ^ ( ) /home/mangos/apokdev/mangos-classic/src/modules/Bots/playerbot/strategy/actions/TravelAction.cpp:44:13: [0;1;30mnote: add parentheses around left hand side expression to silence this warning if (!newTarget->GetEntry() != target->getDestination()->getEntry()) [0;1;32m ^ ( )
/home/mangos/apokdev/mangos-classic/src/modules/Bots/playerbot/strategy/generic/RpgStrategy.cpp:18:9: [0;1;35mwarning: add explicit braces to avoid dangling else [-Wdangling-else] else [0;1;32m ^
/home/mangos/apokdev/mangos-classic/src/modules/Bots/playerbot/strategy/values/ItemUsageValue.cpp:151:9: [0;1;35mwarning: add explicit braces to avoid dangling else [-Wdangling-else] else if (IsItemUsefulForQuest(bot, proto, true) && CurrentStacks(proto) < 2) //Do not sell quest items unless selling a full stack will stil keep enough in inventory. [0;1;32m ^ /home/mangos/apokdev/mangos-classic/src/modules/Bots/playerbot/strategy/values/ItemUsageValue.cpp:309:9: [0;1;35mwarning: add explicit braces to avoid dangling else [-Wdangling-else] else [0;1;32m ^ /home/mangos/apokdev/mangos-classic/src/modules/Bots/playerbot/strategy/values/ItemUsageValue.cpp:317:9: [0;1;35mwarning: add explicit braces to avoid dangling else [-Wdangling-else] else [0;1;32m ^ /home/mangos/apokdev/mangos-classic/src/modules/Bots/playerbot/strategy/values/ItemUsageValue.cpp:333:9: [0;1;35mwarning: add explicit braces to avoid dangling else [-Wdangling-else] else [0;1;32m ^ /home/mangos/apokdev/mangos-classic/src/modules/Bots/playerbot/strategy/values/ItemUsageValue.cpp:334:13: [0;1;35mwarning: expression result unused [-Wunused-value] ITEM_USAGE_NONE; [0;1;32m ^
~~~~~~/home/mangos/apokdev/mangos-classic/src/modules/Bots/playerbot/strategy/values/PartyMemberWithoutItemValue.cpp:51:5: [0;1;35mwarning: delete called on 'ai::FindPlayerPredicate' that is abstract but has non-virtual destructor [-Wdelete-abstract-non-virtual-dtor] delete predicate; [0;1;32m ^
/home/mangos/apokdev/mangos-classic/src/modules/Bots/playerbot/strategy/values/ThreatValues.h:9:120: [0;1;35mwarning: implicit conversion from 'double' to 'uint32' (aka 'unsigned int') changes value from 0.5 to 0 [-Wliteral-conversion] MyThreatValue(PlayerbotAI* ai, string name = "my threat") : LogCalculatedValue(ai, name) { minChangeInterval = 0.5; } [0;1;32m
/home/mangos/apokdev/mangos-classic/src/modules/Bots/playerbot/strategy/hunter/HunterTriggers.h:7:61: [0;1;35mwarning: implicit conversion from 'float' to 'int' changes value from 2.5 to 2 [-Wliteral-conversion] HAS_AURA_TRIGGER_TIME(FeignDeathTrigger, "feign death", 2.5f); [0;1;32m
~~~~~~~~~~~~^~~~~ /home/mangos/apokdev/mangos-classic/src/modules/Bots/playerbot/strategy/AiObject.h:217:60: [0;1;30mnote: expanded from macro 'HAS_AURA_TRIGGER_TIME' clazz(PlayerbotAI* ai) : HasAuraTrigger(ai, spell, time) {} \ [0;1;32m~~~~ ^~/home/mangos/apokdev/mangos-classic/src/game/Maps/GridMap.cpp:305:9: [0;1;35mwarning: address of array 'this->m_holes' will always evaluate to 'true' [-Wpointer-bool-conversion] if (m_holes && isHole(x_int, y_int)) [0;1;32m ^
~~ ~~/home/mangos/apokdev/mangos-classic/src/game/Maps/Map.cpp:3233:169: [0;1;35mwarning: format specifies type 'unsigned int' but the argument has type 'const ObjectGuid' [-Wformat] QueryResult* result = CharacterDatabase.PQuery("SELECT
GUID
,Difficulty
,GroupSize
FROMcustom_solocraft_character_stats
WHERE GUID = %u", itr->guid); [0;1;32mGCC did not have these same issues so it is confusing. Like these:
/home/mangos/apokdev/mangos-classic/src/modules/Bots/playerbot/PlayerbotAIConfig.cpp:689:29: warning: ‘%02d’ directive output may be truncated writing between 2 and 11 bytes into a region of size between 8 and 15 [-Wformat-truncation=] 689 | snprintf(buf, 20, "%04d-%02d-%02d %02d-%02d-%02d", aTm->tm_year + 1900, aTm->tm_mon + 1, aTm->tm_mday, aTm->tm_hour, aTm->tm_min, aTm->tm_sec); | ^~~~ /home/mangos/apokdev/mangos-classic/src/modules/Bots/playerbot/PlayerbotAIConfig.cpp:689:23: note: directive argument in the range [-2147483647, 2147483647] 689 | snprintf(buf, 20, "%04d-%02d-%02d %02d-%02d-%02d", aTm->tm_year + 1900, aTm->tm_mon + 1, aTm->tm_mday, aTm->tm_hour, aTm->tm_min, aTm->tm_sec); | ^
~~~~~~/home/mangos/apokdev/mangos-classic/src/modules/Bots/playerbot/PlayerbotAIConfig.cpp:689:13: note: ‘snprintf’ output between 20 and 72 bytes into a destination of size 20 689 | snprintf(buf, 20, "%04d-%02d-%02d %02d-%02d-%02d", aTm->tm_year + 1900, aTm->tm_mon + 1, aTm->tm_mday, aTm->tm_hour, aTm->tm_min, aTm->tm_sec); |~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~/home/mangos/apokdev/mangos-classic/src/modules/Bots/playerbot/RandomItemMgr.cpp:3215:44: warning: assignment from temporary ‘initializer_list’ does not extend the lifetime of the underlying array [-Winit-list-lifetime] 3215 | items = { 787, 117, 4540, 2680 }; | ^
Thanks