• 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...
otsystem.h
Diff:
-inline int64_t OTSYS_TIME()
-{
-   timeb t;
-   ftime(&t);
-   return ((int64_t)t.millitm) + ((int64_t)t.time) * 1000;
-}
+inline int64_t OTSYS_TIME()
+{
+   return std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count();
+}


Find -Werror=xxx instances in your configure.ac and Makefile.in and kill them.
The do:
autoreconf -vfi
and configure again
 
otsystem.h
Diff:
-inline int64_t OTSYS_TIME()
-{
-   timeb t;
-   ftime(&t);
-   return ((int64_t)t.millitm) + ((int64_t)t.time) * 1000;
-}
+inline int64_t OTSYS_TIME()
+{
+   return std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count();
+}


Find -Werror=xxx instances in your configure.ac and Makefile.in and kill them.
The do:
autoreconf -vfi
and configure again

i didnt understart the "Find -Werror=xxx instances in your configure.ac and Makefile.in and kill them." part...(i was looking for that Werror and i didnt found any)
i've done the other modifications and i get this error message when i've done all again
 

Attachments

Last edited:
You still have Werror somewhere. You have to find it in the template and kill it. Then autoreconf. I suggest learning how grep works. Google it.

The function in chat.cpp can't cast to boolean, so returning false fails. Return NULL instead.
 
By finding it in the 'template' you mena I have to look werror in all files and delete it..?
You still have Werror somewhere. You have to find it in the template and kill it. Then autoreconf. I suggest learning how grep works. Google it.

The function in chat.cpp can't cast to boolean, so returning false fails. Return NULL instead.
By finding it in the template you mean I have to find 'werror' in all files and delete them..?
 
By finding it in the 'template' you mena I have to look werror in all files and delete it..?
By finding it in the template you mean I have to find 'werror' in all files and delete them..?

The Autotools templates should be configure.ac and Makefile.in.

If you're using nano, the search hotkey is CTRL W
 
The Autotools templates should be configure.ac and Makefile.in.

If you're using nano, the search hotkey is CTRL W
i just found this werror in makefile.in what should i do with it? can you explain clearly what do i have to do? like you explain to a 5 years old? seriously i just want to host my project tho...
 

Attachments

Yep.

You'll probably get a new error. But it will be different this time.

We only have about 7 more to go.
 
returning false fails.
Return NULL instead.


Why don't you look at the code from where the error is coming from and see if what I said makes more sense when its smacking you in the face.

You could also look at the code online if looking at the code on your own computer is too alien.
 
returning false fails.
Return NULL instead.


Why don't you look at the code from where the error is coming from and see if what I said makes more sense when its smacking you in the face.

You could also look at the code online if looking at the code on your own computer is too alien.
i get it now, changed it, reconfigured and showed this after ./build
 

Attachments

Diff:
diff --git a/src/connection.cpp b/src/connection.cpp
index edd66a6..e41997b 100644
--- a/src/connection.cpp
+++ b/src/connection.cpp
@@ -320,7 +320,7 @@ void Connection::accept()
        try
        {
                ++m_pendingRead;
-               m_readTimer.expires_from_now(boost::posix_time::seconds(Connection::readTimeout));
+               m_readTimer.expires_from_now(boost::posix_time::seconds(CONNECTION_READ_TIMEOUT));
                m_readTimer.async_wait(boost::bind(&Connection::handleReadTimeout,
                        boost::weak_ptr<Connection>(shared_from_this()), boost::asio::placeholders::error));
 
@@ -360,7 +360,7 @@ void Connection::parseHeader(const boost::system::error_code& error)
        try
        {
                ++m_pendingRead;
-               m_readTimer.expires_from_now(boost::posix_time::seconds(Connection::readTimeout));
+               m_readTimer.expires_from_now(boost::posix_time::seconds(CONNECTION_READ_TIMEOUT));
                m_readTimer.async_wait(boost::bind(&Connection::handleReadTimeout,
                        boost::weak_ptr<Connection>(shared_from_this()), boost::asio::placeholders::error));
 
@@ -436,7 +436,7 @@ void Connection::parsePacket(const boost::system::error_code& error)
        try
        {
                ++m_pendingRead;
-               m_readTimer.expires_from_now(boost::posix_time::seconds(Connection::readTimeout));
+               m_readTimer.expires_from_now(boost::posix_time::seconds(CONNECTION_READ_TIMEOUT));
                m_readTimer.async_wait(boost::bind(&Connection::handleReadTimeout,
                        boost::weak_ptr<Connection>(shared_from_this()), boost::asio::placeholders::error));
 
@@ -504,7 +504,7 @@ void Connection::internalSend(OutputMessage_ptr msg)
        try
        {
                ++m_pendingWrite;
-               m_writeTimer.expires_from_now(boost::posix_time::seconds(Connection::writeTimeout));
+               m_writeTimer.expires_from_now(boost::posix_time::seconds(CONNECTION_WRITE_TIMEOUT));
                m_writeTimer.async_wait(boost::bind(&Connection::handleWriteTimeout,
                        boost::weak_ptr<Connection>(shared_from_this()), boost::asio::placeholders::error));

Diff:
diff --git a/src/connection.h b/src/connection.h
index c06c433..61c9726 100644
--- a/src/connection.h
+++ b/src/connection.h
@@ -53,6 +53,9 @@ struct ConnectBlock
        uint64_t startTime, blockTime;
 };
 
+static constexpr int32_t CONNECTION_WRITE_TIMEOUT = 30;
+static constexpr int32_t CONNECTION_READ_TIMEOUT = 30;
+
 class Protocol;
 class ConnectionManager
 {
@@ -90,9 +93,6 @@ class ConnectionManager
 class Connection : public boost::enable_shared_from_this<Connection>, boost::noncopyable
 {
        public:
-               enum {writeTimeout = 30};
-               enum {readTimeout = 30};
-
                enum ConnectionState_t
                {
                        CONNECTION_STATE_OPEN = 0,
 
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.
 
Back
Top