UKnowMe / AC-Lua

Lua mod for AssaultCube
0 stars 4 forks source link

Build error with gcc 6 on debian 9 #2

Open IguanaMeow opened 6 years ago

IguanaMeow commented 6 years ago

Installed Dependencies: build-essential git wget zlibg1 zlibg1-dev clang llvm liblua5.1-0 liblua5.1-0-dev liblualib50-dev libreadline-dev libncurses5-dev ncurses-base libpthread-stubs0-dev libenet7

Cloning and Building (More in Build-Error.txt): make[1]: Entering directory '/home/iguana/Desktop/AC-Lua' mkdir -p linux_release g++ -c -O2 -Wall -DSTANDALONE -Ienet/include -o linux_release/crypto.o src/crypto.cpp In file included from src/cube.h:8:0, from src/crypto.cpp:1: src/tools.h: In function ‘float round(float)’: src/tools.h:58:34: error: ‘float round(float)’ conflicts with a previous declaration static inline float round(float x) { return floor(x + 0.5f); } ^ In file included from /usr/include/c++/6/math.h:36:0, from src/platform.h:9, from src/cube.h:7, from src/crypto.cpp:1: /usr/include/c++/6/cmath:1790:3: note: previous declaration ‘constexpr float std::round(float)’ round(float __x) ^~~~~ In file included from src/cube.h:69:0, from src/crypto.cpp:1: src/protos.h: In member function ‘bool servercommandline::checkarg(const char*)’: src/protos.h:1034:17: warning: this ‘else’ clause does not guard... [-Wmisleading-indentation] else if(ai > 0) maxdemos = ai; break; ^~~~ src/protos.h:1034:48: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘else’ else if(ai > 0) maxdemos = ai; break; ^~~~~ Makefile.linux:44: recipe for target 'linux_release/crypto.o' failed make[1]: *** [linux_release/crypto.o] Error 1 make[1]: Leaving directory '/home/iguana/Desktop/AC-Lua' Makefile:20: recipe for target 'linux' failed make: *** [linux] Error 2

GCC version iguana@mac:~/Desktop/AC-Lua$ gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/6/lto-wrapper Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Debian 6.3.0-18' --with-bugurl=file:///usr/share/doc/gcc-6/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-6 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-6-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-6-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-6-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --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 6.3.0 20170516 (Debian 6.3.0-18)

uname -a iguana@mac:~/Desktop/AC-Lua$ uname -a Linux mac 4.9.0-3-amd64 #1 SMP Debian 4.9.30-2+deb9u5 (2017-09-19) x86_64 GNU/Linux

IguanaMeow commented 6 years ago

Ok i fixed the build error by just replacing the tools.h with AssaultCube's legacy1202 branch's tools.h

Though now I have a problem with loading lua scripts The same error as before: http://gema.forumactif.com/t447-geoip-lua-server-linux


logging local AssaultCube server (version 1202, protocol 1201/104) now..
<Lua> Using lua/scripts/ as Lua scripts directory
<Lua> Initializing framework...
<Lua> Script loaded: GeoIP.lua
(!) Initializing IP database...
<Lua> Error when calling onInit handler:
lua/scripts/GeoIP.lua:189: module 'webnet77' not found:
   no field package.preload['webnet77']
   no file './webnet77.lua'
   no file '/usr/local/share/lua/5.1/webnet77.lua'
   no file '/usr/local/share/lua/5.1/webnet77/init.lua'
   no file '/usr/local/lib/lua/5.1/webnet77.lua'
   no file '/usr/local/lib/lua/5.1/webnet77/init.lua'
   no file './webnet77.so'
   no file '/usr/local/lib/lua/5.1/webnet77.so'
   no file '/usr/local/lib/lua/5.1/loadall.so'
<Lua> -- Name: GeoIP with Voteblocker and Maplist Creator and Disconnect Msg'er
<Lua> -- Author: Chidori EDITED By Park
<Lua> -- Version: 1.3
<Lua> Framework initialized, 1 scripts loaded
<Lua> Hitreg fix enabled
read 886 map rotation entries from 'config/maprot2.cfg'
read 4 admin passwords from 'config/serverpwd.cfg'
read 0 (0) blacklist entries from 'config/serverblacklist.cfg', 0 errors
read 0 + 6 entries from nickname blacklist file 'config/nicknameblacklist.cfg', 0 errors
anticheat: disabled
dedicated server started, waiting for clients...
Ctrl-C to exit
looking up ms.cubers.net:28760...```
UKnowMe commented 6 years ago

I'd guess that either webnet is missing some dependencies or it is not compatible with this version of Lua/the Lua Mod.

But I'm sorry to inform you that I do not have the time to maintain this mod. I don't know the current state of development of AssaultCube. I'd guess that a new version came out, based on the info you provided. You probably need to change a few things to get the Lua mod working, and while you're at it you could (theoretically) upgrade Lua to a newer version, although this would require a few more changes (and some might not be easy, iirc) What makes things worse is the glorious (read: horrendous) source code of AssaultCube. Given the fact that the Cube engine is now over 10 years old (and AssaultCube itself is not that much younger), the code grew over time, and was modified by many people, resulting in the code we have today. What you experienced in the initial bug report is a result of this. I don't know much about game development, but for me it seems extremely counter-intuitive to provide a custom round function. Maybe that was a good idea 10 years ago, when processors were slower and functions less optimized, but nowadays chances are good that you'll actually slow down your application with these kinds of functions. (But I may be wrong about this, I don't have any numbers at hand. But if I remember correctly, processors nowadays use double-point precision, so the use of floats does not bring any benefits (except for less memory usage, which shouldn't be a problem on today's computers nevertheless))

Don't get me wrong, I generally like the Cube engine, it's fast, flexible and still looks good (well, maybe not if you go with today's standards). But the code is just horrendous. I suspect if you'd write a new Cube Engine (Cube 3?) with today's technology, you could get an engine with comparable performance, but better graphics. Just imagine what AssaultCube could look like with Godrays. Maybe we'll get one day such an engine, but today might not be that day.

I wish I could help you more. Sorry.

IguanaMeow commented 6 years ago

I figured out what was the problem, turns out in your makefule.linux you had it loading external libraries from lua5.1 instead of lua. Also I sent you a pull request with fixes to compile for GCC6.