TrinityCore icon indicating copy to clipboard operation
TrinityCore copied to clipboard

[6.x] Cant compile under Ubuntu

Open Destalker opened this issue 10 years ago • 15 comments

Ubuntu 14.04.2 LTS GCC - gcc (Ubuntu 4.8.4-2ubuntu1~14.04)

Rev. https://github.com/TrinityCore/TrinityCore/commit/6ace6aabbff91ebc487f43276d5b1861968c59db

Boost - 1.55 MySQL - Ver 14.14 Distrib 5.5.46, for debian-linux-gnu (x86_64) using readline 6.3 OpenSSL - OpenSSL 1.0.1f 6 Jan 2014 ZeroMQ - version: 2.2.0+dfsg-5

/home/wod_623/TrinityCore/src/server/game/Texts/CreatureTextMgr.cpp: In member function ‘uint32 CreatureTextMgr::SendChat(Creature_, uint8, const WorldObject_, ChatMsg, Language, CreatureTextRange, uint32, Team, bool, Player_)’: /home/wod_623/TrinityCore/src/server/game/Texts/CreatureTextMgr.cpp:237:6: error: no matching function for call to ‘SelectRandomWeightedContainerElement(CreatureTextGroup&, CreatureTextMgr::SendChat(Creature_, uint8, const WorldObject_, ChatMsg, Language, CreatureTextRange, uint32, Team, bool, Player_)::lambda4)’ }); ^ /home/wod_623/TrinityCore/src/server/game/Texts/CreatureTextMgr.cpp:237:6: note: candidates are: In file included from /home/wod_623/TrinityCore/src/server/game/AI/CoreAI/UnitAI.h:24:0, from /home/wod_623/TrinityCore/src/server/game/AI/CreatureAI.h:23, from /home/wod_623/TrinityCore/src/server/game/Grids/Notifiers/GridNotifiers.h:33, from /home/wod_623/TrinityCore/src/server/game/Texts/CreatureTextMgr.cpp:24: /home/wod_623/TrinityCore/src/common/Utilities/Containers.h:82:36: note: template typename C::const_iterator Trinity::Containers::SelectRandomWeightedContainerElement(const C&, std::vector) typename C::const_iterator SelectRandomWeightedContainerElement(C const& container, std::vector weights) ^ /home/wod_623/TrinityCore/src/common/Utilities/Containers.h:82:36: note: template argument deduction/substitution failed: /home/wod_623/TrinityCore/src/server/game/Texts/CreatureTextMgr.cpp:237:6: note: cannot convert ‘CreatureTextMgr::SendChat(Creature, uint8, const WorldObject, ChatMsg, Language, CreatureTextRange, uint32, Team, bool, Player_)::lambda4{}’ (type ‘CreatureTextMgr::SendChat(Creature, uint8, const WorldObject, ChatMsg, Language, CreatureTextRange, uint32, Team, bool, Player_)::lambda4’) to type ‘std::vector’ }); ^ In file included from /home/wod_623/TrinityCore/src/server/game/AI/CoreAI/UnitAI.h:24:0, from /home/wod_623/TrinityCore/src/server/game/AI/CreatureAI.h:23, from /home/wod_623/TrinityCore/src/server/game/Grids/Notifiers/GridNotifiers.h:33, from /home/wod_623/TrinityCore/src/server/game/Texts/CreatureTextMgr.cpp:24: /home/wod_623/TrinityCore/src/common/Utilities/Containers.h:100:36: note: template typename C::const_iterator Trinity::Containers::SelectRandomWeightedContainerElement(const C&, std::function<double(const typename C::value_type&)>) typename C::const_iterator SelectRandomWeightedContainerElement(C const& container, std::function<double(typename C::value_type const&)> weightExtractor) ^ /home/wod_623/TrinityCore/src/common/Utilities/Containers.h:100:36: note: template argument deduction/substitution failed: /home/wod_623/TrinityCore/src/server/game/Texts/CreatureTextMgr.cpp:237:6: note: ‘CreatureTextMgr::SendChat(Creature, uint8, const WorldObject, ChatMsg, Language, CreatureTextRange, uint32, Team, bool, Player_)::__lambda4’ is not derived from ‘std::function<double(const typename C::value_type&)>’ }); ^ make[2]: *_* [src/server/game/CMakeFiles/game.dir/Texts/CreatureTextMgr.cpp.o] Error 1 make[2]: *** Waiting for unfinished jobs....

make[1]: *** [src/server/game/CMakeFiles/game.dir/all] Error 2 make: *** [all] Error 2

Destalker avatar Dec 29 '15 21:12 Destalker

with this commit https://github.com/TrinityCore/TrinityCore/commit/41d6460c75ce094e8ade92c88b603231aaa8e8a5 compile broke, I guess something was missed .

dansanti avatar Dec 31 '15 22:12 dansanti

Strange, travis uses gcc 4.8 and compiles fine.

Aokromes avatar Dec 31 '15 23:12 Aokromes

I'm on ubuntu 14.04.3 , and gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04)

