testing building connectivity.pro

Have Problems with PokerTH Installation? Here you will find Help.
w2vy
Posts: 18
Joined: Tue Apr 01, 2025 11:24 pm
Been thanked: 1 time

I want to run the connectivity.pro test app and I haven't used qmake before

from looking things over I am guessing I should do something like adding

Dockerfile (or maybe Dockerfile.test)

add a RUN option like:

# the following will compile the test client:
RUN cd /opt && git clone https://github.com/w2vy/pokerth.git && cd pokerth && git checkout dev && \
qmake6 CONFIG+="test_client c++11" QMAKE_CFLAGS_ISYSTEM="" -spec linux-g++ pokerth.pro && make -j$(nproc)

and in pokerth.pro add

test_client: {
SUBDIRS += connectivity.pro
}

Am I on the right track?

Tom
User avatar
sp0ck
Posts: 320
Joined: Mon Mar 15, 2021 12:54 pm
Location: Flensburg
Been thanked: 31 times

Hi Tom,

yes you are - partially.

The Dockerfile itself is - beside the docker ability - a simple textfile example showing how to compile pokerth on ubuntu:plucky (or 24.04.) from a minimal installed system. It is up to you to make adjustmenst - especially regarding the entrypoint - not even starting any binary - it's just the compilation.

If you want to build another .pro file you have to adapt the qmake6 command in respect to the coresponding file:

Code: Select all

qmake6 CONFIG+="c++11" QMAKE_CFLAGS_ISYSTEM="" -spec linux-g++ connectivity.pro && make -j$(nproc)
The CONFIG+= part might not be necessary.

You should find a binary like connectivity after succesful build.
w2vy
Posts: 18
Joined: Tue Apr 01, 2025 11:24 pm
Been thanked: 1 time

Yes I did realize that it would not actually run it, I like the docker image just giving me an environment where I can manually run it...

Tom
w2vy
Posts: 18
Joined: Tue Apr 01, 2025 11:24 pm
Been thanked: 1 time

Well I guess it is no surprise, I bet it has been a while since connectivity.cpp has been built...
Or did I forget to add some options?

Code: Select all

