Cannot build NATCompleteServer using CMake
Cannot build NATCompleteServer using CMake
Hi, I am trying to build and create an NATCompleteServer executable on a Digital Ocean droplet. I am unable to do so though.
I've tried to follow the instructions in the readme file in section 3.3.1. I've been able to run "cmake ../Source" and it works, however, I don't know to generate a NATCompleteServer.exe file that I can run.
I've also went into Samples/NATCompleteServer, and created a cmake folder. In there, I ran again "cmake ../". However, I ran into errors:
Unknown CMake command: GETCURRENTFOLDER
Any help would be greatly appreciated. Thanks!
I've tried to follow the instructions in the readme file in section 3.3.1. I've been able to run "cmake ../Source" and it works, however, I don't know to generate a NATCompleteServer.exe file that I can run.
I've also went into Samples/NATCompleteServer, and created a cmake folder. In there, I ran again "cmake ../". However, I ran into errors:
Unknown CMake command: GETCURRENTFOLDER
Any help would be greatly appreciated. Thanks!
Re: Cannot build NATCompleteServer using CMake
The sample integration in the CMake project is unfortunately not working entirely yet (note, this was also broken in RakNet). SLikeNet 0.1.0 fixed part of the issues, but I'm not sure whether this suffices for you.
You can try defining RAKNET_ENABLE_SAMPLES when configuring CMake. This should produce at least part of the sample projects. If this doesn't suffice in your case, I'd go with creating a simple project manually. Building NATCompleteServer only consists of a single main.cpp file and requires setting up the include folder and static/shared lib for SLikeNet. This should be straight forward to set up.
FTR: Getting all samples working with CMake on Linux/OSX is issue #80 and currently on the schedule for 0.2.0.
You can try defining RAKNET_ENABLE_SAMPLES when configuring CMake. This should produce at least part of the sample projects. If this doesn't suffice in your case, I'd go with creating a simple project manually. Building NATCompleteServer only consists of a single main.cpp file and requires setting up the include folder and static/shared lib for SLikeNet. This should be straight forward to set up.
FTR: Getting all samples working with CMake on Linux/OSX is issue #80 and currently on the schedule for 0.2.0.
-
- Junior-Member
- Posts: 10
- Joined: Sat Jan 20, 2018 1:23 am
Re: Cannot build NATCompleteServer using CMake
Thanks for your prompt response Luke! Since building using CMake for sample project is not working on Linux, I've also been trying to build an executable on my Windows machine, and then putting the .exe file on Linux to run it. I've generated the NATCompleteServer.exe in slikenet/Debug folder (When I built Debug win32 in VS2017 )but when I run it it also doesn't seem to work. This is the log I am getting when I run NATCompleteServer.exe on Linux:Luke1410 wrote:The sample integration in the CMake project is unfortunately not working entirely yet (note, this was also broken in RakNet). SLikeNet 0.1.0 fixed part of the issues, but I'm not sure whether this suffices for you.
You can try defining RAKNET_ENABLE_SAMPLES when configuring CMake. This should produce at least part of the sample projects. If this doesn't suffice in your case, I'd go with creating a simple project manually. Building NATCompleteServer only consists of a single main.cpp file and requires setting up the include folder and static/shared lib for SLikeNet. This should be straight forward to set up.
FTR: Getting all samples working with CMake on Linux/OSX is issue #80 and currently on the schedule for 0.2.0.
Code: Select all
Unhandled exception: unimplemented function WS2_32.dll.inet_pton called in 32-bit code (0x7bc4cf69).
Register dump:
CS:0023 SS:002b DS:002b ES:002b FS:0063 GS:006b
EIP:7bc4cf69 ESP:0032f140 EBP:0032f1b4 EFLAGS:00000202( - -- I - - - )
EAX:005ac616 EBX:7bcbe000 ECX:00000031 EDX:0032fccc
ESI:0032f158 EDI:0032f268
Re: Cannot build NATCompleteServer using CMake
The error is about your WS2_32.dll not providing the required inet_pton function. This is part of the Windows DLL and not SLikeNet/RakNet. Hence, using the static lib or dynamic lib won't make a difference.
I take it you are using Wine to run the exe on Linux? If so, the changelog entry for Wine 1.7.31 suggest it was missing in a previous build (see: https://www.winehq.org/announce/1.7.31 / https://bugs.winehq.org/show_bug.cgi?id=36713 / https://bugs.winehq.org/attachment.cgi? ... ction=edit ). You are not running such an old Wine version, are you (it was released in late 2014 already)?
I take it you are using Wine to run the exe on Linux? If so, the changelog entry for Wine 1.7.31 suggest it was missing in a previous build (see: https://www.winehq.org/announce/1.7.31 / https://bugs.winehq.org/show_bug.cgi?id=36713 / https://bugs.winehq.org/attachment.cgi? ... ction=edit ). You are not running such an old Wine version, are you (it was released in late 2014 already)?
-
- Junior-Member
- Posts: 10
- Joined: Sat Jan 20, 2018 1:23 am
Re: Cannot build NATCompleteServer using CMake
That error was indeed caused by my outdated wine version. It was at version 1.6. I updated it to 3.0 and now everything runs fine!Luke1410 wrote:The error is about your WS2_32.dll not providing the required inet_pton function. This is part of the Windows DLL and not SLikeNet/RakNet. Hence, using the static lib or dynamic lib won't make a difference.
I take it you are using Wine to run the exe on Linux? If so, the changelog entry for Wine 1.7.31 suggest it was missing in a previous build (see: https://www.winehq.org/announce/1.7.31 / https://bugs.winehq.org/show_bug.cgi?id=36713 / https://bugs.winehq.org/attachment.cgi? ... ction=edit ). You are not running such an old Wine version, are you (it was released in late 2014 already)?
I have a question now about NATCompleteServer demo itself. Now, I noticed that when I run the NATCompleteServer demo on my linux digital ocean droplet (which I assume is not behind a router), it says that it started at 127.0.0.1, instead of at the droplet's public IP. This is worrying:
Code: Select all
Server GUID is 535928524476531549
IPs:
1. 127.0.0.1
2. 127.0.0.1
3. 127.0.0.1
Using port 61111
002a:fixme:kernelbase:AppPolicyGetThreadInitializationType 0xfffffffa, 0x7bfe74
Started on 127.0.0.1|61111
This is the problem I ran into before as well. Have I misunderstood something about how it's supposed to work? My plan was simply to create a linux droplet, run the NATCompleteServer on the linux machine, run NATCompleteClient on my Windows machine (which is behind firewalls and a router), and hopefully NAT punches through and everything connects
Re: Cannot build NATCompleteServer using CMake
This might be an issue/limitation of the cloud server you are running into there.
Can you check/verify the returned hostname from gethostname(). I guess this doesn't return the correct one and when getaddrinfo() is called to resolve the hostname, the wrong IP addresses are retrieved.
If this is true, then I can put this on the list of issues to resolve (case: SLNET-171). Unfortunately, this might then take a while since there'r already quite a few other things which need priority atm.
A quick workaround could be to pass the correct hostname via the command line (or retrieve it from the environment variables/settings) and then set the socket descriptor directly. Does this work for you?
Can you check/verify the returned hostname from gethostname(). I guess this doesn't return the correct one and when getaddrinfo() is called to resolve the hostname, the wrong IP addresses are retrieved.
If this is true, then I can put this on the list of issues to resolve (case: SLNET-171). Unfortunately, this might then take a while since there'r already quite a few other things which need priority atm.
A quick workaround could be to pass the correct hostname via the command line (or retrieve it from the environment variables/settings) and then set the socket descriptor directly. Does this work for you?
Re: Cannot build NATCompleteServer using CMake
When I call GetHostName, I just get the name of my computer, which I'm sure is wrong.Luke1410 wrote:This might be an issue/limitation of the cloud server you are running into there.
Can you check/verify the returned hostname from gethostname(). I guess this doesn't return the correct one and when getaddrinfo() is called to resolve the hostname, the wrong IP addresses are retrieved.
If this is true, then I can put this on the list of issues to resolve (case: SLNET-171). Unfortunately, this might then take a while since there'r already quite a few other things which need priority atm.
A quick workaround could be to pass the correct hostname via the command line (or retrieve it from the environment variables/settings) and then set the socket descriptor directly. Does this work for you?
How do I get the correct hostname?
Re: Cannot build NATCompleteServer using CMake
This is actually correct. Pass that name to the call to getaddrinfo(). It'll return a linked list of addresses. I'm curious whether this list actually contains any IPv4 other than the localhost ones (the output you are getting from the NATCompleteServer sample suggest it doesn't). Could it be that your cloud instance is only assigned IPv6 addresses but no IPv4 one? This might explain why the sample only lists 127.0.0.1.
To enable IPv6 support, add the following line to defineoverrides.h:
and recompile the project.
As mentioned a temporary workaround would be to manually assign the correct IP to the socket.
To do this you can use the following code snippet and add it to main.cpp in the NATCompleteServer sample prior to the rakPeer->Startup() call:
To enable IPv6 support, add the following line to defineoverrides.h:
Code: Select all
#define RAKNET_SUPPORT_IPV6 1
As mentioned a temporary workaround would be to manually assign the correct IP to the socket.
To do this you can use the following code snippet and add it to main.cpp in the NATCompleteServer sample prior to the rakPeer->Startup() call:
Code: Select all
strcpy(sd[0].hostAddress, "xxx.xxx.xxx.xxx");
Re: Cannot build NATCompleteServer using CMake
I added the temp workaround, unfortunately it didn't seem to work.Luke1410 wrote:This is actually correct. Pass that name to the call to getaddrinfo(). It'll return a linked list of addresses. I'm curious whether this list actually contains any IPv4 other than the localhost ones (the output you are getting from the NATCompleteServer sample suggest it doesn't). Could it be that your cloud instance is only assigned IPv6 addresses but no IPv4 one? This might explain why the sample only lists 127.0.0.1.
To enable IPv6 support, add the following line to defineoverrides.h:and recompile the project.Code: Select all
#define RAKNET_SUPPORT_IPV6 1
As mentioned a temporary workaround would be to manually assign the correct IP to the socket.
To do this you can use the following code snippet and add it to main.cpp in the NATCompleteServer sample prior to the rakPeer->Startup() call:Code: Select all
strcpy(sd[0].hostAddress, "xxx.xxx.xxx.xxx");
Basically, in the main.cpp of NATCompleteServer, I changed to this:
Code: Select all
sd[0].port=DEFAULT_RAKPEER_PORT;
printf("Using port %i\n", sd[0].port);
if (i>=2)
{
strcpy_s(sd[0].hostAddress, "DIGITAL_DROPLET_PUBLIC_IP");
sd[1].port=DEFAULT_RAKPEER_PORT+1;
strcpy_s(sd[1].hostAddress, ipList[1].ToString(false));
sdLen=2;
}
if (rakPeer->Startup(8096,sd,sdLen)!= SLNet::RAKNET_STARTED)
{
printf("Failed to start rakPeer! Quitting\n");
SLNet::RakPeerInterface::DestroyInstance(rakPeer);
return 1;
}
This is the log I get from running the NATCompleteClient, trying to connect to the NATCompleteServer:
Code: Select all
Failed NatTypeDetectionFramework
Proceeding to next stage.
Executing NatPunchthoughClientFramework
Enter IP of system NatPunchthroughServer, or press enter for default: DIGITAL_DROPLET_PUBLIC_IP
Enter port of system NatPunchthroughServer, or press enter for default: 61111
Connecting...
Enter RakNetGuid of the remote system, which should have already connected
to the server.
Or press enter to just listen.
454863661084094967
Calculating port stride from DIGITAL_DROPLET_PUBLIC_IP|61111
CALCULATING_PORT_STRIDE timeout
Starting ID_NAT_PUNCHTHROUGH_REQUEST to guid 454863661084094967.
Punchthrough attempt to guid 454863661084094967 failed due to ID_NAT_TARGET_NOT_CONNECTED.
Failed: ID_NAT_TARGET_NOT_CONNECTED
Failed NatPunchthoughClientFramework
Proceeding to next stage.
Executing Router2Framework
Failed Router2Framework
Proceeding to next stage.
Executing UDPProxyClientFramework
Failed UDPProxyClientFramework
Connectivity not possible. Exiting
Re: Cannot build NATCompleteServer using CMake
This is weird. I don't have an immediate other idea at hand. Looks like I'll have to test this on the cloud instance myself. I try to get this squeezed in at some point (atm we are busy putting together the 0.1.1 release). I'll get back to you once I have further information.
Who is online
Users browsing this forum: No registered users and 1 guest