Unity Master Server - Ubuntu build problem

HI!

have any of you encountered an error during building master server on ubuntu linux? I installed newest g++. Building process throws an error after a while. Here is whole output from terminal:

g++ -c -Wall -I. -ICommon -DUNITY_MASTERSERVER Common/Log.cpp -o Common/Log.o
g++ -c -Wall -I. -ICommon -DUNITY_MASTERSERVER Common/Utility.cpp -o Common/Utility.o
g++ -c -Wall -I. -ICommon -DUNITY_MASTERSERVER RakNet/Sources/RakNetworkFactory.cpp -o RakNet/Sources/RakNetworkFactory.o
g++ -c -Wall -I. -ICommon -DUNITY_MASTERSERVER RakNet/Sources/BitStream.cpp -o RakNet/Sources/BitStream.o
RakNet/Sources/BitStream.cpp: In member function ‘void RakNet::BitStream::PrintBits() const’:
RakNet/Sources/BitStream.cpp:785:25: warning: format not a string literal and no format arguments [-Wformat-security]
RakNet/Sources/BitStream.cpp: In member function ‘void RakNet::BitStream::PrintHex() const’:
RakNet/Sources/BitStream.cpp:799:25: warning: format not a string literal and no format arguments [-Wformat-security]
g++ -c -Wall -I. -ICommon -DUNITY_MASTERSERVER RakNet/Sources/GetTime.cpp -o RakNet/Sources/GetTime.o
g++ -c -Wall -I. -ICommon -DUNITY_MASTERSERVER RakNet/Sources/RakPeer.cpp -o RakNet/Sources/RakPeer.o
RakNet/Sources/RakPeer.cpp:160:0: warning: ignoring #pragma warning  [-Wunknown-pragmas]
RakNet/Sources/RakPeer.cpp:162:127: warning: narrowing conversion of ‘255’ from ‘int’ to ‘const char’ inside { } is ill-formed in C++11 [-Wnarrowing]
RakNet/Sources/RakPeer.cpp:162:127: warning: narrowing conversion of ‘255’ from ‘int’ to ‘const char’ inside { } is ill-formed in C++11 [-Wnarrowing]
RakNet/Sources/RakPeer.cpp:162:127: warning: narrowing conversion of ‘254’ from ‘int’ to ‘const char’ inside { } is ill-formed in C++11 [-Wnarrowing]
RakNet/Sources/RakPeer.cpp:162:127: warning: narrowing conversion of ‘254’ from ‘int’ to ‘const char’ inside { } is ill-formed in C++11 [-Wnarrowing]
RakNet/Sources/RakPeer.cpp:162:127: warning: narrowing conversion of ‘254’ from ‘int’ to ‘const char’ inside { } is ill-formed in C++11 [-Wnarrowing]
RakNet/Sources/RakPeer.cpp:162:127: warning: narrowing conversion of ‘254’ from ‘int’ to ‘const char’ inside { } is ill-formed in C++11 [-Wnarrowing]
RakNet/Sources/RakPeer.cpp:162:127: warning: narrowing conversion of ‘253’ from ‘int’ to ‘const char’ inside { } is ill-formed in C++11 [-Wnarrowing]
RakNet/Sources/RakPeer.cpp:162:127: warning: narrowing conversion of ‘253’ from ‘int’ to ‘const char’ inside { } is ill-formed in C++11 [-Wnarrowing]
RakNet/Sources/RakPeer.cpp:162:127: warning: narrowing conversion of ‘253’ from ‘int’ to ‘const char’ inside { } is ill-formed in C++11 [-Wnarrowing]
RakNet/Sources/RakPeer.cpp:162:127: warning: narrowing conversion of ‘253’ from ‘int’ to ‘const char’ inside { } is ill-formed in C++11 [-Wnarrowing]
RakNet/Sources/RakPeer.cpp: In member function ‘virtual bool RakPeer::RPC(const char*, const char*, BitSize_t, PacketPriority, PacketReliability, char, AddressOrGUID, bool, RakNetTime*, NetworkID, RakNet::BitStream*, unsigned char, SystemAddress)’:
RakNet/Sources/RakPeer.cpp:1800:6: warning: suggest explicit braces to avoid ambiguous ‘else’ [-Wparentheses]
RakNet/Sources/RakPeer.cpp: In member function ‘RakPeer::RemoteSystemStruct* RakPeer::AssignSystemAddressToRemoteSystemList(SystemAddress, RakPeer::RemoteSystemStruct::ConnectMode, RakNetSmartPtr<RakNetSocket>, bool*, SystemAddress, int, RakNetGUID, short unsigned int)’:
RakNet/Sources/RakPeer.cpp:4099:12: warning: unused variable ‘errorCode’ [-Wunused-variable]
RakNet/Sources/RakPeer.cpp: In member function ‘virtual char* RakPeer::HandleRPCPacket(const char*, int, SystemAddress)’:
RakNet/Sources/RakPeer.cpp:4437:10: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
RakNet/Sources/RakPeer.cpp:4447:11: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
RakNet/Sources/RakPeer.cpp:4459:11: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
RakNet/Sources/RakPeer.cpp:4467:10: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
RakNet/Sources/RakPeer.cpp:4485:10: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
RakNet/Sources/RakPeer.cpp:4493:10: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
RakNet/Sources/RakPeer.cpp:4503:11: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
RakNet/Sources/RakPeer.cpp:4511:10: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
RakNet/Sources/RakPeer.cpp:4520:10: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
RakNet/Sources/RakPeer.cpp:4530:10: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
RakNet/Sources/RakPeer.cpp:4539:10: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
RakNet/Sources/RakPeer.cpp:4581:51: warning: statement has no effect [-Wunused-value]
RakNet/Sources/RakPeer.cpp:4609:11: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
RakNet/Sources/RakPeer.cpp: In function ‘bool ProcessOfflineNetworkPacket(SystemAddress, const char*, int, RakPeer*, RakNetSmartPtr<RakNetSocket>, bool*, RakNetTimeUS)’:
RakNet/Sources/RakPeer.cpp:5776:102: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
RakNet/Sources/RakPeer.cpp: In member function ‘bool RakPeer::RunUpdateCycle()’:
RakNet/Sources/RakPeer.cpp:6129:56: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
g++ -c -Wall -I. -ICommon -DUNITY_MASTERSERVER RakNet/Sources/BitStream_NoTemplate.cpp -o RakNet/Sources/BitStream_NoTemplate.o
g++ -c -Wall -I. -ICommon -DUNITY_MASTERSERVER RakNet/Sources/RakSleep.cpp -o RakNet/Sources/RakSleep.o
RakNet/Sources/RakSleep.cpp: In function ‘void RakSleep(unsigned int)’:
RakNet/Sources/RakSleep.cpp:29:6: warning: variable ‘rt’ set but not used [-Wunused-but-set-variable]
g++ -c -Wall -I. -ICommon -DUNITY_MASTERSERVER RakNet/Sources/CheckSum.cpp -o RakNet/Sources/CheckSum.o
g++ -c -Wall -I. -ICommon -DUNITY_MASTERSERVER RakNet/Sources/Rand.cpp -o RakNet/Sources/Rand.o
g++ -c -Wall -I. -ICommon -DUNITY_MASTERSERVER RakNet/Sources/ReliabilityLayer.cpp -o RakNet/Sources/ReliabilityLayer.o
RakNet/Sources/ReliabilityLayer.cpp:199:0: warning: ignoring #pragma warning  [-Wunknown-pragmas]
In file included from RakNet/Sources/ReliabilityLayer.cpp:8:0:
RakNet/Sources/ReliabilityLayer.h: In constructor ‘BPSTracker::TimeAndValue2::TimeAndValue2(RakNetTimeUS, uint64_t)’:
RakNet/Sources/ReliabilityLayer.h:88:14: warning: ‘BPSTracker::TimeAndValue2::time’ will be initialized after [-Wreorder]
RakNet/Sources/ReliabilityLayer.h:87:12: warning:   ‘uint64_t BPSTracker::TimeAndValue2::value1’ [-Wreorder]
RakNet/Sources/ReliabilityLayer.cpp:50:1: warning:   when initialized here [-Wreorder]
RakNet/Sources/ReliabilityLayer.cpp: In member function ‘void ReliabilityLayer::Update(SOCKET, SystemAddress, int, CCTimeType, unsigned int, DataStructures::List<PluginInterface2*>&, RakNetRandom*, short unsigned int)’:
RakNet/Sources/ReliabilityLayer.cpp:1298:15: warning: variable ‘timeMs’ set but not used [-Wunused-but-set-variable]
RakNet/Sources/ReliabilityLayer.cpp: In member function ‘void ReliabilityLayer::SendBitStream(SOCKET, SystemAddress, RakNet::BitStream*, RakNetRandom*, short unsigned int, CCTimeType)’:
RakNet/Sources/ReliabilityLayer.cpp:1832:15: warning: variable ‘oldLength’ set but not used [-Wunused-but-set-variable]
g++ -c -Wall -I. -ICommon -DUNITY_MASTERSERVER RakNet/Sources/LinuxStrings.cpp -o RakNet/Sources/LinuxStrings.o
g++ -c -Wall -I. -ICommon -DUNITY_MASTERSERVER RakNet/Sources/ConsoleServer.cpp -o RakNet/Sources/ConsoleServer.o
g++ -c -Wall -I. -ICommon -DUNITY_MASTERSERVER RakNet/Sources/Router.cpp -o RakNet/Sources/Router.o
g++ -c -Wall -I. -ICommon -DUNITY_MASTERSERVER RakNet/Sources/DS_BytePool.cpp -o RakNet/Sources/DS_BytePool.o
g++ -c -Wall -I. -ICommon -DUNITY_MASTERSERVER RakNet/Sources/MessageFilter.cpp -o RakNet/Sources/MessageFilter.o
g++ -c -Wall -I. -ICommon -DUNITY_MASTERSERVER RakNet/Sources/SHA1.cpp -o RakNet/Sources/SHA1.o
g++ -c -Wall -I. -ICommon -DUNITY_MASTERSERVER RakNet/Sources/DS_ByteQueue.cpp -o RakNet/Sources/DS_ByteQueue.o
g++ -c -Wall -I. -ICommon -DUNITY_MASTERSERVER RakNet/Sources/SimpleMutex.cpp -o RakNet/Sources/SimpleMutex.o
g++ -c -Wall -I. -ICommon -DUNITY_MASTERSERVER RakNet/Sources/DS_HuffmanEncodingTree.cpp -o RakNet/Sources/DS_HuffmanEncodingTree.o
g++ -c -Wall -I. -ICommon -DUNITY_MASTERSERVER RakNet/Sources/NetworkIDManager.cpp -o RakNet/Sources/NetworkIDManager.o
g++ -c -Wall -I. -ICommon -DUNITY_MASTERSERVER RakNet/Sources/SocketLayer.cpp -o RakNet/Sources/SocketLayer.o
g++ -c -Wall -I. -ICommon -DUNITY_MASTERSERVER RakNet/Sources/DS_Table.cpp -o RakNet/Sources/DS_Table.o
RakNet/Sources/DS_Table.cpp: In member function ‘DataStructures::Table::ColumnType DataStructures::Table::Cell::EstimateColumnType() const’:
RakNet/Sources/DS_Table.cpp:210:5: warning: suggest explicit braces to avoid ambiguous ‘else’ [-Wparentheses]
g++ -c -Wall -I. -ICommon -DUNITY_MASTERSERVER RakNet/Sources/NetworkIDObject.cpp -o RakNet/Sources/NetworkIDObject.o
In file included from RakNet/Sources/NetworkIDManager.h:11:0,
                 from RakNet/Sources/NetworkIDObject.cpp:9:
