celguar / mangosbot-bots

Bot AI Core from ike3 for cmangos/mangos classic/tbc/wotlk
https://github.com/cmangos/playerbots
84 stars 40 forks source link

[Wotlk] Compile error on Ubuntu 20 & 22 #254

Open Sigmur opened 1 year ago

Sigmur commented 1 year ago

I understand that this project is windows focused and linux is not a prio, but i saw some linux fixes in the issues and i thought it was worth a shot to call out my linux bois to the rescue.

I used install instructions from this : https://github.com/cmangos/issues/wiki/Installation-Instructions

Env : Ubuntu server 20 & 22, tried on both, brand new server every time. gcc 9.4.0 (U20) & 12 (U22) cmake 3.16 (U20) & 3.22 (U22)

Cmd used for install :

#Install
sudo apt install build-essential gcc g++ automake git-core autoconf make patch libmysql++-dev mysql-server libtool libssl-dev grep binutils zlibc libbz2-dev cmake libboost-all-dev
mkdir /home/ubuntu/server
cd /home/ubuntu/server

#Get sources
git clone https://github.com/celguar/mangos-wotlk.git --recursive -b ike3-bots sources

#Setup build dirs
mkdir build
mkdir bin
cd build

#Cmake
cd build
cmake ../sources -DCMAKE_INSTALL_PREFIX=~/server/bin -DBUILD_EXTRACTORS=0 -DPCH=1 -DDEBUG=0 -DBUILD_IKE3_BOTS=1

#Build (4 core 8 threads)
make -j8

Error lists and their resolutions :

case sensitive inclusion

in /src/modules/Bots/playerbot/strategy/ExternalEventHelper.h:4

#include "Triggers/WorldPacketTrigger.h"

Changed to

#include "triggers/WorldPacketTrigger.h"

error: call of overloaded "WorldPosition(const ai::GuidPosition&)" is ambiguous

I'm a bit rusty in C++, from what i understand, he doesn't know what constructor to use so i just used another WorldPosition constructor, probably not optimised

in /src/modules/Bots/playerbot/GuidPosition.h:53

operator bool() const { return  WorldPosition(*this) && !IsEmpty(); }

Changed to

operator bool() const { return  WorldPosition(mapid, coord_x, coord_y, coord_z, orientation) && !IsEmpty(); }

missing ChatHelper include

/home/ubuntu/server/sources/src/modules/Bots/playerbot/strategy/values/../Value.h: In member function ‘virtual std::string ai::ObjectGuidCalculatedValue::Format()’:
/home/ubuntu/server/sources/src/modules/Bots/playerbot/strategy/values/../Value.h:273:31: error: invalid use of incomplete type ‘class ai::ChatHelper’
  273 |             return guid ? chat->formatGuidPosition(guid) : "<none>";

added in /src/modules/Bots/playerbot/strategy/Value.h

#include "../ChatHelper.h"

case sensitive inclusion

/home/ubuntu/server/sources/src/modules/Bots/playerbot/strategy/actions/ChatActionContext.h:74:10: fatal error: BattlegroundJoinAction.h: No such file or directory
   74 | #include "BattlegroundJoinAction.h"

in /src/modules/Bots/playerbot/strategy/actions/ChatActionContext.h:74

#include "BattleGroundJoinAction.h"

Current error to resolve :

In file included from /home/ubuntu/server/sources/src/modules/Bots/playerbot/PlayerbotAI.h:6,
                 from /home/ubuntu/server/sources/src/modules/Bots/playerbot/playerbot.h:23,
                 from /home/ubuntu/server/sources/src/modules/Bots/botpch.h:16,
                 from /home/ubuntu/server/sources/src/modules/Bots/playerbot/strategy/actions/MovementActions.cpp:1:
/home/ubuntu/server/sources/src/modules/Bots/playerbot/strategy/actions/MovementActions.cpp: In member function ‘bool ai::MovementAction::IsHazardNearPosition(const ai::WorldPosition&, ai::HazardPosition*)’:
/home/ubuntu/server/sources/src/modules/Bots/playerbot/strategy/AiObjectContext.h:100:64: error: cannot bind non-const lvalue reference of type ‘std::__cxx11::list<std::pair<ai::WorldPosition, float> >&’ to an rvalue of type ‘std::__cxx11::list<std::pair<ai::WorldPosition, float> >’
  100 | #define AI_VALUE(type, name) context->GetValue<type>(name)->Get()
      |                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
