opentibia / server

An open source server for the MMORPG Tibia.
GNU General Public License v2.0
414 stars 149 forks source link

Does not build on Linux #38

Closed grepwood closed 9 years ago

grepwood commented 9 years ago

This happens when all the .o are compiled and you're about to link the main executable. /usr/lib/gcc/x86_64-pc-linux-gnu/4.9.2/../../../../x86_64-pc-linux-gnu/bin/ld: CMakeFiles/otserv.dir/connection.cpp.o: undefined reference to symbol 'pthread_mutexattr_settype@@GLIBC_2.2.5' /lib64/libpthread.so.0: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status

grepwood commented 9 years ago

On Fedora 21, this is happening halfway through the compilation In file included from /home/life/grepwood/git/server/src/script_manager.h:25:0, from /home/life/grepwood/git/server/src/script_listener.cpp:21: /home/life/grepwood/git/server/src/lua_manager.h: In member function ‘void LuaState::setGlobal(const string&)’: /home/life/grepwood/git/server/src/lua_manager.h:109:53: error: ‘LUA_GLOBALSINDEX’ was not declared in this scope void setGlobal(const std::string& gname) {setField(LUA_GLOBALSINDEX, gname);} ^ /home/life/grepwood/git/server/src/lua_manager.h: In member function ‘void LuaState::getGlobal(const string&)’: /home/life/grepwood/git/server/src/lua_manager.h:113:53: error: ‘LUA_GLOBALSINDEX’ was not declared in this scope void getGlobal(const std::string& gname) {getField(LUA_GLOBALSINDEX, gname);} ^ src/CMakeFiles/otserv.dir/build.make:560: recipe for target 'src/CMakeFiles/otserv.dir/script_listener.cpp.o' failed

ivucica commented 9 years ago

While I'm not actively developing anything OT related, your report would be far more useful to the developers if you had answered the following:

Which git commit? Which exact distribution and distribution version in first, and which in the second issue? Which glibc (for first issue) and which lua (for second issue)?

Also, given that these are two distinct issues -- on two different systems, even -- would it not be prudent to treat them as such?

On Mon, Feb 16, 2015, 13:40 Michael Dec notifications@github.com wrote:

On Fedora 21, this is happening halfway through the compilation In file included from /home/life/grepwood/git/server/src/script_manager.h:25:0, from /home/life/grepwood/git/server/src/script_listener.cpp:21: /home/life/grepwood/git/server/src/lua_manager.h: In member function ‘void LuaState::setGlobal(const string&)’: /home/life/grepwood/git/server/src/lua_manager.h:109:53: error: ‘LUA_GLOBALSINDEX’ was not declared in this scope void setGlobal(const std::string& gname) {setField(LUA_GLOBALSINDEX, gname);} ^ /home/life/grepwood/git/server/src/lua_manager.h: In member function ‘void LuaState::getGlobal(const string&)’: /home/life/grepwood/git/server/src/lua_manager.h:113:53: error: ‘LUA_GLOBALSINDEX’ was not declared in this scope void getGlobal(const std::string& gname) {getField(LUA_GLOBALSINDEX, gname);} ^ src/CMakeFiles/otserv.dir/build.make:560: recipe for target 'src/CMakeFiles/otserv.dir/script_listener.cpp.o' failed

— Reply to this email directly or view it on GitHub https://github.com/opentibia/server/issues/38#issuecomment-74509404.

grepwood commented 9 years ago

The git commit is fafeb36af21bceaebb30df8068bbfa078fc0a592 For the first issue, I used Gentoo with glibc 2.19 and Lua 5.1.5. For the second issue, I used Fedora 21 with glibc 2.20 and Lua 5.2.2

iryont commented 9 years ago

2nd issue - Lua 5.2 is not supported and cannot be used to compile the server. 1st issue - it works here, and it does work on travis: https://travis-ci.org/opentibia/server/

In any case I would try to add following piece of code at the end of src/CMakeLists.txt:

if(UNIX)
  TARGET_LINK_LIBRARIES(${PROJECT_NAME} pthread)
endif()
iryont commented 9 years ago

I have updated CMake files with several changes. You should give it a try.

grepwood commented 9 years ago

Compiles alright on Gentoo (1st issue)! Thank you @iryont