aws-samples / aws-gateway-load-balancer-tunnel-handler

AWS Gateway Load Balancer Tunnel Handler. See the blog post linked below for more information.
MIT No Attribution
34 stars 12 forks source link

Build error when using two-arm example CF template #4

Open jplock opened 1 year ago

jplock commented 1 year ago

I'm trying to deploy https://github.com/aws-samples/aws-gateway-load-balancer-tunnel-handler/blob/main/example-scripts/example-topology-two-arm.template but I'm getting this build error when running make:

[ 11%] Building CXX object CMakeFiles/gwlbtun.dir/UDPPacketReceiver.cpp.o
/root/aws-gateway-load-balancer-tunnel-handler/UDPPacketReceiver.cpp: In member function ‘int UDPPacketReceiverThread::threadFunction()’:
/root/aws-gateway-load-balancer-tunnel-handler/UDPPacketReceiver.cpp:202:16: error: ‘gettid’ was not declared in this scope
     threadId = gettid();
                ^~~~~~
/root/aws-gateway-load-balancer-tunnel-handler/UDPPacketReceiver.cpp:202:16: note: suggested alternative: ‘getgid’
     threadId = gettid();
                ^~~~~~
                getgid
make[2]: *** [CMakeFiles/gwlbtun.dir/UDPPacketReceiver.cpp.o] Error 1
make[1]: *** [CMakeFiles/gwlbtun.dir/all] Error 2
make: *** [all] Error 2
MMChrisHinshaw commented 10 months ago

If you add the following to the utils.h file, this will build properly.

#include <unistd.h>
#include <sys/syscall.h>

#ifndef SYS_gettid
#error "SYS_gettid unavailable on this system"
#endif

#define gettid() ((pid_t)syscall(SYS_gettid))

Found here: https://stackoverflow.com/questions/21279649/getting-error-in-c-program-undefined-reference-to-gettid