/home/ubuntu/server/sources/src/modules/Bots/playerbot/strategy/actions/MovementActions.cpp:1929:37: note: in expansion of macro ‘AI_VALUE’
 1929 |     list<HazardPosition>& hazards = AI_VALUE(list<HazardPosition>, "hazards");
      |                                     ^~~~~~~~
/home/ubuntu/server/sources/src/modules/Bots/playerbot/strategy/actions/MovementActions.cpp: In member function ‘bool ai::MovementAction::GeneratePathAvoidingHazards(const ai::WorldPosition&, bool, Movement::PointsArray&)’:
/home/ubuntu/server/sources/src/modules/Bots/playerbot/strategy/AiObjectContext.h:100:64: error: cannot bind non-const lvalue reference of type ‘std::__cxx11::list<std::pair<ai::WorldPosition, float> >&’ to an rvalue of type ‘std::__cxx11::list<std::pair<ai::WorldPosition, float> >’
  100 | #define AI_VALUE(type, name) context->GetValue<type>(name)->Get()
      |                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
/home/ubuntu/server/sources/src/modules/Bots/playerbot/strategy/actions/MovementActions.cpp:1956:41: note: in expansion of macro ‘AI_VALUE’
 1956 |         list<HazardPosition>& hazards = AI_VALUE(list<HazardPosition>, "hazards");
      |                                         ^~~~~~~~

Another error, if i try to compile the core without the bot module, every commands are the same except :

cmake ../sources -DCMAKE_INSTALL_PREFIX=~/server/bin -DBUILD_EXTRACTORS=0 -DPCH=1 -DDEBUG=0 -DBUILD_IKE3_BOTS=0

Error :

[ 16%] Building CXX object src/game/CMakeFiles/game.dir/AI/ScriptDevAI/scripts/battlegrounds/battlegrounds.cpp.o
[ 16%] Building CXX object src/game/CMakeFiles/game.dir/AI/ScriptDevAI/scripts/custom/Transmogrification.cpp.o
In file included from /home/ubuntu/server/sources/src/game/AI/ScriptDevAI/scripts/custom/Transmogrification.cpp:1:
/home/ubuntu/server/sources/src/game/AI/ScriptDevAI/scripts/custom/Transmogrification.h:4:10: fatal error: World.h: No such file or directory
    4 | #include "World.h"
      |          ^~~~~~~~~
compilation terminated.
Falladis commented 1 year ago

same exact thing on ubuntu 23.04

[ 12%] Building CXX object src/game/CMakeFiles/game.dir/AI/ScriptDevAI/scripts/custom/Transmogrification.cpp.o
In file included from /home/user/cmangos/mangos/src/game/AI/ScriptDevAI/scripts/custom/Transmogrification.cpp:1:
/home/user/cmangos/mangos/src/game/AI/ScriptDevAI/scripts/custom/Transmogrification.h:4:10: fatal error: World.h: No such file or directory
    4 | #include "World.h"
      |          ^~~~~~~~~
compilation terminated.
make[2]: *** [src/game/CMakeFiles/game.dir/build.make:525: src/game/CMakeFiles/game.dir/AI/ScriptDevAI/scripts/custom/Transmogrification.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:640: src/game/CMakeFiles/game.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
kelbren commented 1 year ago

Try changing it to

include "../../../../World/World.h"

It exists, the path is just not finding it.

Falladis commented 1 year ago

Try changing it to #include "../../../../World/World.h"

It exists, the path is just not finding it.

having this now

/home/user/cmangos/mangos/src/game/Chat/Level3.cpp:65:10: fatal error: tchar.h: No such file or directory
   65 | #include <tchar.h>
      |          ^~~~~~~~~
compilation terminated.
make[2]: *** [src/game/CMakeFiles/game.dir/build.make:9021: src/game/CMakeFiles/game.dir/Chat/Level3.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/Makefile2:640: src/game/CMakeFiles/game.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

and as far as I know that file does not exist for me.

kelbren commented 1 year ago

I just commented this out, as the file did not exist for me either and was able to compile fine on linux without it. I am not sure, but maybe it is needed for windows.

gl

Falladis commented 1 year ago

I just commented this out, as the file did not exist for me either and was able to compile fine on linux without it. I am not sure, but maybe it is needed for windows.

gl

you didn't have further errors after?

celguar commented 1 year ago

Yea this file is for windows only, sorry