• 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 Compiling TFS 0.4 rev 3777 on Raspbian

elnelson

Lunaria World Dev
Joined
Jun 20, 2009
Messages
580
Solutions
2
Reaction score
58
Location
México
Hello otlanders, i recently got a raspberry pi B+ (it has 4gb ram) and i want it to host my project but im encountering problems trying to compile this Fir3element/3777 (https://github.com/Fir3element/3777) (and other revs too)

The errors i get are these:

configure: error: 'boost:: asio header not found. "
i fixed this with: Compiling - configure: error: 'boost:: asio header not found. (https://otland.net/threads/configure-error-boost-asio-header-not-found.74308/)

but i encounter a new error that says:
boost::unordered_set header not found
and its driving me crazy, can some kind soul help me please?

Edit1: i found this post (Linux - Outdated Library's help (https://otland.net/threads/outdated-librarys-help.267847/#post-2610065)) about old libraries and i deleted the 'tr1' partof the configure.ac and house.h files and i could advance to the ./build.sh part, however i still getting errors when the compiler runs. i attached the images of the terminal (im using a virtual machine with ubuntu 20.04 atm, but i get the same error with raspbian)
 

Attachments

Last edited:
Solution
congrats, you are at the end bro.

you just need to add -l pthread as the last item of the make line.

you can do this by adding it somewhere in your Makefile.am or your configure.ac.

For example, putting this right before the boost checks in your configure.ac
Bash:
# check for pthread
AC_CHECK_HEADERS([pthread.h], ,[AC_MSG_ERROR("pthread header not found.")])
AC_CHECK_LIB(pthread, main, ,[AC_MSG_ERROR("Linking against pthread library failed)])

Or you could omit the check since the library is pretty universal now, and just do this:
Diff:
 # check for xml2
 AM_PATH_XML2(2.6.5, , AC_MSG_ERROR([You need libxml2 >= 2.6.5 to compile theforgottenserver!]))
-LIBS="$LIBS $XML_LIBS"
+LIBS="$LIBS $XML_LIBS -lpthread"


Or you could...
Hhmm, that's a new one on me.
707876270108573747.png

Maybe try replacing your copies of databasemysql.cpp and matching .h with the ones from this fork:
GoalTV/ModernOts (https://github.com/GoalTV/ModernOts/tree/a1dcc769e05038a934b340d675f2ed01bf9a38f8/source)

If that doesn't work then I'll actually have to examine the code.
 

Attachments

Make sure that u have installed all libs
apt-get install subversion autoconf build-essential pkg-config libboost-dev libgmp3-dev libxml2-dev liblua5.1-0-dev libmysqlclient-dev ccache libboost-filesystem-dev libboost-regex-dev libboost-system-dev libboost-thread-dev screen libssl-dev libcrypto++-dev

then
chmod +x autogen.sh ./autogen.sh ./configure --enable-mysql --enable-root-permission chmod +x build.sh ./build.sh
 
wut.
none of that has anything to do with his problem. his errors are clearly way farther than configure, which is where he would have been stopped if he lacked libs.

And why would you ever enable root permission on a service where a Lua exec function is commonly added? There is at least 15 suitable ways to write a wrap to bind privileged resources, then drop privs before TFS is invoked.
 
Last edited:
Well here's the fix
Diff:
-        std::string s = it->leaf();
+        std::string s = it->path().filename().string();

But you clearly aren't using the source you said you were.

my bad, i was testing fir3element's source but, i had a critical bugwith getcontentdescription and i was forced to move to this sources


i guess i've done what you said

BTW this is the source code atm idk if im doing right


I've done what u said, changed line 741 from luascript.cpp and i got this
 

Attachments

C++:
std::string s = BOOST_DIR_ITER_FILENAME(it);

Try this. And then if you get an error about that, add it:

otsystem.h
C++:
#if BOOST_VERSION < 104400
#define BOOST_DIR_ITER_FILENAME(iterator) (iterator)->path().filename()
#else
#define BOOST_DIR_ITER_FILENAME(iterator) (iterator)->path().filename().string()
#endif
 
C++:
std::string s = BOOST_DIR_ITER_FILENAME(it);

Try this. And then if you get an error about that, add it:

otsystem.h
C++:
#if BOOST_VERSION < 104400
#define BOOST_DIR_ITER_FILENAME(iterator) (iterator)->path().filename()
#else
#define BOOST_DIR_ITER_FILENAME(iterator) (iterator)->path().filename().string()
#endif

got the error, then i put the second part and i got this
 

Attachments

Hello there, sorry, I'm quite busy with a serious matter in another project.

Here is that first chunk from mine

C++:
bool ScriptManager::loadMods()
{
    boost::filesystem::path modsPath(getFilePath(FILE_TYPE_MOD));
    if(!boost::filesystem::exists(modsPath))
    {
        std::clog << "[Error - ScriptManager::loadMods] Could not locate mods directory" << std::endl;
        return false;
    }

    int32_t i = 0, j = 0;
    bool enabled = false;
    for(boost::filesystem::directory_iterator it(modsPath), end; it != end; ++it)
    {
        std::string s = BOOST_DIR_ITER_FILENAME(it);
        if(boost::filesystem::is_directory(it->status()) && (s.size() > 4 ? s.substr(s.size() - 4) : "") != ".xml")
            continue;
 
Hello there, sorry, I'm quite busy with a serious matter in another project.

Here is that first chunk from mine

C++:
bool ScriptManager::loadMods()
{
    boost::filesystem::path modsPath(getFilePath(FILE_TYPE_MOD));
    if(!boost::filesystem::exists(modsPath))
    {
        std::clog << "[Error - ScriptManager::loadMods] Could not locate mods directory" << std::endl;
        return false;
    }

    int32_t i = 0, j = 0;
    bool enabled = false;
    for(boost::filesystem::directory_iterator it(modsPath), end; it != end; ++it)
    {
        std::string s = BOOST_DIR_ITER_FILENAME(it);
        if(boost::filesystem::is_directory(it->status()) && (s.size() > 4 ? s.substr(s.size() - 4) : "") != ".xml")
            continue;

no problem dude, i hope this compiles some day u.u thanks for your help tho
 

Attachments

Again, my chunk for that.
C++:
bool TalkActions::onPlayerSay(Creature* creature, uint16_t channelId, const std::string& words, bool ignoreAccess)
{
    std::string cmd[4], param[4];
    cmd[TALKFILTER_LAST] = words, param[TALKFILTER_LAST] = "";
    for(int32_t i = 0; i < TALKFILTER_LAST; ++i)
        cmd[i] = words;

    std::string::size_type loc = words.find('"', 0);
 
Again, my chunk for that.
C++:
bool TalkActions::onPlayerSay(Creature* creature, uint16_t channelId, const std::string& words, bool ignoreAccess)
{
    std::string cmd[4], param[4];
    cmd[TALKFILTER_LAST] = words, param[TALKFILTER_LAST] = "";
    for(int32_t i = 0; i < TALKFILTER_LAST; ++i)
        cmd[i] = words;

    std::string::size_type loc = words.find('"', 0);
 

Attachments

congrats, you are at the end bro.

you just need to add -l pthread as the last item of the make line.

you can do this by adding it somewhere in your Makefile.am or your configure.ac.

For example, putting this right before the boost checks in your configure.ac
Bash:
# check for pthread
AC_CHECK_HEADERS([pthread.h], ,[AC_MSG_ERROR("pthread header not found.")])
AC_CHECK_LIB(pthread, main, ,[AC_MSG_ERROR("Linking against pthread library failed)])

Or you could omit the check since the library is pretty universal now, and just do this:
Diff:
 # check for xml2
 AM_PATH_XML2(2.6.5, , AC_MSG_ERROR([You need libxml2 >= 2.6.5 to compile theforgottenserver!]))
-LIBS="$LIBS $XML_LIBS"
+LIBS="$LIBS $XML_LIBS -lpthread"


Or you could alter your Makefile.am like this
Diff:
-$(OPTIONAL_FLAGS) -D_THREAD_SAFE -D_REENTRANT -Wno-strict-aliasing
+$(OPTIONAL_FLAGS) -lpthread -D_THREAD_SAFE -D_REENTRANT -Wno-strict-aliasing

Just do one of them.

Then you need to autoreconf, run ./configure again and make again.
 
Solution
congrats, you are at the end bro.

you just need to add -l pthread as the last item of the make line.

you can do this by adding it somewhere in your Makefile.am or your configure.ac.

For example, putting this right before the boost checks in your configure.ac
Bash:
# check for pthread
AC_CHECK_HEADERS([pthread.h], ,[AC_MSG_ERROR("pthread header not found.")])
AC_CHECK_LIB(pthread, main, ,[AC_MSG_ERROR("Linking against pthread library failed)])

Or you could omit the check since the library is pretty universal now, and just do this:
Diff:
 # check for xml2
AM_PATH_XML2(2.6.5, , AC_MSG_ERROR([You need libxml2 >= 2.6.5 to compile theforgottenserver!]))
-LIBS="$LIBS $XML_LIBS"
+LIBS="$LIBS $XML_LIBS -lpthread"


Or you could alter your Makefile.am like this
Diff:
-$(OPTIONAL_FLAGS) -D_THREAD_SAFE -D_REENTRANT -Wno-strict-aliasing
+$(OPTIONAL_FLAGS) -lpthread -D_THREAD_SAFE -D_REENTRANT -Wno-strict-aliasing

Just do one of them.

Then you need to autoreconf, run ./configure again and make again.
thank you very much now dude =) i will upload the fixed sources for tfs 0.4 users (credits to you ofc)
 
congrats, you are at the end bro.

you just need to add -l pthread as the last item of the make line.

you can do this by adding it somewhere in your Makefile.am or your configure.ac.

For example, putting this right before the boost checks in your configure.ac
Bash:
# check for pthread
AC_CHECK_HEADERS([pthread.h], ,[AC_MSG_ERROR("pthread header not found.")])
AC_CHECK_LIB(pthread, main, ,[AC_MSG_ERROR("Linking against pthread library failed)])

Or you could omit the check since the library is pretty universal now, and just do this:
Diff:
 # check for xml2
AM_PATH_XML2(2.6.5, , AC_MSG_ERROR([You need libxml2 >= 2.6.5 to compile theforgottenserver!]))
-LIBS="$LIBS $XML_LIBS"
+LIBS="$LIBS $XML_LIBS -lpthread"


Or you could alter your Makefile.am like this
Diff:
-$(OPTIONAL_FLAGS) -D_THREAD_SAFE -D_REENTRANT -Wno-strict-aliasing
+$(OPTIONAL_FLAGS) -lpthread -D_THREAD_SAFE -D_REENTRANT -Wno-strict-aliasing

Just do one of them.

Then you need to autoreconf, run ./configure again and make again.
Rememebr when i told i finished? well i fear thats not a fact. when i trepass the edited source, and installed the exact same libs on mi rapsberry i got this error when ./build.sh is executed



Lua:
root@raspberrypi:/home/pi/lunaria/sources# ./build.sh
/usr/include/c++/8/bits/stl_map.h:499:8: note: parameter passing for argument of type ‘std::_Rb_tree<unsigned int, std::pair<const unsigned int, spawnBlock_t>, std::_Select1st<std::pair<const unsigned int, spawnBlock_t> >, std::less<unsigned int>, std::allocator<std::pair<const unsigned int, spawnBlock_t> > >::const_iterator’ {aka ‘std::_Rb_tree_const_iterator<std::pair<const unsigned int, spawnBlock_t> >’} changed in GCC 7.1
    __i = _M_t._M_emplace_hint_unique(__i, std::piecewise_construct,
  CXX      textlogger.o
  CXX      thing.o
  CXX      tile.o
  CXX      tools.o
  CXX      trashholder.o
  CXX      waitlist.o
  CXX      weapons.o
  CXX      vocation.o
  CXXLD    theforgottenserver
allocator.o: file not recognized: file format not recognized
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:503: theforgottenserver] Error 1
make[1]: se sale del directorio '/home/pi/lunaria/sources'
make: *** [Makefile:445: all] Error 2
root@raspberrypi:/home/pi/lunaria/sources#

Like, why is so complicate to compile? ubuntu and raspbian are based both on debian, shouldnt it work the same steps to compile :S?
 
Last edited:
You're entering a whole nother world when it comes to making things work on a pi. Like "Make a new thread for that part" levels of different. And rename this one "Compiling r3777 on modern systems" -- that way it will be a nice division of facets to your originally complex problem

;) Gotta maintain the right size chunks of "issue" if I'm ever gonna catch up on my internet points game.
 
Last edited:
Back
Top