• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Compiling Errors while compiling TFS in Ubuntu 20.04. Please help.

CoolBuys1290

Member
Joined
Aug 23, 2018
Messages
80
Reaction score
8
Need help compiling in Ubuntu 20.04. After entering in sudo make I get this:
Getting errors at catch (std::invalid_argument) by value [-Werror=catch-value=] and catch (std::eek:ut_of_range) by value [W-error=catch-value=]

C++:
int32_t BehaviourDatabase::searchDigit(const std::string& message)
{
    int32_t start = -1;
    int32_t end = -1;
    int32_t value = 0;
    int32_t i = -1;

    for (char c : message) {
        i++;
        if (start == -1 && IsDigit(c)) {
            start = i;
        }
        else if (start != -1 && !IsDigit(c)) {
            end = i;
            break;
        }
    }

    try {
        value = std::stoi(message.substr(start, end).c_str());
    }
    catch (std::invalid_argument) {
        return 0;
    }
    catch (std::out_of_range) {
        return 0;
    }

    if (value > 500) {
        value = 500;
    }

    return value;
}

Please help.

Thanks.

CoolBuys1290
 
Solution
You lack a lib, install all required libs with the following command;
-
Code:
sudo apt-get install libboost-filesystem-dev
sudo apt-get install git cmake build-essential liblua5.2-dev libgmp3-dev libmysqlclient-dev libboost-system-dev libboost-iostreams-dev libpugixml-dev

ayusutina

Banned User
Joined
May 10, 2013
Messages
124
Solutions
3
Reaction score
100
Just remove werror from your CMakeLists.txt (the one at the main folder) as nostalrius is outdated and it has a lot of wrong code
 
OP
OP
CoolBuys1290

CoolBuys1290

Member
Joined
Aug 23, 2018
Messages
80
Reaction score
8
I still get errors even after deleting -Werror from the CMakeLists.txt file.

sudo nano CMakeLists.txt
sudo dpkg -L libluajit-5.1-dev
/usr/include/luajit-2.1/
/usr/lib/x86_64-linux-gnu/
otpch.h
you have to delete the line of weapons.cpp in cmake list in src as CMakeLists.txt.
sudo apt-get install -y liblua5.2-dev

/usr/include/lua5.2

sudo apt install liblua5.2-dev
sudo apt install libluajit-5.1-dev