2.01 Project MESSAGE: Found boost_program_options
12.01 Project MESSAGE: Found boost_system
12.15 g++ -c -pipe -O2 -Wall -Wextra -frtti -D_REENTRANT -DPREFIX="/usr" -DQT_NO_DEBUG -I. -I. -Isrc -I/usr/include -I/usr/lib/x86_64-linux-gnu/qt6/mkspecs/linux-g++ -o obj/connectivity.o src/connectivity.cpp
12.15 g++ -c -pipe -O2 -Wall -Wextra -frtti -D_REENTRANT -DPREFIX="/usr" -DQT_NO_DEBUG -I. -I. -Isrc -I/usr/include -I/usr/lib/x86_64-linux-gnu/qt6/mkspecs/linux-g++ -o obj/netpacket.o src/net/common/netpacket.cpp
12.15 g++ -c -pipe -O2 -Wall -Wextra -frtti -D_REENTRANT -DPREFIX="/usr" -DQT_NO_DEBUG -I. -I. -Isrc -I/usr/include -I/usr/lib/x86_64-linux-gnu/qt6/mkspecs/linux-g++ -o obj/pokerth.pb.o src/third_party/protobuf/pokerth.pb.cc
12.29 In file included from src/net/netpacket.h:39,
12.29                  from src/net/common/netpacket.cpp:32:
12.29 src/third_party/protobuf/pokerth.pb.h:17:2: error: #error This file was generated by an older version of protoc which is
12.29    17 | #error This file was generated by an older version of protoc which is
12.29       |  ^~~~~
12.29 src/third_party/protobuf/pokerth.pb.h:18:2: error: #error incompatible with your Protocol Buffer headers. Please
12.29    18 | #error incompatible with your Protocol Buffer headers. Please
12.29       |  ^~~~~
12.29 src/third_party/protobuf/pokerth.pb.h:19:2: error: #error regenerate this file with a newer version of protoc.
12.29    19 | #error regenerate this file with a newer version of protoc.
12.29       |  ^~~~~
12.42 In file included from src/third_party/protobuf/pokerth.pb.cc:4:
12.42 src/third_party/protobuf/pokerth.pb.h:17:2: error: #error This file was generated by an older version of protoc which is
12.42    17 | #error This file was generated by an older version of protoc which is
12.42       |  ^~~~~
12.42 src/third_party/protobuf/pokerth.pb.h:18:2: error: #error incompatible with your Protocol Buffer headers. Please
12.42    18 | #error incompatible with your Protocol Buffer headers. Please
12.42       |  ^~~~~
12.42 src/third_party/protobuf/pokerth.pb.h:19:2: error: #error regenerate this file with a newer version of protoc.
12.42    19 | #error regenerate this file with a newer version of protoc.
12.42       |  ^~~~~
12.61 src/third_party/protobuf/pokerth.pb.h:26:10: fatal error: google/protobuf/generated_message_table_driven.h: No such file or directory
12.61    26 | #include <google/protobuf/generated_message_table_driven.h>
12.61       |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
12.61 compilation terminated.
12.62 make: *** [Makefile:463: obj/netpacket.o] Error 1
12.62 make: *** Waiting for unfinished jobs....
12.69 src/third_party/protobuf/pokerth.pb.h:26:10: fatal error: google/protobuf/generated_message_table_driven.h: No such file or directory
12.69    26 | #include <google/protobuf/generated_message_table_driven.h>
12.69       |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
12.69 compilation terminated.
12.70 make: *** [Makefile:466: obj/pokerth.pb.o] Error 1
14.08 In file included from src/connectivity.cpp:35:
14.08 src/third_party/protobuf/pokerth.pb.h:17:2: error: #error This file was generated by an older version of protoc which is
14.08    17 | #error This file was generated by an older version of protoc which is
14.08       |  ^~~~~
14.08 src/third_party/protobuf/pokerth.pb.h:18:2: error: #error incompatible with your Protocol Buffer headers. Please
14.08    18 | #error incompatible with your Protocol Buffer headers. Please
14.08       |  ^~~~~
14.08 src/third_party/protobuf/pokerth.pb.h:19:2: error: #error regenerate this file with a newer version of protoc.
14.08    19 | #error regenerate this file with a newer version of protoc.
14.08       |  ^~~~~
14.46 src/third_party/protobuf/pokerth.pb.h:26:10: fatal error: google/protobuf/generated_message_table_driven.h: No such file or directory
14.46    26 | #include <google/protobuf/generated_message_table_driven.h>
14.46       |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
14.46 compilation terminated.
14.48 make: *** [Makefile:451: obj/connectivity.o] Error 1
------
Dockerfile.test:31
--------------------
  30 |     # the following will compile the test client:
  31 | >>> RUN cd /opt && git clone https://github.com/w2vy/pokerth.git && cd pokerth && git checkout dev && \
  32 | >>>     qmake6 CONFIG+="c++11" QMAKE_CFLAGS_ISYSTEM="" -spec linux-g++ connectivity.pro && make -j$(nproc)
  33 |     
--------------------
ERROR: failed to solve: process "/bin/sh -c cd /opt && git clone https://github.com/w2vy/pokerth.git && cd pokerth && git checkout dev &&     qmake6 CONFIG+=\"c++11\" QMAKE_CFLAGS_ISYSTEM=\"\" -spec linux-g++ connectivity.pro && make -j$(nproc)" did not complete successfully: exit code: 2
User avatar
sp0ck
Posts: 320
Joined: Mon Mar 15, 2021 12:54 pm
Location: Flensburg
Been thanked: 31 times

Hi Tom,

you have to rebuild your proto files:

Code: Select all

protoc --proto_path=. --cpp_out=src/third_party/protobuf chatcleaner.proto
protoc --proto_path=. --cpp_out=src/third_party/protobuf pokerth.proto
EDIT: if you want to use Dockerfile with this make the following changes:

Code: Select all

# the following will rebuild proto files and compile connectivity app:
RUN cd /opt && git clone https://github.com/pokerth/pokerth.git && cd pokerth && git checkout stable && \
    qmake6 -spec linux-g++ connectivity.pro
