Josko / aura-bot

Warcraft III high-performance hosting bot written in C++14.
75 stars 42 forks source link

Error trying to make #36

Closed vampiricwulf closed 7 years ago

vampiricwulf commented 7 years ago
# clang -v
clang version 3.8.0-2ubuntu3~trusty4 (tags/RELEASE_380/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8.5
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9.4
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/6.2.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.2.0
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9
Candidate multilib: .;@m64
Selected multilib: .;@m64
# g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.9/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.9.4-2ubuntu1~14.04.1' --with-bugurl=file:///usr/share/doc/gcc-4.9/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.9 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.9 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.9-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.9-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.9-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.9.4 (Ubuntu 4.9.4-2ubuntu1~14.04.1)
aura-bot# make
In file included from src/bncsutilinterface.cpp:23:0:
src/util.h: In function 'std::string ByteArrayToDecString(const std::vector<unsigned char>&)':
src/util.h:98:25: error: 'cbegin' was not declared in this scope
   for (auto i = cbegin(b) + 1; i != cend(b); ++i)
                         ^
src/util.h:98:43: error: 'cend' was not declared in this scope
   for (auto i = cbegin(b) + 1; i != cend(b); ++i)
                                           ^
src/util.h: In function 'std::string ByteArrayToHexString(const std::vector<unsigned char>&)':
src/util.h:111:25: error: 'cbegin' was not declared in this scope
   for (auto i = cbegin(b) + 1; i != cend(b); ++i)
                         ^
src/util.h:111:43: error: 'cend' was not declared in this scope
   for (auto i = cbegin(b) + 1; i != cend(b); ++i)
                                           ^
make: *** [src/bncsutilinterface.o] Error 1
Josko commented 7 years ago

Hi!

The problem here is that the freestanding functions that return the const begin and end (cbegin and cend()) were added in C++14 which was subsequently enabled as "-std=c++14" in gcc5. The requirement is stated in the README.md:

Note: gcc version needs to be 5 or higher along with a compatible libc.

If upgrading gcc is a really big problem, it would be easier just to remove the 'c's (cbegin(foo) -> begin(foo) and cend(foo) -> end(foo)) or rewrite the problem lines with foo.cbegin()/foo.cend() (member functions).

(Or build it using the clang-3.8, this should work nicely! ie. "CC=clang CXX=clang++ make")

vampiricwulf commented 7 years ago

Oh my god! I read "5" as "4.5"... Thank you for your fast response, I'll add a new post when I've attempted the solution.

Josko commented 7 years ago

Btw. just to put it out there, the master branch is currently in development and super-buggy. Please use the revision fc804dd8d2135940e1d4468039853664d2d44602 or older!

vampiricwulf commented 7 years ago
[CONFIG] loading file [aura.cfg]
[AURA] starting up
[AURA] using monotonic timer with resolution 1.000000 nanoseconds
[SQLITE3] version 3.15.1
[SQLITE3] opening database [aura.dbs]
[SQLITE3] found schema number [1]
[AURA] Aura++ version 1.31 - with GProxy++ support
[UDPSOCKET] using default broadcast target
[AURA] listening for GProxy++ reconnects on port 6113
[AURA] warning - irc connection not found in config file
[AURA] found battle.net connection #1 for server [useast.battle.net]
[AURA] loading MPQ file [War3/War3Patch.mpq]
[AURA] extracting Scripts\common.j from MPQ file to [mapcfgs/common.j]
[AURA] extracting Scripts\blizzard.j from MPQ file to [mapcfgs/blizzard.j]
[CONFIG] loading file [mapcfgs/wormwar.cfg]
[MAP] loading MPQ file [War3/Maps/(12)WormWar.w3x]
[MAP] calculated map_size = 72 212 5 0
[MAP] calculated map_info = 28 52 154 58
[MAP] calculated map_crc = 80 141 86 241
[MAP] calculated map_sha1 = 160 89 184 120 166 55 95 114 63 230 155 36 118 153 96 118 156 58 60
[MAP] calculated map_options = 0
[MAP] calculated map_width = 84 0
[MAP] calculated map_height = 84 0
[MAP] calculated map_numplayers = 12
[MAP] calculated map_numteams = 1
[MAP] calculated map_slot1 = 0 255 0 0 0 0 8 1 100
[MAP] calculated map_slot2 = 0 255 0 0 0 1 8 1 100
[MAP] calculated map_slot3 = 0 255 0 0 0 2 8 1 100
[MAP] calculated map_slot4 = 0 255 0 0 0 3 8 1 100
[MAP] calculated map_slot5 = 0 255 0 0 0 4 8 1 100
[MAP] calculated map_slot6 = 0 255 0 0 0 5 8 1 100
[MAP] calculated map_slot7 = 0 255 0 0 0 6 8 1 100
[MAP] calculated map_slot8 = 0 255 0 0 0 7 8 1 100
[MAP] calculated map_slot9 = 0 255 0 0 0 8 8 1 100
[MAP] calculated map_slot10 = 0 255 0 0 0 9 8 1 100
[MAP] calculated map_slot11 = 0 255 0 0 0 10 8 1 100
[MAP] calculated map_slot12 = 0 255 0 0 0 11 8 1 100
[MAP] overriding calculated map_size with config value map_size = 201 213 5 0
[MAP] overriding calculated map_info with config value map_info = 206 105 219 80
[MAP] overriding calculated map_crc with config value map_crc = 15 15 71 22
[MAP] overriding calculated map_sha1 with config value map_sha1 = 91 92 122 144 89 127 250 70 133 235 247 76 193 31 109 105 36 250 36 16
[MAP] overriding calculated map_filter_type with config value map_filter_type = 2
[MAP] overriding calculated map_width with config value map_width = 84 0
[MAP] overriding calculated map_height with config value map_height = 84 0
[MAP] overriding calculated map_numplayers with config value map_numplayers = 12
[MAP] overriding calculated map_numteams with config value map_numteams = 1
[MAP] overriding slots
[MAP] invalid map_size detected - size mismatch with actual map data
[AURA] started loading [ip-to-country.csv]
[AURA] iptocountry data: 10% loaded
[AURA] iptocountry data: 20% loaded
[AURA] iptocountry data: 30% loaded
[AURA] iptocountry data: 40% loaded
[AURA] iptocountry data: 50% loaded
[AURA] iptocountry data: 60% loaded
[AURA] iptocountry data: 70% loaded
[AURA] iptocountry data: 80% loaded
[AURA] iptocountry data: 90% loaded
[AURA] iptocountry data: 100% loaded
[AURA] finished loading [ip-to-country.csv]
[BNET: USEast] connecting to server [useast.battle.net] on port 6112
[BNET: USEast] resolved and cached server IP address 199.108.55.51
[BNET: USEast] connected
[TCPSOCKET] closed by remote host
[BNET: USEast] disconnected from battle.net
^C[!!!] caught signal SIGINT, exiting NOW
[AURA] shutting down
[SQLITE3] closing database [aura.dbs]

Why is my connection being closed?

Josko commented 7 years ago

Well this is usually a sign something is wrong ie. version, user&pass, cd keys, etc. Are you sure what you've entered is correct? If you are, I'll take a look at what is being sent as it's possible that recent modernization efforts changed a bit here and there.

vampiricwulf commented 7 years ago

Version: I used my up to date files User & Pass: tested it on my account I frequently use CD keys: ones I use to play I am not logged onto my account on b.net when I try to run the bot, so the key and the account aren't in use.

Josko commented 7 years ago

OK, good enough. I'll debug the logon and see what's up. Like mentioned before, it's really possible I dun goofed.

vampiricwulf commented 7 years ago

Alright~ Keep me posted on the results.

Josko commented 7 years ago

Could you please try with the same revision but patch in the commit f8023fc99e8965ba4ed0f1cf28a39ee59991fcaa (cherry-pick it).

Maybe it's even easier to just modify it yourself since it's so small and I'll continue the work on the project soon-ish so the master is usable once more.

vampiricwulf commented 7 years ago
-return std::vector<uint8_t>(a, a + size - 1);
+return std::vector<uint8_t>(a, a + size);

Just to confirm that's all I had to change, that's all I did. I mention it because at the revision https://github.com/Josko/aura-bot/commit/fc804dd8d2135940e1d4468039853664d2d44602 (you mentioned to use earlier) util.h doesn't use uint_fast8_t.

Also I wish you mentioned that doing make clean; make would delete my cfg, because it took me a while to put it back together ;_;.

Also, it fixed it!

Josko commented 7 years ago

Yup, just the "- 1" part. And make didn't do it, probably git commands (like git checkout .). Thanks for the feedback!