{standard input}: Assembler messages:
{standard input}:24024: Warning: end of file not at end of a line; newline inserted
{standard input}:24475: Error: no such instruction: `mo'
{standard input}: Error: open CFI at the end of file; missing .cfi_endproc directive
c++: fatal error: Killed signal terminated program cc1plus
compilation terminated.
make[2]: *** [CMakeFiles/tfs.dir/build.make:166: CMakeFiles/tfs.dir/src/behaviourdatabase.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:179: CMakeFiles/tfs.dir/all] Error 2
make: *** [Makefile:103: all] Error 2

/usr/bin/ld: CMakeFiles/tfs.dir/src/combat.cpp.o: in function `ValueCallback::getMinMaxValues(Player*, CombatDamage&, bool) const':
combat.cpp:(.text+0x51d1): undefined reference to `lua_pcallk'
/usr/bin/ld: CMakeFiles/tfs.dir/src/combat.cpp.o: in function `TargetCallback::eek:nTargetCombat(Creature*, Creature*) const':
combat.cpp:(.text+0x560d): undefined reference to `lua_pcallk'
/usr/bin/ld: CMakeFiles/tfs.dir/src/configmanager.cpp.o: in function `ConfigManager::load()':
configmanager.cpp:(.text+0xd2): undefined reference to `lua_pcallk'
/usr/bin/ld: CMakeFiles/tfs.dir/src/configmanager.cpp.o: in function `ConfigManager::getGlobalString[abi:cxx11](lua_State*, char const*, char const*)':
configmanager.cpp:(.text+0xf09): undefined reference to `lua_getglobal'
/usr/bin/ld: configmanager.cpp:(.text+0xf68): undefined reference to `lua_rawlen'
/usr/bin/ld: CMakeFiles/tfs.dir/src/configmanager.cpp.o: in function `ConfigManager::getGlobalNumber(lua_State*, char const*, int)':
configmanager.cpp:(.text+0x1086): undefined reference to `lua_getglobal'
/usr/bin/ld: CMakeFiles/tfs.dir/src/configmanager.cpp.o: in function `ConfigManager::getGlobalBoolean(lua_State*, char const*, bool)':
configmanager.cpp:(.text+0x1114): undefined reference to `lua_getglobal'
/usr/bin/ld: configmanager.cpp:(.text+0x1167): undefined reference to `lua_rawlen'
/usr/bin/ld: CMakeFiles/tfs.dir/src/luascript.cpp.o: in function `LuaScriptInterface::protectedCall(lua_State*, int, int)':
luascript.cpp:(.text+0x11a2): undefined reference to `lua_pcallk'
/usr/bin/ld: CMakeFiles/tfs.dir/src/luascript.cpp.o: in function `LuaScriptInterface::getEvent(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
luascript.cpp:(.text+0x1425): undefined reference to `lua_getglobal'
/usr/bin/ld: luascript.cpp:(.text+0x14d8): undefined reference to `lua_setglobal'
/usr/bin/ld: CMakeFiles/tfs.dir/src/luascript.cpp.o: in function `LuaScriptInterface::getMetaEvent(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
luascript.cpp:(.text+0x1673): undefined reference to `lua_getglobal'
/usr/bin/ld: CMakeFiles/tfs.dir/src/luascript.cpp.o: in function `LuaScriptInterface::getStackTrace(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
luascript.cpp:(.text+0x1ab6): undefined reference to `lua_getglobal'
/usr/bin/ld: luascript.cpp:(.text+0x1bb2): undefined reference to `lua_callk'
/usr/bin/ld: CMakeFiles/tfs.dir/src/luascript.cpp.o: in function `LuaScriptInterface::registerFunctions()':
luascript.cpp:(.text+0x4743): undefined reference to `lua_setglobal'
/usr/bin/ld: luascript.cpp:(.text+0x477c): undefined reference to `lua_setglobal'
/usr/bin/ld: luascript.cpp:(.text+0x47b5): undefined reference to `lua_setglobal'
/usr/bin/ld: luascript.cpp:(.text+0x47ee): undefined reference to `lua_setglobal'
/usr/bin/ld: luascript.cpp:(.text+0x4827): undefined reference to `lua_setglobal'
/usr/bin/ld: CMakeFiles/tfs.dir/src/luascript.cpp.o:luascript.cpp:(.text+0x4860): more undefined references to `lua_setglobal' follow
/usr/bin/ld: CMakeFiles/tfs.dir/src/luascript.cpp.o: in function `LuaScriptInterface::registerClass(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int ()(lua_State))':
luascript.cpp:(.text+0x45ded): undefined reference to `lua_getglobal'
/usr/bin/ld: CMakeFiles/tfs.dir/src/luascript.cpp.o: in function `LuaScriptInterface::registerTable(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
luascript.cpp:(.text+0x46202): undefined reference to `lua_setglobal'
/usr/bin/ld: CMakeFiles/tfs.dir/src/luascript.cpp.o: in function `LuaScriptInterface::registerMethod(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int ()(lua_State))':
luascript.cpp:(.text+0x46244): undefined reference to `lua_getglobal'
/usr/bin/ld: CMakeFiles/tfs.dir/src/luascript.cpp.o: in function `LuaScriptInterface::registerGlobalMethod(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int ()(lua_State))':
luascript.cpp:(.text+0x4638a): undefined reference to `lua_setglobal'
/usr/bin/ld: CMakeFiles/tfs.dir/src/luascript.cpp.o: in function `LuaScriptInterface::registerVariable(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, double)':
luascript.cpp:(.text+0x463cd): undefined reference to `lua_getglobal'
/usr/bin/ld: CMakeFiles/tfs.dir/src/luascript.cpp.o: in function `LuaScriptInterface::registerGlobalVariable(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, double)':
luascript.cpp:(.text+0x46464): undefined reference to `lua_setglobal'
/usr/bin/ld: CMakeFiles/tfs.dir/src/luascript.cpp.o: in function `LuaScriptInterface::registerGlobalBoolean(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool)':
luascript.cpp:(.text+0x464b9): undefined reference to `lua_setglobal'
/usr/bin/ld: CMakeFiles/tfs.dir/src/luascript.cpp.o: in function `LuaScriptInterface::luaIsInArray(lua_State*)':
luascript.cpp:(.text+0x4a74e): undefined reference to `lua_compare'
/usr/bin/ld: CMakeFiles/tfs.dir/src/luascript.cpp.o: in function `LuaScriptInterface::luaAddEvent(lua_State*)':
luascript.cpp:(.text+0x4aeeb): undefined reference to `lua_getglobal'
/usr/bin/ld: luascript.cpp:(.text+0x4af1e): undefined reference to `lua_getglobal'
/usr/bin/ld: luascript.cpp:(.text+0x4af8e): undefined reference to `lua_callk'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/tfs.dir/build.make:1179: tfs] Error 1
make[1]: *** [CMakeFiles/Makefile2:179: CMakeFiles/tfs.dir/all] Error 2
make: *** [Makefile:103: all] Error 2
 
Last edited:

ayusutina

Banned User
Joined
May 10, 2013
Messages
124
Solutions
3
Reaction score
100
You lack a lib, install all required libs with the following command;
-
Code:
sudo apt-get install libboost-filesystem-dev
sudo apt-get install git cmake build-essential liblua5.2-dev libgmp3-dev libmysqlclient-dev libboost-system-dev libboost-iostreams-dev libpugixml-dev
 
Solution
OP
OP
CoolBuys1290

CoolBuys1290

Member
Joined
Aug 23, 2018
Messages
80
Reaction score
8
Still getting errors:

Bash:
 88%] Linking CXX executable tfs