RakNet/Sources/DS_BinarySearchTree.h: In instantiation of ‘void DataStructures::AVLBalancedBinarySearchTree<BinarySearchTreeType>::BalanceTree(typename DataStructures::BinarySearchTree<BinarySearchTreeType>::node*, bool) [with BinarySearchTreeType = NetworkIDNode; typename DataStructures::BinarySearchTree<BinarySearchTreeType>::node = DataStructures::BinarySearchTree<NetworkIDNode>::node]’:
RakNet/Sources/DS_BinarySearchTree.h:219:3:   required from ‘void DataStructures::AVLBalancedBinarySearchTree<BinarySearchTreeType>::Del(const BinarySearchTreeType&) [with BinarySearchTreeType = NetworkIDNode]’
RakNet/Sources/NetworkIDObject.cpp:43:72:   required from here
RakNet/Sources/DS_BinarySearchTree.h:169:5: error: ‘Height’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
RakNet/Sources/DS_BinarySearchTree.h:169:5: note: declarations in dependent base ‘DataStructures::BinarySearchTree<NetworkIDNode>’ are not found by unqualified lookup
RakNet/Sources/DS_BinarySearchTree.h:169:5: note: use ‘this->Height’ instead
RakNet/Sources/DS_BinarySearchTree.h:174:5: error: ‘Height’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
RakNet/Sources/DS_BinarySearchTree.h:174:5: note: declarations in dependent base ‘DataStructures::BinarySearchTree<NetworkIDNode>’ are not found by unqualified lookup
RakNet/Sources/DS_BinarySearchTree.h:174:5: note: use ‘this->Height’ instead
make: *** [RakNet/Sources/NetworkIDObject.o] Error 1