RUN cd /opt/pokerth && rm src/third_party/protobuf/*
RUN cd /opt/pokerth && protoc --proto_path=. --cpp_out=src/third_party/protobuf pokerth.proto
RUN cd /opt/pokerth && protoc --proto_path=. --cpp_out=src/third_party/protobuf chatcleaner.proto   
RUN cd /opt/pokerth && make

Best regards
sp0ck
User avatar
sp0ck
Posts: 320
Joined: Mon Mar 15, 2021 12:54 pm
Location: Flensburg
Been thanked: 31 times

I updated Dockerfile on github to make it more clear.

Rebuilding proto files is necessary when for exeample two persons work on code and do commits on github. Both using different protoc versions.

... the rebuild of the proto files will now handle it.
w2vy
Posts: 18
Joined: Tue Apr 01, 2025 11:24 pm
Been thanked: 1 time

Nicely done!
w2vy
Posts: 18
Joined: Tue Apr 01, 2025 11:24 pm
Been thanked: 1 time

Ok I added this line to run qmake for connectivity.pro

Code: Select all

RUN cd /opt/pokerth && qmake6 CONFIG+="c++11" QMAKE_CFLAGS_ISYSTEM="" -spec linux-g++ connectivity.pro
and ran the docker... it looks like it's trying to do x++ on a socket, not an int
boost confuses me a bit :(

Code: Select all

------                                                                                                                                                    
 > [16/16] RUN cd /opt/pokerth && make -j$(nproc):                                                                                                        
0.454 g++ -c -pipe -O2 -Wall -Wextra -frtti -D_REENTRANT -DPREFIX="/usr" -DQT_NO_DEBUG -I. -I. -Isrc -I/usr/include -I/usr/lib/x86_64-linux-gnu/qt6/mkspecs/linux-g++ -o obj/connectivity.o src/connectivity.cpp                                                                                                    
0.456 g++ -c -pipe -O2 -Wall -Wextra -frtti -D_REENTRANT -DPREFIX="/usr" -DQT_NO_DEBUG -I. -I. -Isrc -I/usr/include -I/usr/lib/x86_64-linux-gnu/qt6/mkspecs/linux-g++ -o obj/netpacket.o src/net/common/netpacket.cpp                                                                                               
0.457 g++ -c -pipe -O2 -Wall -Wextra -frtti -D_REENTRANT -DPREFIX="/usr" -DQT_NO_DEBUG -I. -I. -Isrc -I/usr/include -I/usr/lib/x86_64-linux-gnu/qt6/mkspecs/linux-g++ -o obj/pokerth.pb.o src/third_party/protobuf/pokerth.pb.cc
8.703 src/connectivity.cpp: In function 'int main(int, char**)':
8.703 src/connectivity.cpp:186:58: error: 'boost::asio::ip::basic_resolver_iterator<InternetProtocol> boost::asio::ip::basic_resolver_iterator<InternetProtocol>::operator++(int) [with InternetProtocol = boost::asio::ip::tcp]' is inaccessible within this context
8.703   186 |                         socket.connect(*endpoint_iterator++, error);
8.703       |                                                          ^~
8.703 In file included from /usr/include/boost/asio/ip/basic_resolver.hpp:30,
8.703                  from /usr/include/boost/asio.hpp:125,
8.703                  from src/connectivity.cpp:34:
8.703 /usr/include/boost/asio/ip/basic_resolver_iterator.hpp:132:27: note: declared here
8.703   132 |   basic_resolver_iterator operator++(int)
8.703       |                           ^~~~~~~~
8.703 src/connectivity.cpp:186:58: error: 'boost::asio::ip::basic_resolver_iterator<boost::asio::ip::tcp>' is not an accessible base of 'boost::asio::ip::basic_resolver<boost::asio::ip::tcp>::results_type' {aka 'boost::asio::ip::basic_resolver_results<boost::asio::ip::tcp>'}
8.703   186 |                         socket.connect(*endpoint_iterator++, error);
8.703       |                                                          ^~
11.22 src/connectivity.cpp: At global scope:
11.22 src/connectivity.cpp:55:1: warning: 'int net_packet_print_to_string(const void*, size_t, void*)' defined but not used [-Wunused-function]
11.22    55 | net_packet_print_to_string(const void *buffer, size_t size, void *packetStr)
11.22       | ^~~~~~~~~~~~~~~~~~~~~~~~~~
11.28 make: *** [Makefile:451: obj/connectivity.o] Error 1
11.28 make: *** Waiting for unfinished jobs....
------
Dockerfile.test:48
--------------------
  46 |     
  47 |     # compile:
  48 | >>> RUN cd /opt/pokerth && make -j$(nproc)
  49 |     
  50 |     ENTRYPOINT ["/bin/bash"]
--------------------
ERROR: failed to solve: process "/bin/sh -c cd /opt/pokerth && make -j$(nproc)" did not complete successfully: exit code: 2
Tom
User avatar
sp0ck
Posts: 320
Joined: Mon Mar 15, 2021 12:54 pm
Location: Flensburg
Been thanked: 31 times

Ok - tyfi - looks like a boost issue - not every code-line/build target has been ported to boost 1.87. I will check it soon.
User avatar
sp0ck
Posts: 320
Joined: Mon Mar 15, 2021 12:54 pm
Location: Flensburg
Been thanked: 31 times

Hi Tom,

please try again fetching latest commit. Compilation works now. I did not test a connection with the binary though.

sp0ck
Post Reply