/usr/bin/ld: CMakeFiles/tfs.dir/src/combat.cpp.o: in function `ValueCallback::getMinMaxValues(Player*, CombatDamage&, bool) const':
combat.cpp:(.text+0x51d1): undefined reference to `lua_pcallk'
/usr/bin/ld: CMakeFiles/tfs.dir/src/combat.cpp.o: in function `TargetCallback::onTargetCombat(Creature*, Creature*) const':
combat.cpp:(.text+0x560d): undefined reference to `lua_pcallk'
/usr/bin/ld: CMakeFiles/tfs.dir/src/configmanager.cpp.o: in function `ConfigManager::load()':
configmanager.cpp:(.text+0xd2): undefined reference to `lua_pcallk'
/usr/bin/ld: CMakeFiles/tfs.dir/src/configmanager.cpp.o: in function `ConfigManager::getGlobalString[abi:cxx11](lua_State*, char const*, char const*)':
configmanager.cpp:(.text+0xf09): undefined reference to `lua_getglobal'
/usr/bin/ld: configmanager.cpp:(.text+0xf68): undefined reference to `lua_rawlen'
/usr/bin/ld: CMakeFiles/tfs.dir/src/configmanager.cpp.o: in function `ConfigManager::getGlobalNumber(lua_State*, char const*, int)':
configmanager.cpp:(.text+0x1086): undefined reference to `lua_getglobal'
/usr/bin/ld: CMakeFiles/tfs.dir/src/configmanager.cpp.o: in function `ConfigManager::getGlobalBoolean(lua_State*, char const*, bool)':
configmanager.cpp:(.text+0x1114): undefined reference to `lua_getglobal'
/usr/bin/ld: configmanager.cpp:(.text+0x1167): undefined reference to `lua_rawlen'
/usr/bin/ld: CMakeFiles/tfs.dir/src/luascript.cpp.o: in function `LuaScriptInterface::protectedCall(lua_State*, int, int)':
luascript.cpp:(.text+0x11a2): undefined reference to `lua_pcallk'
/usr/bin/ld: CMakeFiles/tfs.dir/src/luascript.cpp.o: in function `LuaScriptInterface::getEvent(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
luascript.cpp:(.text+0x1425): undefined reference to `lua_getglobal'
/usr/bin/ld: luascript.cpp:(.text+0x14d8): undefined reference to `lua_setglobal'
/usr/bin/ld: CMakeFiles/tfs.dir/src/luascript.cpp.o: in function `LuaScriptInterface::getMetaEvent(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
luascript.cpp:(.text+0x1673): undefined reference to `lua_getglobal'
/usr/bin/ld: CMakeFiles/tfs.dir/src/luascript.cpp.o: in function `LuaScriptInterface::getStackTrace(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
luascript.cpp:(.text+0x1ab6): undefined reference to `lua_getglobal'
/usr/bin/ld: luascript.cpp:(.text+0x1bb2): undefined reference to `lua_callk'
/usr/bin/ld: CMakeFiles/tfs.dir/src/luascript.cpp.o: in function `LuaScriptInterface::registerFunctions()':
luascript.cpp:(.text+0x4743): undefined reference to `lua_setglobal'
/usr/bin/ld: luascript.cpp:(.text+0x477c): undefined reference to `lua_setglobal'
/usr/bin/ld: luascript.cpp:(.text+0x47b5): undefined reference to `lua_setglobal'
/usr/bin/ld: luascript.cpp:(.text+0x47ee): undefined reference to `lua_setglobal'
/usr/bin/ld: luascript.cpp:(.text+0x4827): undefined reference to `lua_setglobal'
/usr/bin/ld: CMakeFiles/tfs.dir/src/luascript.cpp.o:luascript.cpp:(.text+0x4860): more undefined references to `lua_setglobal' follow
/usr/bin/ld: CMakeFiles/tfs.dir/src/luascript.cpp.o: in function `LuaScriptInterface::registerClass(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int (*)(lua_State*))':
luascript.cpp:(.text+0x45ded): undefined reference to `lua_getglobal'
/usr/bin/ld: CMakeFiles/tfs.dir/src/luascript.cpp.o: in function `LuaScriptInterface::registerTable(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
luascript.cpp:(.text+0x46202): undefined reference to `lua_setglobal'
/usr/bin/ld: CMakeFiles/tfs.dir/src/luascript.cpp.o: in function `LuaScriptInterface::registerMethod(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int (*)(lua_State*))':
luascript.cpp:(.text+0x46244): undefined reference to `lua_getglobal'
/usr/bin/ld: CMakeFiles/tfs.dir/src/luascript.cpp.o: in function `LuaScriptInterface::registerGlobalMethod(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int (*)(lua_State*))':
luascript.cpp:(.text+0x4638a): undefined reference to `lua_setglobal'
/usr/bin/ld: CMakeFiles/tfs.dir/src/luascript.cpp.o: in function `LuaScriptInterface::registerVariable(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, double)':
luascript.cpp:(.text+0x463cd): undefined reference to `lua_getglobal'
/usr/bin/ld: CMakeFiles/tfs.dir/src/luascript.cpp.o: in function `LuaScriptInterface::registerGlobalVariable(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, double)':
luascript.cpp:(.text+0x46464): undefined reference to `lua_setglobal'
/usr/bin/ld: CMakeFiles/tfs.dir/src/luascript.cpp.o: in function `LuaScriptInterface::registerGlobalBoolean(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool)':
luascript.cpp:(.text+0x464b9): undefined reference to `lua_setglobal'
/usr/bin/ld: CMakeFiles/tfs.dir/src/luascript.cpp.o: in function `LuaScriptInterface::luaIsInArray(lua_State*)':
luascript.cpp:(.text+0x4a74e): undefined reference to `lua_compare'
/usr/bin/ld: CMakeFiles/tfs.dir/src/luascript.cpp.o: in function `LuaScriptInterface::luaAddEvent(lua_State*)':
luascript.cpp:(.text+0x4aeeb): undefined reference to `lua_getglobal'
/usr/bin/ld: luascript.cpp:(.text+0x4af1e): undefined reference to `lua_getglobal'
/usr/bin/ld: luascript.cpp:(.text+0x4af8e): undefined reference to `lua_callk'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/tfs.dir/build.make:1179: tfs] Error 1
make[1]: *** [CMakeFiles/Makefile2:179: CMakeFiles/tfs.dir/all] Error 2
make: *** [Makefile:103: all] Error 2

Please help.

Thanks.

CoolBuys1290
Post automatically merged:

U said u used the CMakeLists.txt file somehow to update the libraries. Please do tell me what u did so I can compile on my own.
 
Last edited:
Top