Any suggestions? I haven’t found anything like this on answers nor forum…

To put together everything I learned while compiling into one place:

_ (be sure to use the master server from http://unity3d.com/master-server) _

MASTER SERVER

1: In RakNet/Sources/DS_BinarySearchTree.h you need to add this-> in front of Height( (notice the trailing space) on lines 169, 174, 229 & 238, like this:

  • line 169:
				left_height = Height( current->left );

needs to be changed to:

				left_height = this->Height( current->left );
  • line 174:
				right_height = Height( current->right );

needs to be changed to:

				right_height = this->Height( current->right );
  • line 229:
		return Height( A->right ) > Height( A->left );

needs to be changed to:

		return this->Height( A->right ) > this->Height( A->left );
  • line 238:
		return this->Height( A->left ) > this->Height( A->right );

needs to be changed to:

		return this->Height( A->left ) > this->Height( A->right );

2: Again, in RakNet/Sources/DS_BinarySearchTree.h, you need to add this-> in front of FindParent( (again, notice the trailing space) on lines 202, 275, 276, 339, 340, 833, 890 & 1109, like this:

  • line 202:
			current = FindParent( *( current->item ) );

needs to be changed to

			current = this->FindParent( *( current->item ) );
  • lines 275 & 276:
		B = FindParent( *( C->item ) );
		A = FindParent( *( B->item ) );

need to be changed to:

		B = this->FindParent( *( C->item ) );
		A = this->FindParent( *( B->item ) );
  • lines 339 & 340:
		B = FindParent( *( C->item ) );
		A = FindParent( *( B->item ) );

need to be changed to:

		B = this->FindParent( *( C->item ) );
		A = this->FindParent( *( B->item ) );
  • line 833:
						parent = FindParent( *( current->item ) );

needs to be changed to:

						parent = this->FindParent( *( current->item ) );
  • line 890:
					parent = FindParent( *( current->item ) );

needs to be changed to:

					parent = this->FindParent( *( current->item ) );</pre></code>
 - line **1109**:<pre><code>						parent = FindParent( *( current->item ) );

needs to be changed to:

						parent = this->FindParent( *( current->item ) );

3: In MasterServer.cpp, find:

#ifdef WIN32
#include <stdio.h>
#include <time.h>
#include <windows.h>
#else
#include <stdlib.h>
#endif

and change it to:

#ifdef WIN32
#include <stdio.h>
#include <time.h>
#include <windows.h>
#else
#include <stdlib.h>
#include <unistd.h>
#endif

4: Finally, in Makefile, on line 6, change:

CFLAGS=-Wall -lpthread $(DEFINES)

to

CFLAGS=-Wall -pthread $(DEFINES)

You’re done! Now just run make, and wait.

Tu run the master server use: ./MasterServer [-d] [-p xxxxx] [-l path] [-e (0,1,2)] [-c xxxxx]

-p Listen port (1-65535)
-d Daemon mode, run in the background
-l Use given log file
-e Debug level (0=OnlyErrors, 1=Warnings, 2=Informational(default), 2=FullDebug)
-c Connection count
-s Statistics print delay (minutes)

If anyone could create a patch instead of this manual fixing, that would be great.

FACILITATOR

To make the Facilitator compile you will have to do similar steps as with the Master Server:

1: You don’t have to repeat the MS (Master Server) steps 1 & 2, just copy the RakNet/Sources/DS_BinarySearchTree.h file from the master server to the facilitator. Overwrite the file that already exists.

2: Almost the same as in MS step 3. Find and change:

#ifdef WIN32
#include <stdio.h>
#include <time.h>
#include <windows.h>
#else
#include <stdlib.h>
#include <time.h>
#endif

to:

#ifdef WIN32
#include <stdio.h>
#include <time.h>
#include <windows.h>
#else
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
#endif

3: Repeat the MS step 4.

You’re done! Now just run make again, and wait.

_Special thanks to @gilberto-2 & @pracalic _

The same problem. NetwokIDObject.o not createdy by vps (ubuntu 12.04). I try change makefile, DS_BinarySearchTree and this is don’t give any succes in compilation.,

Well it’s easy just go to the file “RakNet/Sources/DS_BinarySearchTree.h” and add the “this->” in line 169 and line 174.

line 169 will be:
left_height = this->Height( current->left );

line 174 will be:
right_height = this->Height( current->right );

You might need to add in MasterServer.h:
#ifndef WIN32
#include <unistd.h>
#endif
So it can run in deamon mode.

Tu run the server use:
./MasterServer [-d] [-p xxxxx] [-l path] [-e (0,1,2)] [-c xxxxx]

“-p Listen port (1-65535)”
“-d Daemon mode, run in the background”
“-l Use given log file”
“-e Debug level (0=OnlyErrors, 1=Warnings, 2=Informational(default), 2=FullDebug)”
“-c Connection count”
“-s Statistics print delay (minutes)”

Hope it helps because i was struggling with the same prob.

Hi, do you know if I can just copy the DS_BinarySearchTree.h I just edited into the facillitatior folder too? or are they different? I seriously don’t want to have to do that all over again…

Also, by saying “it will work with facillitator too,” do you mean that I can also do the tag like in MasterServer.cpp?