dansanti avatar Dec 31 '15 23:12 dansanti

same problem... (followed trinitycore.info guide (apt-get install freshly)

[ 15%] Building CXX object src/server/game/CMakeFiles/game.dir/Texts/CreatureTextMgr.cpp.o /home/.../.../src/server/game/Texts/CreatureTextMgr.cpp: In member function 'uint32 CreatureTextMgr::SendChat(Creature_, uint8, const WorldObject_, ChatMsg, Language, CreatureTextRange, uint32, Team, bool, Player_)': /home/.../.../src/server/game/Texts/CreatureTextMgr.cpp:237:6: error: no matching function for call to 'SelectRandomWeightedContainerElement(CreatureTextGroup&, CreatureTextMgr::SendChat(Creature_, uint8, const WorldObject_, ChatMsg, Language, CreatureTextRange, uint32, Team, bool, Player_)::__lambda4)' }); ^ compilation terminated due to -Wfatal-errors. make[2]: *** [src/server/game/CMakeFiles/game.dir/Texts/CreatureTextMgr.cpp.o] Error 1 make[1]: *** [src/server/game/CMakeFiles/game.dir/all] Error 2 make[1]: *** Waiting for unfinished jobs.... Linking CXX shared module libScriptPCH.cpp_dephelp.so [ 15%] Built target ScriptPCH.cpp_dephelp [ 15%] Built target generate_bnetPCH.cpp [ 15%] Built target generate_worldPCH.cpp make: *** [all] Error 2

MeliodasLIVE avatar Jan 02 '16 06:01 MeliodasLIVE

Cannot reproduce on a fully updated ubuntu 14.04.3 LTS.

Aokromes avatar Jan 02 '16 10:01 Aokromes

@Shauren any idea? I re-installed Ubuntu 14.04, followed exactly 1:1 trinitycore.info - but CreatureTextMgr.cpp making some problems. And btw, I saw a commit where you improved random creature texts. Maybe there is something missing?

MeliodasLIVE avatar Jan 02 '16 16:01 MeliodasLIVE

And now? 00c878e73a8c6b8ce3339d224ab5611df3bbd07c

Shauren avatar Jan 02 '16 17:01 Shauren

Hi! nop :/ . I try compiling upgrading ubuntu, to kernel 3.16.0-57-generic,

  • make clean
  • make -j 4 but still happens:

/home/wow/TrinityCore/src/server/game/Texts/CreatureTextMgr.cpp: In member function ‘uint32 CreatureTextMgr::SendChat(Creature_, uint8, const WorldObject_, ChatMsg, Language, CreatureTextRange, uint32, Team, bool, Player_)’: /home/wow/TrinityCore/src/server/game/Texts/CreatureTextMgr.cpp:237:6: error: no matching function for call to ‘SelectRandomWeightedContainerElement(CreatureTextGroup&, CreatureTextMgr::SendChat(Creature_, uint8, const WorldObject_, ChatMsg, Language, CreatureTextRange, uint32, Team, bool, Player_)::__lambda4)’ }); ^ compilation terminated due to -Wfatal-errors. make[2]: *** [src/server/game/CMakeFiles/game.dir/Texts/CreatureTextMgr.cpp.o] Error 1

dansanti avatar Jan 02 '16 20:01 dansanti

I will test it later, I'm not home currently.

apparently it didnt fix the problem @Shauren unbenannt

MeliodasLIVE avatar Jan 03 '16 03:01 MeliodasLIVE

What about this?

diff --git a/src/common/Utilities/Containers.h b/src/common/Utilities/Containers.h
index 13e5dc5..7e08f24 100644
--- a/src/common/Utilities/Containers.h
+++ b/src/common/Utilities/Containers.h
@@ -96,8 +96,8 @@ namespace Trinity
          *
          * Note: container cannot be empty
          */
-        template <class C>
-        typename C::const_iterator SelectRandomWeightedContainerElement(C const& container, std::function<double(typename C::value_type const&)> const& weightExtractor)
+        template <class C, class F>
+        typename C::const_iterator SelectRandomWeightedContainerElement(C const& container, F weightExtractor)
         {
             std::vector<double> weights;
             weights.reserve(container.size());

It has the advantage of not forcing a conversion to std::function. The downside is that F is not expressed in terms of C or double however it will still error if std::transform is fed something that doesn't make sense.

DDuarte avatar Jan 03 '16 17:01 DDuarte

Acceptable but as you said the reason std::function was used was to inform the programmer about return type/arguments

Shauren avatar Jan 03 '16 18:01 Shauren

Does it Work? I can test if you Wish

MeliodasLIVE avatar Jan 03 '16 19:01 MeliodasLIVE

Yes, test it please.

DDuarte avatar Jan 03 '16 19:01 DDuarte

Hi Using @DDuarte patch works fine

dansanti avatar Jan 03 '16 19:01 dansanti

It looks good, he dont show error anymore. I will wait till he finished for a final feedback. Thanks (obrigado) @DDuarte

MeliodasLIVE avatar Jan 03 '16 20:01 MeliodasLIVE