From 718951bc6862e27c06020fcbacd79af279c65b43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=83=D1=82=D1=8E=D0=BD=D1=8F=D0=BD=20=D0=90?= =?UTF-8?q?=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=D0=A0=D0=BE=D0=BC=D0=B0=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=D0=B8=D1=87?= Date: Wed, 10 Jul 2024 01:18:01 +0300 Subject: [PATCH 01/45] init --- .github/workflows/Build.yml | 34 +++++++++++++++++++++++++++++++--- .github/workflows/debian.yml | 11 +++++++++-- .github/workflows/ubuntu.yml | 23 ++++++++++++++++++++++- 3 files changed, 62 insertions(+), 6 deletions(-) diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index d3c8d31e5f..820f695dd6 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -23,23 +23,51 @@ jobs: cpp: 17 asan: off ubsan: off + light_runtime: off + - os: buster + compiler: g++ + cpp: 17 + asan: off + ubsan: off + light_runtime: on - os: focal compiler: clang++ cpp: 17 asan: off ubsan: on + light_runtime: off + - os: focal + compiler: clang++ + cpp: 17 + asan: off + ubsan: on + light_runtime: on - os: focal compiler: g++-10 cpp: 20 asan: on ubsan: off + light_runtime: off + - os: focal + compiler: g++-10 + cpp: 20 + asan: on + ubsan: off + light_runtime: on - os: jammy compiler: g++ cpp: 20 asan: on ubsan: off - - name: "${{matrix.os}}/${{matrix.compiler}}/c++${{matrix.cpp}}/asan=${{matrix.asan}}/ubsan=${{matrix.ubsan}}" + light_runtime: off + - os: jammy + compiler: g++ + cpp: 20 + asan: on + ubsan: off + light_runtime: on + + name: "${{matrix.os}}/${{matrix.compiler}}/c++${{matrix.cpp}}/asan=${{matrix.asan}}/ubsan=${{matrix.ubsan}}/light_runtime=${{matrix.light_runtime}}" steps: - uses: actions/checkout@v3 @@ -78,7 +106,7 @@ jobs: - name: Build all run: docker exec kphp-build-container-${{matrix.os}} bash -c - "cmake -DCMAKE_CXX_COMPILER=${{matrix.compiler}} -DCMAKE_CXX_STANDARD=${{matrix.cpp}} -DADDRESS_SANITIZER=${{matrix.asan}} -DUNDEFINED_SANITIZER=${{matrix.ubsan}} -DPDO_DRIVER_MYSQL=ON -DPDO_DRIVER_PGSQL=ON -DPDO_LIBS_STATIC_LINKING=ON -S ${{env.kphp_root_dir}} -B ${{env.kphp_build_dir}} && make -C ${{env.kphp_build_dir}} -j$(nproc) all" + "cmake -DCMAKE_CXX_COMPILER=${{matrix.compiler}} -DCMAKE_CXX_STANDARD=${{matrix.cpp}} -DCOMPILE_RUNTIME_LIGHT=${{matrix.light_runtime}} -DADDRESS_SANITIZER=${{matrix.asan}} -DUNDEFINED_SANITIZER=${{matrix.ubsan}} -DPDO_DRIVER_MYSQL=ON -DPDO_DRIVER_PGSQL=ON -DPDO_LIBS_STATIC_LINKING=ON -S ${{env.kphp_root_dir}} -B ${{env.kphp_build_dir}} && make -C ${{env.kphp_build_dir}} -j$(nproc) all" - name: Run unit tests run: docker exec kphp-build-container-${{matrix.os}} bash -c diff --git a/.github/workflows/debian.yml b/.github/workflows/debian.yml index 2d507d8110..1d365bd178 100644 --- a/.github/workflows/debian.yml +++ b/.github/workflows/debian.yml @@ -21,8 +21,15 @@ jobs: cpp: 17 asan: off ubsan: off + light_runtime: off + - os: buster + compiler: g++ + cpp: 17 + asan: off + ubsan: off + light_runtime: on - name: "${{matrix.os}}/${{matrix.compiler}}/c++${{matrix.cpp}}/asan=${{matrix.asan}}/ubsan=${{matrix.ubsan}}" + name: "${{matrix.os}}/${{matrix.compiler}}/c++${{matrix.cpp}}/asan=${{matrix.asan}}/ubsan=${{matrix.ubsan}}/light_runtime=${{matrix.light_runtime}}" steps: - uses: actions/checkout@v3 @@ -59,7 +66,7 @@ jobs: - name: Build all run: docker exec -u kitten kphp-build-container-${{matrix.os}} bash -c - "cmake -DCMAKE_CXX_COMPILER=${{matrix.compiler}} -DCMAKE_CXX_STANDARD=${{matrix.cpp}} -DADDRESS_SANITIZER=${{matrix.asan}} -DUNDEFINED_SANITIZER=${{matrix.ubsan}} -DPDO_DRIVER_MYSQL=ON -DPDO_DRIVER_PGSQL=ON -DPDO_LIBS_STATIC_LINKING=ON -S ${{env.kphp_root_dir}} -B ${{env.kphp_build_dir}} && make -C ${{env.kphp_build_dir}} -j$(nproc) all" + "cmake -DCMAKE_CXX_COMPILER=${{matrix.compiler}} -DCMAKE_CXX_STANDARD=${{matrix.cpp}} -DCOMPILE_RUNTIME_LIGHT=${{matrix.light_runtime}} -DADDRESS_SANITIZER=${{matrix.asan}} -DUNDEFINED_SANITIZER=${{matrix.ubsan}} -DPDO_DRIVER_MYSQL=ON -DPDO_DRIVER_PGSQL=ON -DPDO_LIBS_STATIC_LINKING=ON -S ${{env.kphp_root_dir}} -B ${{env.kphp_build_dir}} && make -C ${{env.kphp_build_dir}} -j$(nproc) all" - name: Run unit tests run: docker exec -u kitten kphp-build-container-${{matrix.os}} bash -c diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 49af16bd9f..0280b01a48 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -21,18 +21,39 @@ jobs: cpp: 17 asan: off ubsan: off + light_runtime: off + - os: jammy + compiler: g++ + cpp: 17 + asan: off + ubsan: off + light_runtime: on - os: focal compiler: clang++ cpp: 17 asan: off ubsan: on + light_runtime: off + - os: focal + compiler: clang++ + cpp: 17 + asan: off + ubsan: on + light_runtime: on + - os: focal + compiler: g++-10 + cpp: 20 + asan: on + ubsan: off + light_runtime: off - os: focal compiler: g++-10 cpp: 20 asan: on ubsan: off + light_runtime: on - name: "${{matrix.os}}/${{matrix.compiler}}/c++${{matrix.cpp}}/asan=${{matrix.asan}}/ubsan=${{matrix.ubsan}}" + name: "${{matrix.os}}/${{matrix.compiler}}/c++${{matrix.cpp}}/asan=${{matrix.asan}}/ubsan=${{matrix.ubsan}}/light_runtime=${{matrix.light_runtime}}" steps: - uses: actions/checkout@v3 From 5db00ea3fdaf2ec29108e3048eb97c9f0e08f150 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=83=D1=82=D1=8E=D0=BD=D1=8F=D0=BD=20=D0=90?= =?UTF-8?q?=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=D0=A0=D0=BE=D0=BC=D0=B0=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=D0=B8=D1=87?= Date: Wed, 10 Jul 2024 01:25:29 +0300 Subject: [PATCH 02/45] temporaly disable buster build die to sury issue --- .github/workflows/Build.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index 820f695dd6..65b52c17b1 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -18,18 +18,18 @@ jobs: strategy: matrix: include: - - os: buster - compiler: g++ - cpp: 17 - asan: off - ubsan: off - light_runtime: off - - os: buster - compiler: g++ - cpp: 17 - asan: off - ubsan: off - light_runtime: on + # - os: buster + # compiler: g++ + # cpp: 17 + # asan: off + # ubsan: off + # light_runtime: off + # - os: buster + # compiler: g++ + # cpp: 17 + # asan: off + # ubsan: off + # light_runtime: on - os: focal compiler: clang++ cpp: 17 From c42a920454f8271a85886e5716d0cffea728f113 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=83=D1=82=D1=8E=D0=BD=D1=8F=D0=BD=20=D0=90?= =?UTF-8?q?=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=D0=A0=D0=BE=D0=BC=D0=B0=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=D0=B8=D1=87?= Date: Wed, 10 Jul 2024 20:52:04 +0300 Subject: [PATCH 03/45] update --- .github/workflows/Build.yml | 44 +++++++++++------------------ .github/workflows/Dockerfile.buster | 8 +++--- .github/workflows/debian.yml | 6 ++++ .github/workflows/ubuntu.yml | 23 +-------------- 4 files changed, 27 insertions(+), 54 deletions(-) diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index 65b52c17b1..14c8941479 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -18,54 +18,42 @@ jobs: strategy: matrix: include: - # - os: buster - # compiler: g++ - # cpp: 17 - # asan: off - # ubsan: off - # light_runtime: off - # - os: buster - # compiler: g++ - # cpp: 17 - # asan: off - # ubsan: off - # light_runtime: on - - os: focal - compiler: clang++ + - os: buster + compiler: g++ cpp: 17 asan: off - ubsan: on + ubsan: off light_runtime: off - - os: focal + - os: buster + compiler: g++ + cpp: 17 + asan: off + ubsan: off + light_runtime: on + - os: buster compiler: clang++ cpp: 17 asan: off - ubsan: on + ubsan: off light_runtime: on - os: focal - compiler: g++-10 - cpp: 20 - asan: on - ubsan: off + compiler: clang++ + cpp: 17 + asan: off + ubsan: on light_runtime: off - os: focal compiler: g++-10 cpp: 20 asan: on ubsan: off - light_runtime: on - - os: jammy - compiler: g++ - cpp: 20 - asan: on - ubsan: off light_runtime: off - os: jammy compiler: g++ cpp: 20 asan: on ubsan: off - light_runtime: on + light_runtime: off name: "${{matrix.os}}/${{matrix.compiler}}/c++${{matrix.cpp}}/asan=${{matrix.asan}}/ubsan=${{matrix.ubsan}}/light_runtime=${{matrix.light_runtime}}" diff --git a/.github/workflows/Dockerfile.buster b/.github/workflows/Dockerfile.buster index 908dbaed10..432855b3c9 100644 --- a/.github/workflows/Dockerfile.buster +++ b/.github/workflows/Dockerfile.buster @@ -8,8 +8,8 @@ RUN apt-get update && \ echo "deb https://archive.debian.org/debian buster-backports main" >> /etc/apt/sources.list && \ wget -qO /etc/apt/trusted.gpg.d/vkpartner.asc https://artifactory-external.vkpartner.ru/artifactory/api/gpg/key/public && \ echo "deb https://artifactory-external.vkpartner.ru/artifactory/kphp buster main" >> /etc/apt/sources.list && \ - wget -qO - https://packages.sury.org/php/apt.gpg | apt-key add - && \ - echo "deb https://packages.sury.org/php/ buster main" >> /etc/apt/sources.list.d/php.list && \ + wget -qO - https://debian.octopuce.fr/snapshots/sury-php/buster-latest/apt.gpg | apt-key add - && \ + echo "deb https://debian.octopuce.fr/snapshots/sury-php/buster-latest/ buster main" >> /etc/apt/sources.list && \ TEMP_DEB="$(mktemp)" && \ wget -O "$TEMP_DEB" 'https://dev.mysql.com/get/mysql-apt-config_0.8.29-1_all.deb' && \ dpkg -i "$TEMP_DEB" && \ @@ -19,8 +19,8 @@ RUN apt-get update && \ apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 467B942D3A79BD29 && \ apt-get update && \ apt-get install -y --no-install-recommends \ - git cmake-data=3.18* cmake=3.18* make g++ gperf netcat \ - python3.7 python3-dev libpython3-dev python3-pip python3-setuptools mysql-server libmysqlclient-dev && \ + git cmake-data=3.18* cmake=3.18* make g++-10 clang++ gperf netcat \ + python3.7 python3-dev libpython3-dev python3-pip python3-setuptools python3-wheel mysql-server libmysqlclient-dev && \ pip3 install -r /tmp/requirements.txt && \ apt-get install -y --no-install-recommends curl-kphp-vk kphp-timelib libuber-h3-dev libfmt-dev libgtest-dev libgmock-dev libre2-dev libpcre3-dev \ libzstd-dev libyaml-cpp-dev libnghttp2-dev zlib1g-dev php7.4-dev libldap-dev libkrb5-dev \ diff --git a/.github/workflows/debian.yml b/.github/workflows/debian.yml index 1d365bd178..d4c9130881 100644 --- a/.github/workflows/debian.yml +++ b/.github/workflows/debian.yml @@ -28,6 +28,12 @@ jobs: asan: off ubsan: off light_runtime: on + - os: buster + compiler: clang++ + cpp: 17 + asan: off + ubsan: off + light_runtime: on name: "${{matrix.os}}/${{matrix.compiler}}/c++${{matrix.cpp}}/asan=${{matrix.asan}}/ubsan=${{matrix.ubsan}}/light_runtime=${{matrix.light_runtime}}" diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 0280b01a48..49af16bd9f 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -21,39 +21,18 @@ jobs: cpp: 17 asan: off ubsan: off - light_runtime: off - - os: jammy - compiler: g++ - cpp: 17 - asan: off - ubsan: off - light_runtime: on - os: focal compiler: clang++ cpp: 17 asan: off ubsan: on - light_runtime: off - - os: focal - compiler: clang++ - cpp: 17 - asan: off - ubsan: on - light_runtime: on - - os: focal - compiler: g++-10 - cpp: 20 - asan: on - ubsan: off - light_runtime: off - os: focal compiler: g++-10 cpp: 20 asan: on ubsan: off - light_runtime: on - name: "${{matrix.os}}/${{matrix.compiler}}/c++${{matrix.cpp}}/asan=${{matrix.asan}}/ubsan=${{matrix.ubsan}}/light_runtime=${{matrix.light_runtime}}" + name: "${{matrix.os}}/${{matrix.compiler}}/c++${{matrix.cpp}}/asan=${{matrix.asan}}/ubsan=${{matrix.ubsan}}" steps: - uses: actions/checkout@v3 From 99b437f9b176582000dead188de859e7f1b34b74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=83=D1=82=D1=8E=D0=BD=D1=8F=D0=BD=20=D0=90?= =?UTF-8?q?=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=D0=A0=D0=BE=D0=BC=D0=B0=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=D0=B8=D1=87?= Date: Thu, 11 Jul 2024 06:14:58 +0300 Subject: [PATCH 04/45] focal+gcc-10 and buster+clang --- .github/workflows/Build.yml | 16 +++++++-------- .github/workflows/Dockerfile | 32 +++++++++++++++++++++++++++++ .github/workflows/Dockerfile.buster | 7 +++++-- .github/workflows/Dockerfile.focal | 2 +- 4 files changed, 46 insertions(+), 11 deletions(-) create mode 100644 .github/workflows/Dockerfile diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index 14c8941479..1a8a23f353 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -25,14 +25,8 @@ jobs: ubsan: off light_runtime: off - os: buster - compiler: g++ - cpp: 17 - asan: off - ubsan: off - light_runtime: on - - os: buster - compiler: clang++ - cpp: 17 + compiler: clang++-17 + cpp: 20 asan: off ubsan: off light_runtime: on @@ -48,6 +42,12 @@ jobs: asan: on ubsan: off light_runtime: off + - os: focal + compiler: g++-10 + cpp: 20 + asan: off + ubsan: off + light_runtime: on - os: jammy compiler: g++ cpp: 20 diff --git a/.github/workflows/Dockerfile b/.github/workflows/Dockerfile new file mode 100644 index 0000000000..b9bae4f653 --- /dev/null +++ b/.github/workflows/Dockerfile @@ -0,0 +1,32 @@ +FROM debian:buster +ARG DEBIAN_FRONTEND=noninteractive + +RUN apt-get update && \ + apt-get install -y --no-install-recommends apt-utils ca-certificates gnupg wget lsb-release && \ + wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - && \ + echo "deb https://archive.debian.org/debian buster-backports main" >> /etc/apt/sources.list && \ + echo "deb http://apt.llvm.org/buster/ llvm-toolchain-buster-17 main" >> /etc/apt/sources.list && \ + echo "deb-src http://apt.llvm.org/buster/ llvm-toolchain-buster-17 main" >> /etc/apt/sources.list && \ + wget -qO /etc/apt/trusted.gpg.d/vkpartner.asc https://artifactory-external.vkpartner.ru/artifactory/api/gpg/key/public && \ + echo "deb https://artifactory-external.vkpartner.ru/artifactory/kphp buster main" >> /etc/apt/sources.list && \ + wget -qO - https://debian.octopuce.fr/snapshots/sury-php/buster-latest/apt.gpg | apt-key add - && \ + echo "deb https://debian.octopuce.fr/snapshots/sury-php/buster-latest/ buster main" >> /etc/apt/sources.list && \ + TEMP_DEB="$(mktemp)" && \ + wget -O "$TEMP_DEB" 'https://dev.mysql.com/get/mysql-apt-config_0.8.29-1_all.deb' && \ + dpkg -i "$TEMP_DEB" && \ + rm -f "$TEMP_DEB" && \ + echo "deb http://apt.postgresql.org/pub/repos/apt buster-pgdg main" > /etc/apt/sources.list.d/pgdg.list && \ + wget -qO - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - && \ + apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 467B942D3A79BD29 && \ + apt-get update && \ + apt-get install -y --no-install-recommends \ + git cmake-data=3.18* cmake=3.18* make g++ clang-17 libclang-rt-17-dev gperf netcat \ + python3.7 python3-dev libpython3-dev python3-pip python3-setuptools python3-wheel mysql-server libmysqlclient-dev && \ + pip3 install jsonschema && \ + apt-get install -y --no-install-recommends curl-kphp-vk kphp-timelib libuber-h3-dev libfmt-dev libgtest-dev libgmock-dev libre2-dev libpcre3-dev \ + libzstd-dev libyaml-cpp-dev libnghttp2-dev zlib1g-dev php7.4-dev libldap-dev libkrb5-dev \ + postgresql postgresql-server-dev-all libnuma-dev composer libstdc++6 && \ + rm -rf /var/lib/apt/lists/* && \ + update-alternatives --set php /usr/bin/php7.4 + +RUN useradd -ms /bin/bash kitten diff --git a/.github/workflows/Dockerfile.buster b/.github/workflows/Dockerfile.buster index 432855b3c9..a3d62e1004 100644 --- a/.github/workflows/Dockerfile.buster +++ b/.github/workflows/Dockerfile.buster @@ -5,7 +5,10 @@ COPY tests/python/requirements.txt /tmp/ RUN apt-get update && \ apt-get install -y --no-install-recommends apt-utils ca-certificates gnupg wget lsb-release && \ + wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - && \ echo "deb https://archive.debian.org/debian buster-backports main" >> /etc/apt/sources.list && \ + echo "deb http://apt.llvm.org/buster/ llvm-toolchain-buster-17 main" >> /etc/apt/sources.list && \ + echo "deb-src http://apt.llvm.org/buster/ llvm-toolchain-buster-17 main" >> /etc/apt/sources.list && \ wget -qO /etc/apt/trusted.gpg.d/vkpartner.asc https://artifactory-external.vkpartner.ru/artifactory/api/gpg/key/public && \ echo "deb https://artifactory-external.vkpartner.ru/artifactory/kphp buster main" >> /etc/apt/sources.list && \ wget -qO - https://debian.octopuce.fr/snapshots/sury-php/buster-latest/apt.gpg | apt-key add - && \ @@ -19,12 +22,12 @@ RUN apt-get update && \ apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 467B942D3A79BD29 && \ apt-get update && \ apt-get install -y --no-install-recommends \ - git cmake-data=3.18* cmake=3.18* make g++-10 clang++ gperf netcat \ + git cmake-data=3.18* cmake=3.18* make g++ clang-17 libclang-rt-17-dev gperf netcat \ python3.7 python3-dev libpython3-dev python3-pip python3-setuptools python3-wheel mysql-server libmysqlclient-dev && \ pip3 install -r /tmp/requirements.txt && \ apt-get install -y --no-install-recommends curl-kphp-vk kphp-timelib libuber-h3-dev libfmt-dev libgtest-dev libgmock-dev libre2-dev libpcre3-dev \ libzstd-dev libyaml-cpp-dev libnghttp2-dev zlib1g-dev php7.4-dev libldap-dev libkrb5-dev \ - postgresql postgresql-server-dev-all libnuma-dev composer && \ + postgresql postgresql-server-dev-all libnuma-dev composer libstdc++6 libc++-6-dev && \ rm -rf /var/lib/apt/lists/* && \ update-alternatives --set php /usr/bin/php7.4 diff --git a/.github/workflows/Dockerfile.focal b/.github/workflows/Dockerfile.focal index 255e51a82d..e3f1cd848a 100644 --- a/.github/workflows/Dockerfile.focal +++ b/.github/workflows/Dockerfile.focal @@ -17,7 +17,7 @@ RUN apt-get update && \ python3.7 -m pip install pip && python3.7 -m pip install -r /tmp/requirements.txt && \ apt-get install -y --no-install-recommends curl-kphp-vk kphp-timelib libuber-h3-dev libfmt-dev libgtest-dev libgmock-dev libre2-dev libpcre3-dev \ libzstd-dev libyaml-cpp-dev libnghttp2-dev zlib1g-dev php7.4-dev libldap-dev libkrb5-dev \ - postgresql postgresql-server-dev-all libnuma-dev composer unzip && \ + postgresql postgresql-server-dev-all libnuma-dev composer unzip libstdc++6 && \ rm -rf /var/lib/apt/lists/* ENV ASAN_OPTIONS=detect_leaks=0 From 318cfdae98ab325d6bf1c958e5202e72d495d212 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=83=D1=82=D1=8E=D0=BD=D1=8F=D0=BD=20=D0=90?= =?UTF-8?q?=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=D0=A0=D0=BE=D0=BC=D0=B0=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=D0=B8=D1=87?= Date: Tue, 16 Jul 2024 11:45:00 +0300 Subject: [PATCH 05/45] resolve From 7aaf62d068d857f8e22edd9ced4374abff5fa221 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=83=D1=82=D1=8E=D0=BD=D1=8F=D0=BD=20=D0=90?= =?UTF-8?q?=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=D0=A0=D0=BE=D0=BC=D0=B0=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=D0=B8=D1=87?= Date: Wed, 10 Jul 2024 01:18:01 +0300 Subject: [PATCH 06/45] init --- .github/workflows/Build.yml | 34 +++++++++++++++++++++++++++++++--- .github/workflows/debian.yml | 11 +++++++++-- .github/workflows/ubuntu.yml | 23 ++++++++++++++++++++++- 3 files changed, 62 insertions(+), 6 deletions(-) diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index d3c8d31e5f..820f695dd6 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -23,23 +23,51 @@ jobs: cpp: 17 asan: off ubsan: off + light_runtime: off + - os: buster + compiler: g++ + cpp: 17 + asan: off + ubsan: off + light_runtime: on - os: focal compiler: clang++ cpp: 17 asan: off ubsan: on + light_runtime: off + - os: focal + compiler: clang++ + cpp: 17 + asan: off + ubsan: on + light_runtime: on - os: focal compiler: g++-10 cpp: 20 asan: on ubsan: off + light_runtime: off + - os: focal + compiler: g++-10 + cpp: 20 + asan: on + ubsan: off + light_runtime: on - os: jammy compiler: g++ cpp: 20 asan: on ubsan: off - - name: "${{matrix.os}}/${{matrix.compiler}}/c++${{matrix.cpp}}/asan=${{matrix.asan}}/ubsan=${{matrix.ubsan}}" + light_runtime: off + - os: jammy + compiler: g++ + cpp: 20 + asan: on + ubsan: off + light_runtime: on + + name: "${{matrix.os}}/${{matrix.compiler}}/c++${{matrix.cpp}}/asan=${{matrix.asan}}/ubsan=${{matrix.ubsan}}/light_runtime=${{matrix.light_runtime}}" steps: - uses: actions/checkout@v3 @@ -78,7 +106,7 @@ jobs: - name: Build all run: docker exec kphp-build-container-${{matrix.os}} bash -c - "cmake -DCMAKE_CXX_COMPILER=${{matrix.compiler}} -DCMAKE_CXX_STANDARD=${{matrix.cpp}} -DADDRESS_SANITIZER=${{matrix.asan}} -DUNDEFINED_SANITIZER=${{matrix.ubsan}} -DPDO_DRIVER_MYSQL=ON -DPDO_DRIVER_PGSQL=ON -DPDO_LIBS_STATIC_LINKING=ON -S ${{env.kphp_root_dir}} -B ${{env.kphp_build_dir}} && make -C ${{env.kphp_build_dir}} -j$(nproc) all" + "cmake -DCMAKE_CXX_COMPILER=${{matrix.compiler}} -DCMAKE_CXX_STANDARD=${{matrix.cpp}} -DCOMPILE_RUNTIME_LIGHT=${{matrix.light_runtime}} -DADDRESS_SANITIZER=${{matrix.asan}} -DUNDEFINED_SANITIZER=${{matrix.ubsan}} -DPDO_DRIVER_MYSQL=ON -DPDO_DRIVER_PGSQL=ON -DPDO_LIBS_STATIC_LINKING=ON -S ${{env.kphp_root_dir}} -B ${{env.kphp_build_dir}} && make -C ${{env.kphp_build_dir}} -j$(nproc) all" - name: Run unit tests run: docker exec kphp-build-container-${{matrix.os}} bash -c diff --git a/.github/workflows/debian.yml b/.github/workflows/debian.yml index 2d507d8110..1d365bd178 100644 --- a/.github/workflows/debian.yml +++ b/.github/workflows/debian.yml @@ -21,8 +21,15 @@ jobs: cpp: 17 asan: off ubsan: off + light_runtime: off + - os: buster + compiler: g++ + cpp: 17 + asan: off + ubsan: off + light_runtime: on - name: "${{matrix.os}}/${{matrix.compiler}}/c++${{matrix.cpp}}/asan=${{matrix.asan}}/ubsan=${{matrix.ubsan}}" + name: "${{matrix.os}}/${{matrix.compiler}}/c++${{matrix.cpp}}/asan=${{matrix.asan}}/ubsan=${{matrix.ubsan}}/light_runtime=${{matrix.light_runtime}}" steps: - uses: actions/checkout@v3 @@ -59,7 +66,7 @@ jobs: - name: Build all run: docker exec -u kitten kphp-build-container-${{matrix.os}} bash -c - "cmake -DCMAKE_CXX_COMPILER=${{matrix.compiler}} -DCMAKE_CXX_STANDARD=${{matrix.cpp}} -DADDRESS_SANITIZER=${{matrix.asan}} -DUNDEFINED_SANITIZER=${{matrix.ubsan}} -DPDO_DRIVER_MYSQL=ON -DPDO_DRIVER_PGSQL=ON -DPDO_LIBS_STATIC_LINKING=ON -S ${{env.kphp_root_dir}} -B ${{env.kphp_build_dir}} && make -C ${{env.kphp_build_dir}} -j$(nproc) all" + "cmake -DCMAKE_CXX_COMPILER=${{matrix.compiler}} -DCMAKE_CXX_STANDARD=${{matrix.cpp}} -DCOMPILE_RUNTIME_LIGHT=${{matrix.light_runtime}} -DADDRESS_SANITIZER=${{matrix.asan}} -DUNDEFINED_SANITIZER=${{matrix.ubsan}} -DPDO_DRIVER_MYSQL=ON -DPDO_DRIVER_PGSQL=ON -DPDO_LIBS_STATIC_LINKING=ON -S ${{env.kphp_root_dir}} -B ${{env.kphp_build_dir}} && make -C ${{env.kphp_build_dir}} -j$(nproc) all" - name: Run unit tests run: docker exec -u kitten kphp-build-container-${{matrix.os}} bash -c diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 49af16bd9f..0280b01a48 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -21,18 +21,39 @@ jobs: cpp: 17 asan: off ubsan: off + light_runtime: off + - os: jammy + compiler: g++ + cpp: 17 + asan: off + ubsan: off + light_runtime: on - os: focal compiler: clang++ cpp: 17 asan: off ubsan: on + light_runtime: off + - os: focal + compiler: clang++ + cpp: 17 + asan: off + ubsan: on + light_runtime: on + - os: focal + compiler: g++-10 + cpp: 20 + asan: on + ubsan: off + light_runtime: off - os: focal compiler: g++-10 cpp: 20 asan: on ubsan: off + light_runtime: on - name: "${{matrix.os}}/${{matrix.compiler}}/c++${{matrix.cpp}}/asan=${{matrix.asan}}/ubsan=${{matrix.ubsan}}" + name: "${{matrix.os}}/${{matrix.compiler}}/c++${{matrix.cpp}}/asan=${{matrix.asan}}/ubsan=${{matrix.ubsan}}/light_runtime=${{matrix.light_runtime}}" steps: - uses: actions/checkout@v3 From 66c040f252ce550d05e271561c45ee991be7f707 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=83=D1=82=D1=8E=D0=BD=D1=8F=D0=BD=20=D0=90?= =?UTF-8?q?=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=D0=A0=D0=BE=D0=BC=D0=B0=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=D0=B8=D1=87?= Date: Wed, 10 Jul 2024 01:25:29 +0300 Subject: [PATCH 07/45] temporaly disable buster build die to sury issue --- .github/workflows/Build.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index 820f695dd6..65b52c17b1 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -18,18 +18,18 @@ jobs: strategy: matrix: include: - - os: buster - compiler: g++ - cpp: 17 - asan: off - ubsan: off - light_runtime: off - - os: buster - compiler: g++ - cpp: 17 - asan: off - ubsan: off - light_runtime: on + # - os: buster + # compiler: g++ + # cpp: 17 + # asan: off + # ubsan: off + # light_runtime: off + # - os: buster + # compiler: g++ + # cpp: 17 + # asan: off + # ubsan: off + # light_runtime: on - os: focal compiler: clang++ cpp: 17 From ddc5272d0f9575370b65ea4024d7dd6a4478f9c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=83=D1=82=D1=8E=D0=BD=D1=8F=D0=BD=20=D0=90?= =?UTF-8?q?=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=D0=A0=D0=BE=D0=BC=D0=B0=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=D0=B8=D1=87?= Date: Wed, 10 Jul 2024 20:52:04 +0300 Subject: [PATCH 08/45] update --- .github/workflows/Build.yml | 44 +++++++++++------------------ .github/workflows/Dockerfile.buster | 31 -------------------- .github/workflows/debian.yml | 6 ++++ .github/workflows/ubuntu.yml | 23 +-------------- 4 files changed, 23 insertions(+), 81 deletions(-) delete mode 100644 .github/workflows/Dockerfile.buster diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index 65b52c17b1..14c8941479 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -18,54 +18,42 @@ jobs: strategy: matrix: include: - # - os: buster - # compiler: g++ - # cpp: 17 - # asan: off - # ubsan: off - # light_runtime: off - # - os: buster - # compiler: g++ - # cpp: 17 - # asan: off - # ubsan: off - # light_runtime: on - - os: focal - compiler: clang++ + - os: buster + compiler: g++ cpp: 17 asan: off - ubsan: on + ubsan: off light_runtime: off - - os: focal + - os: buster + compiler: g++ + cpp: 17 + asan: off + ubsan: off + light_runtime: on + - os: buster compiler: clang++ cpp: 17 asan: off - ubsan: on + ubsan: off light_runtime: on - os: focal - compiler: g++-10 - cpp: 20 - asan: on - ubsan: off + compiler: clang++ + cpp: 17 + asan: off + ubsan: on light_runtime: off - os: focal compiler: g++-10 cpp: 20 asan: on ubsan: off - light_runtime: on - - os: jammy - compiler: g++ - cpp: 20 - asan: on - ubsan: off light_runtime: off - os: jammy compiler: g++ cpp: 20 asan: on ubsan: off - light_runtime: on + light_runtime: off name: "${{matrix.os}}/${{matrix.compiler}}/c++${{matrix.cpp}}/asan=${{matrix.asan}}/ubsan=${{matrix.ubsan}}/light_runtime=${{matrix.light_runtime}}" diff --git a/.github/workflows/Dockerfile.buster b/.github/workflows/Dockerfile.buster deleted file mode 100644 index c19dd5ef5a..0000000000 --- a/.github/workflows/Dockerfile.buster +++ /dev/null @@ -1,31 +0,0 @@ -FROM debian:buster -ARG DEBIAN_FRONTEND=noninteractive - -COPY tests/python/requirements.txt /tmp/ - -RUN apt-get update && \ - apt-get install -y --no-install-recommends apt-utils ca-certificates gnupg wget lsb-release && \ - echo "deb https://archive.debian.org/debian buster-backports main" >> /etc/apt/sources.list && \ - wget -qO /etc/apt/trusted.gpg.d/vkpartner.asc https://artifactory-external.vkpartner.ru/artifactory/api/gpg/key/public && \ - echo "deb https://artifactory-external.vkpartner.ru/artifactory/kphp buster main" >> /etc/apt/sources.list && \ - wget -qO - https://debian.octopuce.fr/snapshots/sury-php/buster-latest/apt.gpg | apt-key add - && \ - echo "deb https://debian.octopuce.fr/snapshots/sury-php/buster-latest/ buster main" >> /etc/apt/sources.list && \ - TEMP_DEB="$(mktemp)" && \ - wget -O "$TEMP_DEB" 'https://dev.mysql.com/get/mysql-apt-config_0.8.29-1_all.deb' && \ - dpkg -i "$TEMP_DEB" && \ - rm -f "$TEMP_DEB" && \ - echo "deb http://apt.postgresql.org/pub/repos/apt buster-pgdg main" > /etc/apt/sources.list.d/pgdg.list && \ - wget -qO - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - && \ - apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 467B942D3A79BD29 && \ - apt-get update && \ - apt-get install -y --no-install-recommends \ - git cmake-data=3.18* cmake=3.18* make g++ gperf netcat \ - python3.7 python3-dev libpython3-dev python3-pip python3-setuptools python3-wheel mysql-server libmysqlclient-dev && \ - pip3 install -r /tmp/requirements.txt && \ - apt-get install -y --no-install-recommends curl-kphp-vk kphp-timelib libuber-h3-dev libfmt-dev libgtest-dev libgmock-dev libre2-dev libpcre3-dev \ - libzstd-dev libyaml-cpp-dev libnghttp2-dev zlib1g-dev php7.4-dev libldap-dev libkrb5-dev \ - postgresql postgresql-server-dev-all libnuma-dev composer && \ - rm -rf /var/lib/apt/lists/* && \ - update-alternatives --set php /usr/bin/php7.4 - -RUN useradd -ms /bin/bash kitten diff --git a/.github/workflows/debian.yml b/.github/workflows/debian.yml index 1d365bd178..d4c9130881 100644 --- a/.github/workflows/debian.yml +++ b/.github/workflows/debian.yml @@ -28,6 +28,12 @@ jobs: asan: off ubsan: off light_runtime: on + - os: buster + compiler: clang++ + cpp: 17 + asan: off + ubsan: off + light_runtime: on name: "${{matrix.os}}/${{matrix.compiler}}/c++${{matrix.cpp}}/asan=${{matrix.asan}}/ubsan=${{matrix.ubsan}}/light_runtime=${{matrix.light_runtime}}" diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 0280b01a48..49af16bd9f 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -21,39 +21,18 @@ jobs: cpp: 17 asan: off ubsan: off - light_runtime: off - - os: jammy - compiler: g++ - cpp: 17 - asan: off - ubsan: off - light_runtime: on - os: focal compiler: clang++ cpp: 17 asan: off ubsan: on - light_runtime: off - - os: focal - compiler: clang++ - cpp: 17 - asan: off - ubsan: on - light_runtime: on - - os: focal - compiler: g++-10 - cpp: 20 - asan: on - ubsan: off - light_runtime: off - os: focal compiler: g++-10 cpp: 20 asan: on ubsan: off - light_runtime: on - name: "${{matrix.os}}/${{matrix.compiler}}/c++${{matrix.cpp}}/asan=${{matrix.asan}}/ubsan=${{matrix.ubsan}}/light_runtime=${{matrix.light_runtime}}" + name: "${{matrix.os}}/${{matrix.compiler}}/c++${{matrix.cpp}}/asan=${{matrix.asan}}/ubsan=${{matrix.ubsan}}" steps: - uses: actions/checkout@v3 From 78bee1fc9d464604a3822cfb9cbfd712fac25a26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=83=D1=82=D1=8E=D0=BD=D1=8F=D0=BD=20=D0=90?= =?UTF-8?q?=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=D0=A0=D0=BE=D0=BC=D0=B0=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=D0=B8=D1=87?= Date: Thu, 11 Jul 2024 06:14:58 +0300 Subject: [PATCH 09/45] focal+gcc-10 and buster+clang --- .github/workflows/Build.yml | 16 +++++++-------- .github/workflows/Dockerfile | 32 ++++++++++++++++++++++++++++++ .github/workflows/Dockerfile.focal | 2 +- 3 files changed, 41 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/Dockerfile diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index 14c8941479..1a8a23f353 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -25,14 +25,8 @@ jobs: ubsan: off light_runtime: off - os: buster - compiler: g++ - cpp: 17 - asan: off - ubsan: off - light_runtime: on - - os: buster - compiler: clang++ - cpp: 17 + compiler: clang++-17 + cpp: 20 asan: off ubsan: off light_runtime: on @@ -48,6 +42,12 @@ jobs: asan: on ubsan: off light_runtime: off + - os: focal + compiler: g++-10 + cpp: 20 + asan: off + ubsan: off + light_runtime: on - os: jammy compiler: g++ cpp: 20 diff --git a/.github/workflows/Dockerfile b/.github/workflows/Dockerfile new file mode 100644 index 0000000000..b9bae4f653 --- /dev/null +++ b/.github/workflows/Dockerfile @@ -0,0 +1,32 @@ +FROM debian:buster +ARG DEBIAN_FRONTEND=noninteractive + +RUN apt-get update && \ + apt-get install -y --no-install-recommends apt-utils ca-certificates gnupg wget lsb-release && \ + wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - && \ + echo "deb https://archive.debian.org/debian buster-backports main" >> /etc/apt/sources.list && \ + echo "deb http://apt.llvm.org/buster/ llvm-toolchain-buster-17 main" >> /etc/apt/sources.list && \ + echo "deb-src http://apt.llvm.org/buster/ llvm-toolchain-buster-17 main" >> /etc/apt/sources.list && \ + wget -qO /etc/apt/trusted.gpg.d/vkpartner.asc https://artifactory-external.vkpartner.ru/artifactory/api/gpg/key/public && \ + echo "deb https://artifactory-external.vkpartner.ru/artifactory/kphp buster main" >> /etc/apt/sources.list && \ + wget -qO - https://debian.octopuce.fr/snapshots/sury-php/buster-latest/apt.gpg | apt-key add - && \ + echo "deb https://debian.octopuce.fr/snapshots/sury-php/buster-latest/ buster main" >> /etc/apt/sources.list && \ + TEMP_DEB="$(mktemp)" && \ + wget -O "$TEMP_DEB" 'https://dev.mysql.com/get/mysql-apt-config_0.8.29-1_all.deb' && \ + dpkg -i "$TEMP_DEB" && \ + rm -f "$TEMP_DEB" && \ + echo "deb http://apt.postgresql.org/pub/repos/apt buster-pgdg main" > /etc/apt/sources.list.d/pgdg.list && \ + wget -qO - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - && \ + apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 467B942D3A79BD29 && \ + apt-get update && \ + apt-get install -y --no-install-recommends \ + git cmake-data=3.18* cmake=3.18* make g++ clang-17 libclang-rt-17-dev gperf netcat \ + python3.7 python3-dev libpython3-dev python3-pip python3-setuptools python3-wheel mysql-server libmysqlclient-dev && \ + pip3 install jsonschema && \ + apt-get install -y --no-install-recommends curl-kphp-vk kphp-timelib libuber-h3-dev libfmt-dev libgtest-dev libgmock-dev libre2-dev libpcre3-dev \ + libzstd-dev libyaml-cpp-dev libnghttp2-dev zlib1g-dev php7.4-dev libldap-dev libkrb5-dev \ + postgresql postgresql-server-dev-all libnuma-dev composer libstdc++6 && \ + rm -rf /var/lib/apt/lists/* && \ + update-alternatives --set php /usr/bin/php7.4 + +RUN useradd -ms /bin/bash kitten diff --git a/.github/workflows/Dockerfile.focal b/.github/workflows/Dockerfile.focal index 255e51a82d..e3f1cd848a 100644 --- a/.github/workflows/Dockerfile.focal +++ b/.github/workflows/Dockerfile.focal @@ -17,7 +17,7 @@ RUN apt-get update && \ python3.7 -m pip install pip && python3.7 -m pip install -r /tmp/requirements.txt && \ apt-get install -y --no-install-recommends curl-kphp-vk kphp-timelib libuber-h3-dev libfmt-dev libgtest-dev libgmock-dev libre2-dev libpcre3-dev \ libzstd-dev libyaml-cpp-dev libnghttp2-dev zlib1g-dev php7.4-dev libldap-dev libkrb5-dev \ - postgresql postgresql-server-dev-all libnuma-dev composer unzip && \ + postgresql postgresql-server-dev-all libnuma-dev composer unzip libstdc++6 && \ rm -rf /var/lib/apt/lists/* ENV ASAN_OPTIONS=detect_leaks=0 From a931aa615e53d764c04b3022a92c61fed34f7889 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=83=D1=82=D1=8E=D0=BD=D1=8F=D0=BD=20=D0=90?= =?UTF-8?q?=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=D0=A0=D0=BE=D0=BC=D0=B0=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=D0=B8=D1=87?= Date: Tue, 16 Jul 2024 11:45:00 +0300 Subject: [PATCH 10/45] resolve From 5f9c6b6de27504b31288e429d85044f6dfc2da2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=83=D1=82=D1=8E=D0=BD=D1=8F=D0=BD=20=D0=90?= =?UTF-8?q?=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=D0=A0=D0=BE=D0=BC=D0=B0=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=D0=B8=D1=87?= Date: Tue, 16 Jul 2024 11:54:04 +0300 Subject: [PATCH 11/45] continue --- .github/workflows/{Dockerfile => Dockerfile.buster} | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) rename .github/workflows/{Dockerfile => Dockerfile.buster} (81%) diff --git a/.github/workflows/Dockerfile b/.github/workflows/Dockerfile.buster similarity index 81% rename from .github/workflows/Dockerfile rename to .github/workflows/Dockerfile.buster index b9bae4f653..c19dd5ef5a 100644 --- a/.github/workflows/Dockerfile +++ b/.github/workflows/Dockerfile.buster @@ -1,12 +1,11 @@ FROM debian:buster ARG DEBIAN_FRONTEND=noninteractive +COPY tests/python/requirements.txt /tmp/ + RUN apt-get update && \ apt-get install -y --no-install-recommends apt-utils ca-certificates gnupg wget lsb-release && \ - wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - && \ echo "deb https://archive.debian.org/debian buster-backports main" >> /etc/apt/sources.list && \ - echo "deb http://apt.llvm.org/buster/ llvm-toolchain-buster-17 main" >> /etc/apt/sources.list && \ - echo "deb-src http://apt.llvm.org/buster/ llvm-toolchain-buster-17 main" >> /etc/apt/sources.list && \ wget -qO /etc/apt/trusted.gpg.d/vkpartner.asc https://artifactory-external.vkpartner.ru/artifactory/api/gpg/key/public && \ echo "deb https://artifactory-external.vkpartner.ru/artifactory/kphp buster main" >> /etc/apt/sources.list && \ wget -qO - https://debian.octopuce.fr/snapshots/sury-php/buster-latest/apt.gpg | apt-key add - && \ @@ -20,12 +19,12 @@ RUN apt-get update && \ apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 467B942D3A79BD29 && \ apt-get update && \ apt-get install -y --no-install-recommends \ - git cmake-data=3.18* cmake=3.18* make g++ clang-17 libclang-rt-17-dev gperf netcat \ + git cmake-data=3.18* cmake=3.18* make g++ gperf netcat \ python3.7 python3-dev libpython3-dev python3-pip python3-setuptools python3-wheel mysql-server libmysqlclient-dev && \ - pip3 install jsonschema && \ + pip3 install -r /tmp/requirements.txt && \ apt-get install -y --no-install-recommends curl-kphp-vk kphp-timelib libuber-h3-dev libfmt-dev libgtest-dev libgmock-dev libre2-dev libpcre3-dev \ libzstd-dev libyaml-cpp-dev libnghttp2-dev zlib1g-dev php7.4-dev libldap-dev libkrb5-dev \ - postgresql postgresql-server-dev-all libnuma-dev composer libstdc++6 && \ + postgresql postgresql-server-dev-all libnuma-dev composer && \ rm -rf /var/lib/apt/lists/* && \ update-alternatives --set php /usr/bin/php7.4 From 1f6928c2114334f00d213ceb603c0893cbc15879 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=83=D1=82=D1=8E=D0=BD=D1=8F=D0=BD=20=D0=90?= =?UTF-8?q?=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=D0=A0=D0=BE=D0=BC=D0=B0=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=D0=B8=D1=87?= Date: Tue, 16 Jul 2024 11:54:57 +0300 Subject: [PATCH 12/45] continue --- .github/workflows/Build.yml | 2 +- .github/workflows/debian.yml | 17 ++--------------- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index 2ac830c5af..d6b3eb4802 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -108,7 +108,7 @@ jobs: - name: Compile dummy PHP script if: ${{matrix.light_runtime}} run: docker exec kphp-build-container-${{matrix.os}} bash -c - "cd ${{env.kphp_build_dir}} && echo 'hello world' > demo.php && ${{env.kphp_root_dir}}/objs/bin/kphp2cpp --mode k2-component --cxx ${{matrix.compiler}} demo.php && kphp_out/cli --user kitten" + "cd ${{env.kphp_build_dir}} && echo 'hello world' > demo.php && ${{env.kphp_root_dir}}/objs/bin/kphp2cpp --mode k2-component --cxx ${{matrix.compiler}} demo.php" - name: Polyfills composer install run: docker exec kphp-build-container-${{matrix.os}} bash -c diff --git a/.github/workflows/debian.yml b/.github/workflows/debian.yml index d4c9130881..2d507d8110 100644 --- a/.github/workflows/debian.yml +++ b/.github/workflows/debian.yml @@ -21,21 +21,8 @@ jobs: cpp: 17 asan: off ubsan: off - light_runtime: off - - os: buster - compiler: g++ - cpp: 17 - asan: off - ubsan: off - light_runtime: on - - os: buster - compiler: clang++ - cpp: 17 - asan: off - ubsan: off - light_runtime: on - name: "${{matrix.os}}/${{matrix.compiler}}/c++${{matrix.cpp}}/asan=${{matrix.asan}}/ubsan=${{matrix.ubsan}}/light_runtime=${{matrix.light_runtime}}" + name: "${{matrix.os}}/${{matrix.compiler}}/c++${{matrix.cpp}}/asan=${{matrix.asan}}/ubsan=${{matrix.ubsan}}" steps: - uses: actions/checkout@v3 @@ -72,7 +59,7 @@ jobs: - name: Build all run: docker exec -u kitten kphp-build-container-${{matrix.os}} bash -c - "cmake -DCMAKE_CXX_COMPILER=${{matrix.compiler}} -DCMAKE_CXX_STANDARD=${{matrix.cpp}} -DCOMPILE_RUNTIME_LIGHT=${{matrix.light_runtime}} -DADDRESS_SANITIZER=${{matrix.asan}} -DUNDEFINED_SANITIZER=${{matrix.ubsan}} -DPDO_DRIVER_MYSQL=ON -DPDO_DRIVER_PGSQL=ON -DPDO_LIBS_STATIC_LINKING=ON -S ${{env.kphp_root_dir}} -B ${{env.kphp_build_dir}} && make -C ${{env.kphp_build_dir}} -j$(nproc) all" + "cmake -DCMAKE_CXX_COMPILER=${{matrix.compiler}} -DCMAKE_CXX_STANDARD=${{matrix.cpp}} -DADDRESS_SANITIZER=${{matrix.asan}} -DUNDEFINED_SANITIZER=${{matrix.ubsan}} -DPDO_DRIVER_MYSQL=ON -DPDO_DRIVER_PGSQL=ON -DPDO_LIBS_STATIC_LINKING=ON -S ${{env.kphp_root_dir}} -B ${{env.kphp_build_dir}} && make -C ${{env.kphp_build_dir}} -j$(nproc) all" - name: Run unit tests run: docker exec -u kitten kphp-build-container-${{matrix.os}} bash -c From 6500be48a39ccb933697080dde0dcd502ad3e3e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=83=D1=82=D1=8E=D0=BD=D1=8F=D0=BD=20=D0=90?= =?UTF-8?q?=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=D0=A0=D0=BE=D0=BC=D0=B0=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=D0=B8=D1=87?= Date: Tue, 16 Jul 2024 12:33:06 +0300 Subject: [PATCH 13/45] g++-10 option when compiling script --- compiler/compiler-settings.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/compiler/compiler-settings.cpp b/compiler/compiler-settings.cpp index 95f77c5735..71da41c13e 100644 --- a/compiler/compiler-settings.cpp +++ b/compiler/compiler-settings.cpp @@ -312,6 +312,7 @@ void CompilerSettings::init() { ss << " -std=c++17"; #elif __cplusplus <= 202002L ss << " -std=c++20"; + ss << " -fcoroutines"; #else #error unsupported __cplusplus value #endif From ea216c292ba88ef759ee1fc70cbd841a5f502b29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=83=D1=82=D1=8E=D0=BD=D1=8F=D0=BD=20=D0=90?= =?UTF-8?q?=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=D0=A0=D0=BE=D0=BC=D0=B0=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=D0=B8=D1=87?= Date: Tue, 16 Jul 2024 12:44:05 +0300 Subject: [PATCH 14/45] update --- .github/workflows/Build.yml | 2 +- .github/workflows/Dockerfile.focal | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index d6b3eb4802..1930066711 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -43,7 +43,7 @@ jobs: ubsan: off light_runtime: off - os: focal - compiler: g++-10 + compiler: g++-11 cpp: 20 asan: off ubsan: off diff --git a/.github/workflows/Dockerfile.focal b/.github/workflows/Dockerfile.focal index 9282166e69..15b1b822fb 100644 --- a/.github/workflows/Dockerfile.focal +++ b/.github/workflows/Dockerfile.focal @@ -15,7 +15,7 @@ RUN apt-get update && \ add-apt-repository ppa:deadsnakes/ppa && \ apt-get update && \ apt-get install -y --no-install-recommends \ - git cmake make clang g++ g++-10 clang-18 libclang-rt-18-dev gperf netcat \ + git cmake make clang g++ g++-10 g++-11 clang-18 libclang-rt-18-dev gperf netcat \ python3.7 python3-pip python3.7-distutils python3.7-dev libpython3.7-dev python3-jsonschema python3-setuptools mysql-server libmysqlclient-dev && \ python3.7 -m pip install pip && python3.7 -m pip install -r /tmp/requirements.txt && \ apt-get install -y --no-install-recommends curl-kphp-vk kphp-timelib libuber-h3-dev libfmt-dev libgtest-dev libgmock-dev libre2-dev libpcre3-dev \ From 2bcaf27037493f1ebf13e83c09610faaed78c578 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=83=D1=82=D1=8E=D0=BD=D1=8F=D0=BD=20=D0=90?= =?UTF-8?q?=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=D0=A0=D0=BE=D0=BC=D0=B0=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=D0=B8=D1=87?= Date: Tue, 16 Jul 2024 12:49:36 +0300 Subject: [PATCH 15/45] test --- .github/workflows/Build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index 1930066711..bb3c266e31 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -67,7 +67,7 @@ jobs: path: 'kphp-polyfills' - name: Cache docker image - uses: actions/cache@v1 + uses: actions/cache@v3 id: docker-image-cache with: path: /tmp/docker-save @@ -76,7 +76,7 @@ jobs: - name: Build and save docker image if: steps.docker-image-cache.outputs.cache-hit != 'true' run: | - docker build -f $GITHUB_WORKSPACE/.github/workflows/Dockerfile.${{matrix.os}} $GITHUB_WORKSPACE -t kphp-build-img-${{matrix.os}} --cache-from=type=local,src=kphp-build-img-${{matrix.os}}-cache + docker build -f $GITHUB_WORKSPACE/.github/workflows/Dockerfile.${{matrix.os}} . -t kphp-build-img-${{matrix.os}} --cache-from=type=local,src=kphp-build-img-${{matrix.os}}-cache docker tag kphp-build-img-${{matrix.os}} kphp-build-img-${{matrix.os}}-cache && mkdir -p /tmp/docker-save && docker save kphp-build-img-${{matrix.os}}-cache -o /tmp/docker-save/kphp-build-env-${{matrix.os}}.tar && ls -lh /tmp/docker-save - name: Load docker image from cache From 807e588baaed363f316c0c322a314918ddb19c6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=83=D1=82=D1=8E=D0=BD=D1=8F=D0=BD=20=D0=90?= =?UTF-8?q?=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=D0=A0=D0=BE=D0=BC=D0=B0=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=D0=B8=D1=87?= Date: Tue, 16 Jul 2024 12:49:49 +0300 Subject: [PATCH 16/45] test2 --- .github/workflows/Build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index bb3c266e31..a80ec38f6d 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -76,7 +76,7 @@ jobs: - name: Build and save docker image if: steps.docker-image-cache.outputs.cache-hit != 'true' run: | - docker build -f $GITHUB_WORKSPACE/.github/workflows/Dockerfile.${{matrix.os}} . -t kphp-build-img-${{matrix.os}} --cache-from=type=local,src=kphp-build-img-${{matrix.os}}-cache + docker build -f $GITHUB_WORKSPACE/.github/workflows/Dockerfile.${{matrix.os}} $GITHUB_WORKSPACE -t kphp-build-img-${{matrix.os}} --cache-from=type=local,src=kphp-build-img-${{matrix.os}}-cache docker tag kphp-build-img-${{matrix.os}} kphp-build-img-${{matrix.os}}-cache && mkdir -p /tmp/docker-save && docker save kphp-build-img-${{matrix.os}}-cache -o /tmp/docker-save/kphp-build-env-${{matrix.os}}.tar && ls -lh /tmp/docker-save - name: Load docker image from cache From d5482a67a7f04272149b9803dfab7df969ef5408 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=83=D1=82=D1=8E=D0=BD=D1=8F=D0=BD=20=D0=90?= =?UTF-8?q?=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=D0=A0=D0=BE=D0=BC=D0=B0=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=D0=B8=D1=87?= Date: Tue, 16 Jul 2024 12:56:30 +0300 Subject: [PATCH 17/45] test --- .github/workflows/Build.yml | 6 +++--- .github/workflows/Dockerfile.focal | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index a80ec38f6d..917d6e75c8 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -43,7 +43,7 @@ jobs: ubsan: off light_runtime: off - os: focal - compiler: g++-11 + compiler: g++-10 cpp: 20 asan: off ubsan: off @@ -67,7 +67,7 @@ jobs: path: 'kphp-polyfills' - name: Cache docker image - uses: actions/cache@v3 + uses: actions/cache@v1 id: docker-image-cache with: path: /tmp/docker-save @@ -76,7 +76,7 @@ jobs: - name: Build and save docker image if: steps.docker-image-cache.outputs.cache-hit != 'true' run: | - docker build -f $GITHUB_WORKSPACE/.github/workflows/Dockerfile.${{matrix.os}} $GITHUB_WORKSPACE -t kphp-build-img-${{matrix.os}} --cache-from=type=local,src=kphp-build-img-${{matrix.os}}-cache + docker build -f $GITHUB_WORKSPACE/.github/workflows/Dockerfile.${{matrix.os}} -t kphp-build-img-${{matrix.os}} --cache-from=type=local,src=kphp-build-img-${{matrix.os}}-cache docker tag kphp-build-img-${{matrix.os}} kphp-build-img-${{matrix.os}}-cache && mkdir -p /tmp/docker-save && docker save kphp-build-img-${{matrix.os}}-cache -o /tmp/docker-save/kphp-build-env-${{matrix.os}}.tar && ls -lh /tmp/docker-save - name: Load docker image from cache diff --git a/.github/workflows/Dockerfile.focal b/.github/workflows/Dockerfile.focal index 15b1b822fb..9282166e69 100644 --- a/.github/workflows/Dockerfile.focal +++ b/.github/workflows/Dockerfile.focal @@ -15,7 +15,7 @@ RUN apt-get update && \ add-apt-repository ppa:deadsnakes/ppa && \ apt-get update && \ apt-get install -y --no-install-recommends \ - git cmake make clang g++ g++-10 g++-11 clang-18 libclang-rt-18-dev gperf netcat \ + git cmake make clang g++ g++-10 clang-18 libclang-rt-18-dev gperf netcat \ python3.7 python3-pip python3.7-distutils python3.7-dev libpython3.7-dev python3-jsonschema python3-setuptools mysql-server libmysqlclient-dev && \ python3.7 -m pip install pip && python3.7 -m pip install -r /tmp/requirements.txt && \ apt-get install -y --no-install-recommends curl-kphp-vk kphp-timelib libuber-h3-dev libfmt-dev libgtest-dev libgmock-dev libre2-dev libpcre3-dev \ From cb09c76a47401f212ab1187efcee4fb529825491 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=83=D1=82=D1=8E=D0=BD=D1=8F=D0=BD=20=D0=90?= =?UTF-8?q?=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=D0=A0=D0=BE=D0=BC=D0=B0=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=D0=B8=D1=87?= Date: Tue, 16 Jul 2024 12:57:59 +0300 Subject: [PATCH 18/45] test --- .github/workflows/Build.yml | 54 ++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index 917d6e75c8..fab9748e39 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -72,11 +72,11 @@ jobs: with: path: /tmp/docker-save key: docker-save-${{matrix.os}}-${{ hashFiles('.github/workflows/Dockerfile.*', 'tests/python/requirements.txt') }} - + - name: Build and save docker image if: steps.docker-image-cache.outputs.cache-hit != 'true' run: | - docker build -f $GITHUB_WORKSPACE/.github/workflows/Dockerfile.${{matrix.os}} -t kphp-build-img-${{matrix.os}} --cache-from=type=local,src=kphp-build-img-${{matrix.os}}-cache + docker build -f $GITHUB_WORKSPACE/.github/workflows/Dockerfile.${{matrix.os}} $GITHUB_WORKSPACE -t kphp-build-img-${{matrix.os}} --cache-from=kphp-build-img-${{matrix.os}}-cache docker tag kphp-build-img-${{matrix.os}} kphp-build-img-${{matrix.os}}-cache && mkdir -p /tmp/docker-save && docker save kphp-build-img-${{matrix.os}}-cache -o /tmp/docker-save/kphp-build-env-${{matrix.os}}.tar && ls -lh /tmp/docker-save - name: Load docker image from cache @@ -85,7 +85,7 @@ jobs: - name: Start docker container run: | - docker run -dt --name kphp-build-container-${{matrix.os}} kphp-build-img-${{matrix.os}}-cache + docker run -dt --name kphp-build-container-${{matrix.os}} kphp-build-img-${{matrix.os}} docker cp $GITHUB_WORKSPACE/. kphp-build-container-${{matrix.os}}:${{env.kphp_root_dir}} - name: Add git safe directory @@ -101,40 +101,40 @@ jobs: "make -C ${{env.kphp_build_dir}} -j$(nproc) test" - name: Compile dummy PHP script - if: ${{!matrix.light_runtime}} + if: ${{matrix.light_runtime}} == off run: docker exec kphp-build-container-${{matrix.os}} bash -c "cd ${{env.kphp_build_dir}} && echo 'hello world' > demo.php && ${{env.kphp_root_dir}}/objs/bin/kphp2cpp --cxx ${{matrix.compiler}} demo.php && kphp_out/server -o --user kitten" - name: Compile dummy PHP script - if: ${{matrix.light_runtime}} + if: ${{matrix.light_runtime}} == on run: docker exec kphp-build-container-${{matrix.os}} bash -c - "cd ${{env.kphp_build_dir}} && echo 'hello world' > demo.php && ${{env.kphp_root_dir}}/objs/bin/kphp2cpp --mode k2-component --cxx ${{matrix.compiler}} demo.php" + "cd ${{env.kphp_build_dir}} && echo "${{matrix.light_runtime}}" && echo 'hello world' > demo.php && ${{env.kphp_root_dir}}/objs/bin/kphp2cpp --mode k2-component --cxx ${{matrix.compiler}} demo.php" - name: Polyfills composer install run: docker exec kphp-build-container-${{matrix.os}} bash -c "composer install -d ${{env.kphp_polyfills_dir}}" - - name: Run python tests - if: ${{!matrix.light_runtime}} - id: python_tests - continue-on-error: true - run: docker exec kphp-build-container-${{matrix.os}} bash -c - "chown -R kitten /home && su kitten -c 'GITHUB_ACTIONS=1 KPHP_TESTS_POLYFILLS_REPO=${{env.kphp_polyfills_dir}} KPHP_CXX=${{matrix.compiler}} python3.7 -m pytest --tb=native -n$(nproc) ${{env.kphp_root_dir}}/tests/python/'" - - - name: Prepare python tests artifacts - if: ${{ (steps.python_tests.outcome == 'failure') && (!matrix.light_runtime) }} - run: docker cp kphp-build-container-${{matrix.os}}:${{env.kphp_root_dir}}/tests/python/_tmp/ ${{runner.temp}} && - rm -rf ${{runner.temp}}/_tmp/*/working_dir - - - name: Upload python tests artifacts - uses: actions/upload-artifact@v3 - if: ${{ (steps.python_tests.outcome == 'failure') && (!matrix.light_runtime) }} - with: - path: ${{runner.temp}}/_tmp/ - - - name: Fail pipeline if python tests failed - if: ${{ (steps.python_tests.outcome == 'failure') && (!matrix.light_runtime) }} - run: exit 1 + # - name: Run python tests + # if: ${{!matrix.light_runtime}} + # id: python_tests + # continue-on-error: true + # run: docker exec kphp-build-container-${{matrix.os}} bash -c + # "chown -R kitten /home && su kitten -c 'GITHUB_ACTIONS=1 KPHP_TESTS_POLYFILLS_REPO=${{env.kphp_polyfills_dir}} KPHP_CXX=${{matrix.compiler}} python3.7 -m pytest --tb=native -n$(nproc) ${{env.kphp_root_dir}}/tests/python/'" + + # - name: Prepare python tests artifacts + # if: ${{ (steps.python_tests.outcome == 'failure') && (!matrix.light_runtime) }} + # run: docker cp kphp-build-container-${{matrix.os}}:${{env.kphp_root_dir}}/tests/python/_tmp/ ${{runner.temp}} && + # rm -rf ${{runner.temp}}/_tmp/*/working_dir + + # - name: Upload python tests artifacts + # uses: actions/upload-artifact@v3 + # if: ${{ (steps.python_tests.outcome == 'failure') && (!matrix.light_runtime) }} + # with: + # path: ${{runner.temp}}/_tmp/ + + # - name: Fail pipeline if python tests failed + # if: ${{ (steps.python_tests.outcome == 'failure') && (!matrix.light_runtime) }} + # run: exit 1 - name: Remove docker container run: docker rm -f kphp-build-container-${{matrix.os}} From 790db6e73cb86311d3d7335aee5aa71972431ebe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=83=D1=82=D1=8E=D0=BD=D1=8F=D0=BD=20=D0=90?= =?UTF-8?q?=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=D0=A0=D0=BE=D0=BC=D0=B0=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=D0=B8=D1=87?= Date: Wed, 17 Jul 2024 14:55:31 +0300 Subject: [PATCH 19/45] fcoroutins flag only with gcc, not with clang --- compiler/compiler-settings.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/compiler/compiler-settings.cpp b/compiler/compiler-settings.cpp index 71da41c13e..65411373e1 100644 --- a/compiler/compiler-settings.cpp +++ b/compiler/compiler-settings.cpp @@ -312,7 +312,9 @@ void CompilerSettings::init() { ss << " -std=c++17"; #elif __cplusplus <= 202002L ss << " -std=c++20"; - ss << " -fcoroutines"; + #if (defined(__GNUC__) && !defined(__clang__)) + ss << " -fcoroutines"; + #endif #else #error unsupported __cplusplus value #endif From b611b47e3dec299f47381a1be34a30c2bfd9eb86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=83=D1=82=D1=8E=D0=BD=D1=8F=D0=BD=20=D0=90?= =?UTF-8?q?=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=D0=A0=D0=BE=D0=BC=D0=B0=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=D0=B8=D1=87?= Date: Wed, 17 Jul 2024 15:20:08 +0300 Subject: [PATCH 20/45] move to gcc-11 on focal --- .github/workflows/Build.yml | 2 +- .github/workflows/Dockerfile.focal | 3 ++- cmake/init-compilation-flags.cmake | 3 +-- compiler/compiler-settings.cpp | 4 +--- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index fab9748e39..ce5d3e1b26 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -43,7 +43,7 @@ jobs: ubsan: off light_runtime: off - os: focal - compiler: g++-10 + compiler: g++-11 cpp: 20 asan: off ubsan: off diff --git a/.github/workflows/Dockerfile.focal b/.github/workflows/Dockerfile.focal index 9282166e69..76755db75e 100644 --- a/.github/workflows/Dockerfile.focal +++ b/.github/workflows/Dockerfile.focal @@ -7,6 +7,7 @@ RUN apt-get update && \ apt-get install -y --no-install-recommends apt-utils ca-certificates gnupg wget pkg-config software-properties-common && \ wget -qO /etc/apt/trusted.gpg.d/vkpartner.asc https://artifactory-external.vkpartner.ru/artifactory/api/gpg/key/public && \ wget -qO - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - && \ + add-apt-repository ppa:ubuntu-toolchain-r/test && \ echo "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-18 main" >> /etc/apt/sources.list && \ echo "deb-src http://apt.llvm.org/focal/ llvm-toolchain-focal-18 main" >> /etc/apt/sources.list && \ echo "deb https://artifactory-external.vkpartner.ru/artifactory/kphp focal main" >> /etc/apt/sources.list && \ @@ -15,7 +16,7 @@ RUN apt-get update && \ add-apt-repository ppa:deadsnakes/ppa && \ apt-get update && \ apt-get install -y --no-install-recommends \ - git cmake make clang g++ g++-10 clang-18 libclang-rt-18-dev gperf netcat \ + git cmake make clang g++ g++-10 g++-11 clang-18 libclang-rt-18-dev gperf netcat \ python3.7 python3-pip python3.7-distutils python3.7-dev libpython3.7-dev python3-jsonschema python3-setuptools mysql-server libmysqlclient-dev && \ python3.7 -m pip install pip && python3.7 -m pip install -r /tmp/requirements.txt && \ apt-get install -y --no-install-recommends curl-kphp-vk kphp-timelib libuber-h3-dev libfmt-dev libgtest-dev libgmock-dev libre2-dev libpcre3-dev \ diff --git a/cmake/init-compilation-flags.cmake b/cmake/init-compilation-flags.cmake index 0d18dff157..3d9e39fa78 100644 --- a/cmake/init-compilation-flags.cmake +++ b/cmake/init-compilation-flags.cmake @@ -10,8 +10,7 @@ if(CMAKE_CXX_COMPILER_ID MATCHES Clang) set(COMPILER_CLANG True) elseif(CMAKE_CXX_COMPILER_ID MATCHES GNU) if (COMPILE_RUNTIME_LIGHT) - check_compiler_version(gcc 10.1.0) - add_compile_options(-fcoroutines) + check_compiler_version(gcc 11.4.0) else() check_compiler_version(gcc 8.3.0) endif() diff --git a/compiler/compiler-settings.cpp b/compiler/compiler-settings.cpp index 65411373e1..1e211d14d9 100644 --- a/compiler/compiler-settings.cpp +++ b/compiler/compiler-settings.cpp @@ -312,9 +312,7 @@ void CompilerSettings::init() { ss << " -std=c++17"; #elif __cplusplus <= 202002L ss << " -std=c++20"; - #if (defined(__GNUC__) && !defined(__clang__)) - ss << " -fcoroutines"; - #endif + ss << "-Wno-unused-result -Wno-type-limits -Wno-attributes -Wno-ignored-attributes"; #else #error unsupported __cplusplus value #endif From f5a4edd6ee0e2b6621657c533db5cb15296d1397 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=83=D1=82=D1=8E=D0=BD=D1=8F=D0=BD=20=D0=90?= =?UTF-8?q?=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=D0=A0=D0=BE=D0=BC=D0=B0=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=D0=B8=D1=87?= Date: Wed, 17 Jul 2024 15:46:39 +0300 Subject: [PATCH 21/45] fix conditions --- .github/workflows/Build.yml | 4 ++-- compiler/compiler-settings.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index ce5d3e1b26..10faf67f72 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -101,12 +101,12 @@ jobs: "make -C ${{env.kphp_build_dir}} -j$(nproc) test" - name: Compile dummy PHP script - if: ${{matrix.light_runtime}} == off + if: matrix.light_runtime == 'off' run: docker exec kphp-build-container-${{matrix.os}} bash -c "cd ${{env.kphp_build_dir}} && echo 'hello world' > demo.php && ${{env.kphp_root_dir}}/objs/bin/kphp2cpp --cxx ${{matrix.compiler}} demo.php && kphp_out/server -o --user kitten" - name: Compile dummy PHP script - if: ${{matrix.light_runtime}} == on + if: matrix.light_runtime == 'on' run: docker exec kphp-build-container-${{matrix.os}} bash -c "cd ${{env.kphp_build_dir}} && echo "${{matrix.light_runtime}}" && echo 'hello world' > demo.php && ${{env.kphp_root_dir}}/objs/bin/kphp2cpp --mode k2-component --cxx ${{matrix.compiler}} demo.php" diff --git a/compiler/compiler-settings.cpp b/compiler/compiler-settings.cpp index 1e211d14d9..d19da1e18d 100644 --- a/compiler/compiler-settings.cpp +++ b/compiler/compiler-settings.cpp @@ -312,7 +312,7 @@ void CompilerSettings::init() { ss << " -std=c++17"; #elif __cplusplus <= 202002L ss << " -std=c++20"; - ss << "-Wno-unused-result -Wno-type-limits -Wno-attributes -Wno-ignored-attributes"; + ss << " -Wno-unused-result -Wno-type-limits -Wno-attributes -Wno-ignored-attributes"; #else #error unsupported __cplusplus value #endif From 8d194f1be6841c1409049fb72f183d0148a9d364 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=83=D1=82=D1=8E=D0=BD=D1=8F=D0=BD=20=D0=90?= =?UTF-8?q?=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=D0=A0=D0=BE=D0=BC=D0=B0=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=D0=B8=D1=87?= Date: Wed, 17 Jul 2024 15:46:39 +0300 Subject: [PATCH 22/45] fix conditions --- .github/workflows/Build.yml | 4 ++-- cmake/init-compilation-flags.cmake | 1 + compiler/compiler-settings.cpp | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index ce5d3e1b26..10faf67f72 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -101,12 +101,12 @@ jobs: "make -C ${{env.kphp_build_dir}} -j$(nproc) test" - name: Compile dummy PHP script - if: ${{matrix.light_runtime}} == off + if: matrix.light_runtime == 'off' run: docker exec kphp-build-container-${{matrix.os}} bash -c "cd ${{env.kphp_build_dir}} && echo 'hello world' > demo.php && ${{env.kphp_root_dir}}/objs/bin/kphp2cpp --cxx ${{matrix.compiler}} demo.php && kphp_out/server -o --user kitten" - name: Compile dummy PHP script - if: ${{matrix.light_runtime}} == on + if: matrix.light_runtime == 'on' run: docker exec kphp-build-container-${{matrix.os}} bash -c "cd ${{env.kphp_build_dir}} && echo "${{matrix.light_runtime}}" && echo 'hello world' > demo.php && ${{env.kphp_root_dir}}/objs/bin/kphp2cpp --mode k2-component --cxx ${{matrix.compiler}} demo.php" diff --git a/cmake/init-compilation-flags.cmake b/cmake/init-compilation-flags.cmake index 3d9e39fa78..0cbb1355f4 100644 --- a/cmake/init-compilation-flags.cmake +++ b/cmake/init-compilation-flags.cmake @@ -106,6 +106,7 @@ endif() add_compile_options(-Werror -Wall -Wextra -Wunused-function -Wfloat-conversion -Wno-sign-compare -Wuninitialized -Wno-redundant-move -Wno-missing-field-initializers) if(COMPILE_RUNTIME_LIGHT) + add_compile_options(-fPIC) add_compile_options(-Wno-unused-result -Wno-type-limits -Wno-attributes -Wno-ignored-attributes) add_compile_options(-Wno-vla-extension) endif() diff --git a/compiler/compiler-settings.cpp b/compiler/compiler-settings.cpp index 1e211d14d9..d19da1e18d 100644 --- a/compiler/compiler-settings.cpp +++ b/compiler/compiler-settings.cpp @@ -312,7 +312,7 @@ void CompilerSettings::init() { ss << " -std=c++17"; #elif __cplusplus <= 202002L ss << " -std=c++20"; - ss << "-Wno-unused-result -Wno-type-limits -Wno-attributes -Wno-ignored-attributes"; + ss << " -Wno-unused-result -Wno-type-limits -Wno-attributes -Wno-ignored-attributes"; #else #error unsupported __cplusplus value #endif From 6c495653ef48f8dcb040ca0f52d3161e2faeefb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=83=D1=82=D1=8E=D0=BD=D1=8F=D0=BD=20=D0=90?= =?UTF-8?q?=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=D0=A0=D0=BE=D0=BC=D0=B0=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=D0=B8=D1=87?= Date: Wed, 17 Jul 2024 16:37:59 +0300 Subject: [PATCH 23/45] try fix cache --- .github/workflows/Build.yml | 56 ++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index 10faf67f72..0131dbe5cb 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -70,24 +70,24 @@ jobs: uses: actions/cache@v1 id: docker-image-cache with: - path: /tmp/docker-save + path: /tmp/docker-save-${{matrix.os}} key: docker-save-${{matrix.os}}-${{ hashFiles('.github/workflows/Dockerfile.*', 'tests/python/requirements.txt') }} - + - name: Build and save docker image if: steps.docker-image-cache.outputs.cache-hit != 'true' run: | - docker build -f $GITHUB_WORKSPACE/.github/workflows/Dockerfile.${{matrix.os}} $GITHUB_WORKSPACE -t kphp-build-img-${{matrix.os}} --cache-from=kphp-build-img-${{matrix.os}}-cache - docker tag kphp-build-img-${{matrix.os}} kphp-build-img-${{matrix.os}}-cache && mkdir -p /tmp/docker-save && docker save kphp-build-img-${{matrix.os}}-cache -o /tmp/docker-save/kphp-build-env-${{matrix.os}}.tar && ls -lh /tmp/docker-save + docker build -f $GITHUB_WORKSPACE/.github/workflows/Dockerfile.${{matrix.os}} $GITHUB_WORKSPACE -t kphp-build-img-${{matrix.os}} --cache-from=type=local,src=kphp-build-img-${{matrix.os}}-cache + docker tag kphp-build-img-${{matrix.os}} kphp-build-img-${{matrix.os}}-cache && mkdir -p /tmp/docker-save-${{matrix.os}} && docker save kphp-build-img-${{matrix.os}}-cache -o /tmp/docker-save-${{matrix.os}}/kphp-build-env-${{matrix.os}}.tar && ls -lh /tmp/docker-save-${{matrix.os}} - name: Load docker image from cache if: steps.docker-image-cache.outputs.cache-hit == 'true' - run: docker load --input /tmp/docker-save/kphp-build-env-${{matrix.os}}.tar + run: docker load --input /tmp/docker-save-${{matrix.os}}/kphp-build-env-${{matrix.os}}.tar - name: Start docker container run: | - docker run -dt --name kphp-build-container-${{matrix.os}} kphp-build-img-${{matrix.os}} + docker run -dt --name kphp-build-container-${{matrix.os}} kphp-build-img-${{matrix.os}}-cache docker cp $GITHUB_WORKSPACE/. kphp-build-container-${{matrix.os}}:${{env.kphp_root_dir}} - + - name: Add git safe directory run: docker exec kphp-build-container-${{matrix.os}} bash -c "git config --global --add safe.directory ${{env.kphp_root_dir}}" @@ -114,27 +114,27 @@ jobs: run: docker exec kphp-build-container-${{matrix.os}} bash -c "composer install -d ${{env.kphp_polyfills_dir}}" - # - name: Run python tests - # if: ${{!matrix.light_runtime}} - # id: python_tests - # continue-on-error: true - # run: docker exec kphp-build-container-${{matrix.os}} bash -c - # "chown -R kitten /home && su kitten -c 'GITHUB_ACTIONS=1 KPHP_TESTS_POLYFILLS_REPO=${{env.kphp_polyfills_dir}} KPHP_CXX=${{matrix.compiler}} python3.7 -m pytest --tb=native -n$(nproc) ${{env.kphp_root_dir}}/tests/python/'" - - # - name: Prepare python tests artifacts - # if: ${{ (steps.python_tests.outcome == 'failure') && (!matrix.light_runtime) }} - # run: docker cp kphp-build-container-${{matrix.os}}:${{env.kphp_root_dir}}/tests/python/_tmp/ ${{runner.temp}} && - # rm -rf ${{runner.temp}}/_tmp/*/working_dir - - # - name: Upload python tests artifacts - # uses: actions/upload-artifact@v3 - # if: ${{ (steps.python_tests.outcome == 'failure') && (!matrix.light_runtime) }} - # with: - # path: ${{runner.temp}}/_tmp/ - - # - name: Fail pipeline if python tests failed - # if: ${{ (steps.python_tests.outcome == 'failure') && (!matrix.light_runtime) }} - # run: exit 1 + - name: Run python tests + if: matrix.light_runtime == 'off' + id: python_tests + continue-on-error: true + run: docker exec kphp-build-container-${{matrix.os}} bash -c + "chown -R kitten /home && su kitten -c 'GITHUB_ACTIONS=1 KPHP_TESTS_POLYFILLS_REPO=${{env.kphp_polyfills_dir}} KPHP_CXX=${{matrix.compiler}} python3.7 -m pytest --tb=native -n$(nproc) ${{env.kphp_root_dir}}/tests/python/'" + + - name: Prepare python tests artifacts + if: ${{ (steps.python_tests.outcome == 'failure') && matrix.light_runtime == 'off' }} + run: docker cp kphp-build-container-${{matrix.os}}:${{env.kphp_root_dir}}/tests/python/_tmp/ ${{runner.temp}} && + rm -rf ${{runner.temp}}/_tmp/*/working_dir + + - name: Upload python tests artifacts + uses: actions/upload-artifact@v3 + if: ${{ (steps.python_tests.outcome == 'failure') && matrix.light_runtime == 'off' }} + with: + path: ${{runner.temp}}/_tmp/ + + - name: Fail pipeline if python tests failed + if: ${{ (steps.python_tests.outcome == 'failure') && matrix.light_runtime == 'off' }} + run: exit 1 - name: Remove docker container run: docker rm -f kphp-build-container-${{matrix.os}} From bf88ac2078623e8add9f1fadf942709d5bbe4cd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=83=D1=82=D1=8E=D0=BD=D1=8F=D0=BD=20=D0=90?= =?UTF-8?q?=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=D0=A0=D0=BE=D0=BC=D0=B0=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=D0=B8=D1=87?= Date: Wed, 17 Jul 2024 17:42:41 +0300 Subject: [PATCH 24/45] light runtime fpic --- cmake/init-compilation-flags.cmake | 1 - runtime-light/runtime-light.cmake | 5 ++++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/cmake/init-compilation-flags.cmake b/cmake/init-compilation-flags.cmake index 0cbb1355f4..3d9e39fa78 100644 --- a/cmake/init-compilation-flags.cmake +++ b/cmake/init-compilation-flags.cmake @@ -106,7 +106,6 @@ endif() add_compile_options(-Werror -Wall -Wextra -Wunused-function -Wfloat-conversion -Wno-sign-compare -Wuninitialized -Wno-redundant-move -Wno-missing-field-initializers) if(COMPILE_RUNTIME_LIGHT) - add_compile_options(-fPIC) add_compile_options(-Wno-unused-result -Wno-type-limits -Wno-attributes -Wno-ignored-attributes) add_compile_options(-Wno-vla-extension) endif() diff --git a/runtime-light/runtime-light.cmake b/runtime-light/runtime-light.cmake index c8d6d1c831..37db0aa5d7 100644 --- a/runtime-light/runtime-light.cmake +++ b/runtime-light/runtime-light.cmake @@ -30,7 +30,10 @@ set_target_properties(runtime-light PROPERTIES vk_add_library(kphp-light-runtime STATIC) target_link_libraries(kphp-light-runtime PUBLIC vk::light_common vk::runtime-light vk::runtime-core) -set_target_properties(kphp-light-runtime PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${OBJS_DIR}) +set_target_properties(kphp-light-runtime PROPERTIES + ARCHIVE_OUTPUT_DIRECTORY ${OBJS_DIR} + POSITION_INDEPENDENT_CODE ON +) file(GLOB_RECURSE KPHP_RUNTIME_ALL_HEADERS RELATIVE ${BASE_DIR} From e8fd52f2fc4efaf568a195c8ec33a0120d72e14f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=83=D1=82=D1=8E=D0=BD=D1=8F=D0=BD=20=D0=90?= =?UTF-8?q?=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=D0=A0=D0=BE=D0=BC=D0=B0=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=D0=B8=D1=87?= Date: Wed, 17 Jul 2024 17:46:46 +0300 Subject: [PATCH 25/45] cleanup --- .github/workflows/Build.yml | 9 +++++++-- .github/workflows/Dockerfile.focal | 4 ++-- runtime-core/runtime-core.cmake | 1 + runtime-light/runtime-light.cmake | 5 +---- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index 0131dbe5cb..517a800a32 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -67,7 +67,7 @@ jobs: path: 'kphp-polyfills' - name: Cache docker image - uses: actions/cache@v1 + uses: actions/cache@v3 id: docker-image-cache with: path: /tmp/docker-save-${{matrix.os}} @@ -87,11 +87,16 @@ jobs: run: | docker run -dt --name kphp-build-container-${{matrix.os}} kphp-build-img-${{matrix.os}}-cache docker cp $GITHUB_WORKSPACE/. kphp-build-container-${{matrix.os}}:${{env.kphp_root_dir}} - + - name: Add git safe directory run: docker exec kphp-build-container-${{matrix.os}} bash -c "git config --global --add safe.directory ${{env.kphp_root_dir}}" + - name: Check formatting in light runtime folder + if: ${{ matrix.os == 'focal' && matrix.light_runtime == 'on' }} + run: docker exec kphp-build-container-${{matrix.os}} bash -c + "find ${{env.kphp_root_dir}}/runtime-light/ -iname '*.h' -o -iname '*.cpp' | xargs clang-format-18 -—dry-run -Werror" + - name: Build all run: docker exec kphp-build-container-${{matrix.os}} bash -c "cmake -DCMAKE_CXX_COMPILER=${{matrix.compiler}} -DCMAKE_CXX_STANDARD=${{matrix.cpp}} -DCOMPILE_RUNTIME_LIGHT=${{matrix.light_runtime}} -DADDRESS_SANITIZER=${{matrix.asan}} -DUNDEFINED_SANITIZER=${{matrix.ubsan}} -DPDO_DRIVER_MYSQL=ON -DPDO_DRIVER_PGSQL=ON -DPDO_LIBS_STATIC_LINKING=ON -S ${{env.kphp_root_dir}} -B ${{env.kphp_build_dir}} && make -C ${{env.kphp_build_dir}} -j$(nproc) all" diff --git a/.github/workflows/Dockerfile.focal b/.github/workflows/Dockerfile.focal index 76755db75e..8df13e0327 100644 --- a/.github/workflows/Dockerfile.focal +++ b/.github/workflows/Dockerfile.focal @@ -16,12 +16,12 @@ RUN apt-get update && \ add-apt-repository ppa:deadsnakes/ppa && \ apt-get update && \ apt-get install -y --no-install-recommends \ - git cmake make clang g++ g++-10 g++-11 clang-18 libclang-rt-18-dev gperf netcat \ + git cmake make clang g++ g++-10 g++-11 clang-18 libclang-rt-18-dev clang-format-18 gperf netcat \ python3.7 python3-pip python3.7-distutils python3.7-dev libpython3.7-dev python3-jsonschema python3-setuptools mysql-server libmysqlclient-dev && \ python3.7 -m pip install pip && python3.7 -m pip install -r /tmp/requirements.txt && \ apt-get install -y --no-install-recommends curl-kphp-vk kphp-timelib libuber-h3-dev libfmt-dev libgtest-dev libgmock-dev libre2-dev libpcre3-dev \ libzstd-dev libyaml-cpp-dev libnghttp2-dev zlib1g-dev php7.4-dev libldap-dev libkrb5-dev \ - postgresql postgresql-server-dev-all libnuma-dev composer unzip libstdc++6 && \ + postgresql postgresql-server-dev-all libnuma-dev composer unzip && \ rm -rf /var/lib/apt/lists/* ENV ASAN_OPTIONS=detect_leaks=0 diff --git a/runtime-core/runtime-core.cmake b/runtime-core/runtime-core.cmake index be50be3f42..b43df8dcfd 100644 --- a/runtime-core/runtime-core.cmake +++ b/runtime-core/runtime-core.cmake @@ -23,3 +23,4 @@ set(KPHP_CORE_SRC ) vk_add_library(runtime-core OBJECT ${KPHP_CORE_SRC}) +set_property(TARGET runtime-core PROPERTY POSITION_INDEPENDENT_CODE ON) \ No newline at end of file diff --git a/runtime-light/runtime-light.cmake b/runtime-light/runtime-light.cmake index 37db0aa5d7..c8d6d1c831 100644 --- a/runtime-light/runtime-light.cmake +++ b/runtime-light/runtime-light.cmake @@ -30,10 +30,7 @@ set_target_properties(runtime-light PROPERTIES vk_add_library(kphp-light-runtime STATIC) target_link_libraries(kphp-light-runtime PUBLIC vk::light_common vk::runtime-light vk::runtime-core) -set_target_properties(kphp-light-runtime PROPERTIES - ARCHIVE_OUTPUT_DIRECTORY ${OBJS_DIR} - POSITION_INDEPENDENT_CODE ON -) +set_target_properties(kphp-light-runtime PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${OBJS_DIR}) file(GLOB_RECURSE KPHP_RUNTIME_ALL_HEADERS RELATIVE ${BASE_DIR} From 32d1a2458b7d923d052ebe2183064822b3f51106 Mon Sep 17 00:00:00 2001 From: Vadim Sadokhov Date: Wed, 17 Jul 2024 18:46:13 +0300 Subject: [PATCH 26/45] format code --- runtime-light/header.h | 17 ++---- runtime-light/utils/json-functions.cpp | 66 ++++++++++-------------- runtime-light/utils/json-functions.h | 29 +++++------ runtime-light/utils/panic.h | 6 +-- runtime-light/utils/php_assert.h | 2 +- runtime-light/utils/to-array-processor.h | 4 +- 6 files changed, 53 insertions(+), 71 deletions(-) diff --git a/runtime-light/header.h b/runtime-light/header.h index 5bae9daf93..d513554a0f 100644 --- a/runtime-light/header.h +++ b/runtime-light/header.h @@ -107,8 +107,7 @@ struct PlatformCtx { * `stream_d` will be assigned `0`. * however `stream_d=0` itself is not an error marker */ - enum OpenStreamResult (*open)(size_t name_len, const char *name, - uint64_t *stream_d); + enum OpenStreamResult (*open)(size_t name_len, const char *name, uint64_t *stream_d); /* * If the write or read status is `Blocked` - then the platform ensures that * the component receives this `stream_d` via `take_update` when the status is @@ -118,8 +117,7 @@ struct PlatformCtx { * `new_status` will be assigned as * `{.read_status = 0, .write_status = 0, .please_shutdown = 0}`. */ - enum GetStatusResult (*get_stream_status)(uint64_t stream_d, - struct StreamStatus *new_status); + enum GetStatusResult (*get_stream_status)(uint64_t stream_d, struct StreamStatus *new_status); /* * Return processed bytes (written or read). * Guaranteed to return `0` if the stream is `Closed`, `Blocked` or @@ -190,8 +188,7 @@ struct PlatformCtx { * * `deadline` will be assigned `0` if `timer_d` invalid */ - enum TimerStatus (*get_timer_status)(uint64_t timer_d, - struct TimePoint *deadline); + enum TimerStatus (*get_timer_status)(uint64_t timer_d, struct TimePoint *deadline); /* * Return: `bool`. * If `True`: the update was successfully received. @@ -262,15 +259,11 @@ struct ImageInfo { }; // Every image should provide these symbols -enum PollStatus vk_k2_poll(const struct ImageState *image_state, - const struct PlatformCtx *pt_ctx, - struct ComponentState *component_ctx); +enum PollStatus vk_k2_poll(const struct ImageState *image_state, const struct PlatformCtx *pt_ctx, struct ComponentState *component_ctx); // platform_ctx without IO stuff (nullptr instead io-functions) // for now, returning nullptr will indicate error -struct ComponentState * -vk_k2_create_component_state(const struct ImageState *image_state, - const struct PlatformCtx *pt_ctx); +struct ComponentState *vk_k2_create_component_state(const struct ImageState *image_state, const struct PlatformCtx *pt_ctx); // platform_ctx without IO stuff (nullptr instead io-functions) // for now, returning nullptr will indicate error diff --git a/runtime-light/utils/json-functions.cpp b/runtime-light/utils/json-functions.cpp index 5fde8e0723..58d88c05a2 100644 --- a/runtime-light/utils/json-functions.cpp +++ b/runtime-light/utils/json-functions.cpp @@ -7,13 +7,13 @@ #include "common/algorithms/find.h" #include "runtime-light/component/component.h" // -//#include "runtime/string_functions.h" +// #include "runtime/string_functions.h" // note: json-functions.cpp is used for non-typed json implementation: for json_encode() and json_decode() // for classes, e.g. `JsonEncoder::encode(new A)`, see json-writer.cpp and from/to visitors namespace { -void json_append_one_char(unsigned int c, string_buffer & sb) noexcept { +void json_append_one_char(unsigned int c, string_buffer &sb) noexcept { sb.append_char('\\'); sb.append_char('u'); sb.append_char("0123456789abcdef"[c >> 12]); @@ -22,7 +22,7 @@ void json_append_one_char(unsigned int c, string_buffer & sb) noexcept { sb.append_char("0123456789abcdef"[c & 15]); } -bool json_append_char(unsigned int c, string_buffer & sb) noexcept { +bool json_append_char(unsigned int c, string_buffer &sb) noexcept { if (c < 0x10000) { if (0xD7FF < c && c < 0xE000) { return false; @@ -39,8 +39,7 @@ bool json_append_char(unsigned int c, string_buffer & sb) noexcept { return false; } - -bool do_json_encode_string_php(const JsonPath &json_path, const char *s, int len, int64_t options, string_buffer & sb) noexcept { +bool do_json_encode_string_php(const JsonPath &json_path, const char *s, int len, int64_t options, string_buffer &sb) noexcept { int begin_pos = sb.size(); if (options & JSON_UNESCAPED_UNICODE) { sb.reserve(2 * len + 2); @@ -178,7 +177,7 @@ string JsonPath::to_string() const { } unsigned num_parts = std::clamp(depth, 0U, static_cast(arr.size())); string result; - result.reserve_at_least((num_parts+1) * 8); + result.reserve_at_least((num_parts + 1) * 8); result.push_back('/'); for (unsigned i = 0; i < num_parts; i++) { const char *key = arr[i]; @@ -200,13 +199,12 @@ string JsonPath::to_string() const { namespace impl_ { -JsonEncoder::JsonEncoder(int64_t options, bool simple_encode, const char *json_obj_magic_key) noexcept: - options_(options), - simple_encode_(simple_encode), - json_obj_magic_key_(json_obj_magic_key) { -} +JsonEncoder::JsonEncoder(int64_t options, bool simple_encode, const char *json_obj_magic_key) noexcept + : options_(options) + , simple_encode_(simple_encode) + , json_obj_magic_key_(json_obj_magic_key) {} -bool JsonEncoder::encode(bool b, string_buffer & sb) noexcept { +bool JsonEncoder::encode(bool b, string_buffer &sb) noexcept { if (b) { sb.append("true", 4); } else { @@ -215,17 +213,17 @@ bool JsonEncoder::encode(bool b, string_buffer & sb) noexcept { return true; } -bool JsonEncoder::encode_null(string_buffer & sb) const noexcept { +bool JsonEncoder::encode_null(string_buffer &sb) const noexcept { sb.append("null", 4); return true; } -bool JsonEncoder::encode(int64_t i, string_buffer & sb) noexcept { +bool JsonEncoder::encode(int64_t i, string_buffer &sb) noexcept { sb << i; return true; } -bool JsonEncoder::encode(double d, string_buffer & sb) noexcept { +bool JsonEncoder::encode(double d, string_buffer &sb) noexcept { if (vk::any_of_equal(std::fpclassify(d), FP_INFINITE, FP_NAN)) { php_warning("%s: strange double %lf in function json_encode", json_path_.to_string().c_str(), d); if (options_ & JSON_PARTIAL_OUTPUT_ON_ERROR) { @@ -234,17 +232,17 @@ bool JsonEncoder::encode(double d, string_buffer & sb) noexcept { return false; } } else { - //todo:k2 implement f$number_format - sb << /*(simple_encode_ ? f$number_format(d, 6, string{"."}, string{}) : */ string{d}/*)*/; + // todo:k2 implement f$number_format + sb << /*(simple_encode_ ? f$number_format(d, 6, string{"."}, string{}) : */ string{d} /*)*/; } return true; } -bool JsonEncoder::encode(const string &s, string_buffer & sb) noexcept { +bool JsonEncoder::encode(const string &s, string_buffer &sb) noexcept { return do_json_encode_string_php(json_path_, s.c_str(), s.size(), options_, sb); } -bool JsonEncoder::encode(const mixed &v, string_buffer & sb) noexcept { +bool JsonEncoder::encode(const mixed &v, string_buffer &sb) noexcept { switch (v.get_type()) { case mixed::type::NUL: return encode_null(sb); @@ -280,29 +278,22 @@ bool do_json_decode(const char *s, int s_len, int &i, mixed &v, const char *json json_skip_blanks(s, i); switch (s[i]) { case 'n': - if (s[i + 1] == 'u' && - s[i + 2] == 'l' && - s[i + 3] == 'l') { + if (s[i + 1] == 'u' && s[i + 2] == 'l' && s[i + 3] == 'l') { i += 4; return true; } break; case 't': - if (s[i + 1] == 'r' && - s[i + 2] == 'u' && - s[i + 3] == 'e') { + if (s[i + 1] == 'r' && s[i + 2] == 'u' && s[i + 3] == 'e') { i += 4; - new(&v) mixed(true); + new (&v) mixed(true); return true; } break; case 'f': - if (s[i + 1] == 'a' && - s[i + 2] == 'l' && - s[i + 3] == 's' && - s[i + 4] == 'e') { + if (s[i + 1] == 'a' && s[i + 2] == 'l' && s[i + 3] == 's' && s[i + 4] == 'e') { i += 5; - new(&v) mixed(false); + new (&v) mixed(false); return true; } break; @@ -364,8 +355,7 @@ bool do_json_decode(const char *s, int s_len, int &i, mixed &v, const char *json } if (0xD7FF < num && num < 0xE000) { - if (s[i + 1] == '\\' && s[i + 2] == 'u' && - isxdigit(s[i + 3]) && isxdigit(s[i + 4]) && isxdigit(s[i + 5]) && isxdigit(s[i + 6])) { + if (s[i + 1] == '\\' && s[i + 2] == 'u' && isxdigit(s[i + 3]) && isxdigit(s[i + 4]) && isxdigit(s[i + 5]) && isxdigit(s[i + 6])) { i += 2; int u = 0; for (int t = 0; t < 4; t++) { @@ -419,7 +409,7 @@ bool do_json_decode(const char *s, int s_len, int &i, mixed &v, const char *json } value.shrink(l); - new(&v) mixed(value); + new (&v) mixed(value); i++; return true; } @@ -446,7 +436,7 @@ bool do_json_decode(const char *s, int s_len, int &i, mixed &v, const char *json i++; } - new(&v) mixed(res); + new (&v) mixed(res); return true; } case '{': { @@ -483,7 +473,7 @@ bool do_json_decode(const char *s, int s_len, int &i, mixed &v, const char *json res[string{json_obj_magic_key}] = true; } - new(&v) mixed(res); + new (&v) mixed(res); return true; } default: { @@ -495,7 +485,7 @@ bool do_json_decode(const char *s, int s_len, int &i, mixed &v, const char *json int64_t intval = 0; if (php_try_to_int(s + i, j - i, &intval)) { i = j; - new(&v) mixed(intval); + new (&v) mixed(intval); return true; } @@ -503,7 +493,7 @@ bool do_json_decode(const char *s, int s_len, int &i, mixed &v, const char *json double floatval = strtod(s + i, &end_ptr); if (end_ptr == s + j) { i = j; - new(&v) mixed(floatval); + new (&v) mixed(floatval); return true; } } diff --git a/runtime-light/utils/json-functions.h b/runtime-light/utils/json-functions.h index 15626a7e23..7805da79d9 100644 --- a/runtime-light/utils/json-functions.h +++ b/runtime-light/utils/json-functions.h @@ -9,7 +9,6 @@ #include "common/mixin/not_copyable.h" #include "runtime-core/runtime-core.h" - constexpr int64_t JSON_UNESCAPED_UNICODE = 1; constexpr int64_t JSON_FORCE_OBJECT = 16; constexpr int64_t JSON_PRETTY_PRINT = 128; // TODO: add actual support to untyped @@ -22,7 +21,7 @@ constexpr int64_t JSON_AVAILABLE_FLAGS_TYPED = JSON_PRETTY_PRINT | JSON_PRESERVE struct JsonPath { constexpr static int MAX_DEPTH = 8; - std::array arr; + std::array arr; unsigned depth = 0; void enter(const char *key) noexcept { @@ -47,31 +46,31 @@ class JsonEncoder : vk::not_copyable { public: JsonEncoder(int64_t options, bool simple_encode, const char *json_obj_magic_key = nullptr) noexcept; - //todo:k2 change static_SB everywhere to string_buffer arg - bool encode(bool b, string_buffer & sb) noexcept; - bool encode(int64_t i, string_buffer & sb) noexcept; - bool encode(const string &s, string_buffer & sb) noexcept; - bool encode(double d, string_buffer & sb) noexcept; - bool encode(const mixed &v, string_buffer & sb) noexcept; + // todo:k2 change static_SB everywhere to string_buffer arg + bool encode(bool b, string_buffer &sb) noexcept; + bool encode(int64_t i, string_buffer &sb) noexcept; + bool encode(const string &s, string_buffer &sb) noexcept; + bool encode(double d, string_buffer &sb) noexcept; + bool encode(const mixed &v, string_buffer &sb) noexcept; template - bool encode(const array &arr, string_buffer & sb) noexcept; + bool encode(const array &arr, string_buffer &sb) noexcept; template - bool encode(const Optional &opt, string_buffer & sb) noexcept; + bool encode(const Optional &opt, string_buffer &sb) noexcept; private: - bool encode_null(string_buffer & sb) const noexcept; + bool encode_null(string_buffer &sb) const noexcept; JsonPath json_path_; const int64_t options_{0}; - //todo:k2 use simple_encode + // todo:k2 use simple_encode [[maybe_unused]] const bool simple_encode_{false}; const char *json_obj_magic_key_{nullptr}; }; template -bool JsonEncoder::encode(const array &arr, string_buffer & sb) noexcept { +bool JsonEncoder::encode(const array &arr, string_buffer &sb) noexcept { bool is_vector = arr.is_vector(); const bool force_object = static_cast(JSON_FORCE_OBJECT & options_); if (!force_object && !is_vector && arr.is_pseudo_vector()) { @@ -142,7 +141,7 @@ bool JsonEncoder::encode(const array &arr, string_buffer & sb) noexcept { } template -bool JsonEncoder::encode(const Optional &opt, string_buffer & sb) noexcept { +bool JsonEncoder::encode(const Optional &opt, string_buffer &sb) noexcept { switch (opt.value_state()) { case OptionalState::has_value: return encode(opt.val(), sb); @@ -170,7 +169,7 @@ Optional f$json_encode(const T &v, int64_t options = 0, bool simple_enco return sb.c_str(); } -//todo:k2 implement string f$vk_json_encode_safe(const T &v, bool simple_encode = true) noexcept +// todo:k2 implement string f$vk_json_encode_safe(const T &v, bool simple_encode = true) noexcept template inline Optional f$vk_json_encode(const T &v) noexcept { diff --git a/runtime-light/utils/panic.h b/runtime-light/utils/panic.h index d11fbed624..7dfe5e956a 100644 --- a/runtime-light/utils/panic.h +++ b/runtime-light/utils/panic.h @@ -11,9 +11,9 @@ #include "runtime-light/utils/logs.h" inline void critical_error_handler() { - constexpr const char * message = "script panic"; - const PlatformCtx & ptx = *get_platform_context(); - ComponentState & ctx = *get_component_context(); + constexpr const char *message = "script panic"; + const PlatformCtx &ptx = *get_platform_context(); + ComponentState &ctx = *get_component_context(); ptx.log(Debug, strlen(message), message); if (ctx.not_finished()) { diff --git a/runtime-light/utils/php_assert.h b/runtime-light/utils/php_assert.h index 41d30d4f7b..81d534e5dd 100644 --- a/runtime-light/utils/php_assert.h +++ b/runtime-light/utils/php_assert.h @@ -7,7 +7,7 @@ #include #include -#include "common/wrappers/likely.h" #include "common/mixin/not_copyable.h" +#include "common/wrappers/likely.h" #include "runtime-core/utils/kphp-assert-core.h" diff --git a/runtime-light/utils/to-array-processor.h b/runtime-light/utils/to-array-processor.h index 19ac809395..47ff7ec4a2 100644 --- a/runtime-light/utils/to-array-processor.h +++ b/runtime-light/utils/to-array-processor.h @@ -86,7 +86,7 @@ class ToArrayVisitor { add_value(field_name, instance.is_null() ? mixed{} : f$to_array_debug(instance, with_class_names_)); } - template + template void process_impl(const char *field_name, const std::tuple &value) { ToArrayVisitor tuple_processor{with_class_names_}; tuple_processor.result_.reserve(sizeof...(Args), true); @@ -95,7 +95,7 @@ class ToArrayVisitor { add_value(field_name, std::move(tuple_processor).flush_result()); } - template + template void process_impl(const char *field_name, const shape, T...> &value) { ToArrayVisitor shape_processor{with_class_names_}; shape_processor.result_.reserve(sizeof...(Is), true); From 92ccc80db72e9e79c82ac111d286394086956c4e Mon Sep 17 00:00:00 2001 From: Vadim Sadokhov Date: Wed, 17 Jul 2024 18:53:04 +0300 Subject: [PATCH 27/45] remove less `-` in dry-run --- .github/workflows/Build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index 517a800a32..7b12acad0c 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -95,7 +95,7 @@ jobs: - name: Check formatting in light runtime folder if: ${{ matrix.os == 'focal' && matrix.light_runtime == 'on' }} run: docker exec kphp-build-container-${{matrix.os}} bash -c - "find ${{env.kphp_root_dir}}/runtime-light/ -iname '*.h' -o -iname '*.cpp' | xargs clang-format-18 -—dry-run -Werror" + "find ${{env.kphp_root_dir}}/runtime-light/ -iname '*.h' -o -iname '*.cpp' | xargs clang-format-18 --dry-run -Werror" - name: Build all run: docker exec kphp-build-container-${{matrix.os}} bash -c From 4675969848496e6d2033f1e58f922514ba05fe93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=83=D1=82=D1=8E=D0=BD=D1=8F=D0=BD=20=D0=90?= =?UTF-8?q?=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=D0=A0=D0=BE=D0=BC=D0=B0=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=D0=B8=D1=87?= Date: Wed, 17 Jul 2024 19:37:16 +0300 Subject: [PATCH 28/45] fix macos gh build --- .github/workflows/Build.yml | 2 +- cmake/init-compilation-flags.cmake | 2 +- runtime-core/runtime-core.cmake | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index 7b12acad0c..9828eb9005 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -170,7 +170,7 @@ jobs: brew update brew install re2c cmake coreutils openssl libiconv re2 pcre yaml-cpp zstd googletest shivammathur/php/php@7.4 brew link --overwrite --force shivammathur/php/php@7.4 - /usr/local/Frameworks/Python.framework/Versions/3.12/bin/python3.12 -m pip install --upgrade pip --break-system-packages && /usr/local/Frameworks/Python.framework/Versions/3.12/bin/pip3 install jsonschema install --break-system-packages jsonschema + /usr/local/Frameworks/Python.framework/Versions/3.12/bin/python3.12 -m pip install --upgrade pip --break-system-packages && /usr/local/Frameworks/Python.framework/Versions/3.12/bin/pip3 install --break-system-packages jsonschema - name: Run cmake run: cmake -DCMAKE_CXX_COMPILER=${{matrix.compiler}} -DCMAKE_CXX_STANDARD=${{matrix.cpp}} -DDOWNLOAD_MISSING_LIBRARIES=On -S $GITHUB_WORKSPACE -B ${{runner.workspace}}/build diff --git a/cmake/init-compilation-flags.cmake b/cmake/init-compilation-flags.cmake index 3d9e39fa78..2729df9cd3 100644 --- a/cmake/init-compilation-flags.cmake +++ b/cmake/init-compilation-flags.cmake @@ -141,4 +141,4 @@ if(COMPILE_RUNTIME_LIGHT) message(FATAL_ERROR "Compiler or libstdc++ does not support coroutines") endif() file(REMOVE "${PROJECT_BINARY_DIR}/check_coroutine_include.cpp") -endif() \ No newline at end of file +endif() diff --git a/runtime-core/runtime-core.cmake b/runtime-core/runtime-core.cmake index b43df8dcfd..c2cd5ecdb4 100644 --- a/runtime-core/runtime-core.cmake +++ b/runtime-core/runtime-core.cmake @@ -23,4 +23,4 @@ set(KPHP_CORE_SRC ) vk_add_library(runtime-core OBJECT ${KPHP_CORE_SRC}) -set_property(TARGET runtime-core PROPERTY POSITION_INDEPENDENT_CODE ON) \ No newline at end of file +set_property(TARGET runtime-core PROPERTY POSITION_INDEPENDENT_CODE ON) From 937d928b48960b888a3d10640646563ab3449b61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=83=D1=82=D1=8E=D0=BD=D1=8F=D0=BD=20=D0=90?= =?UTF-8?q?=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=D0=A0=D0=BE=D0=BC=D0=B0=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=D0=B8=D1=87?= Date: Wed, 17 Jul 2024 21:28:26 +0300 Subject: [PATCH 29/45] remove -Wno-unused-result flag --- cmake/init-compilation-flags.cmake | 2 +- common/dl-utils-lite.cpp | 9 +++++---- compiler/compiler-settings.cpp | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/cmake/init-compilation-flags.cmake b/cmake/init-compilation-flags.cmake index 2729df9cd3..268b0cda29 100644 --- a/cmake/init-compilation-flags.cmake +++ b/cmake/init-compilation-flags.cmake @@ -106,7 +106,7 @@ endif() add_compile_options(-Werror -Wall -Wextra -Wunused-function -Wfloat-conversion -Wno-sign-compare -Wuninitialized -Wno-redundant-move -Wno-missing-field-initializers) if(COMPILE_RUNTIME_LIGHT) - add_compile_options(-Wno-unused-result -Wno-type-limits -Wno-attributes -Wno-ignored-attributes) + add_compile_options(-Wno-type-limits -Wno-attributes -Wno-ignored-attributes) add_compile_options(-Wno-vla-extension) endif() diff --git a/common/dl-utils-lite.cpp b/common/dl-utils-lite.cpp index 8648274d6c..6bf9d35218 100644 --- a/common/dl-utils-lite.cpp +++ b/common/dl-utils-lite.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -49,9 +50,9 @@ double dl_time() { } void dl_print_backtrace(void **trace, int trace_size) { - write (2, "\n------- Stack Backtrace -------\n", 33); + std::ignore = write (2, "\n------- Stack Backtrace -------\n", 33); backtrace_symbols_fd (trace, trace_size, 2); - write (2, "-------------------------------\n", 32); + std::ignore = write (2, "-------------------------------\n", 32); } void dl_print_backtrace() { @@ -71,7 +72,7 @@ void dl_print_backtrace_gdb() { name_buf[res] = 0; int child_pid = fork(); if (child_pid < 0) { - write (2, "Can't fork() to run gdb\n", 24); + std::ignore = write (2, "Can't fork() to run gdb\n", 24); _exit (0); } if (!child_pid) { @@ -83,7 +84,7 @@ void dl_print_backtrace_gdb() { waitpid (child_pid, nullptr, 0); } } else { - write (2, "can't get name of executable file to pass to gdb\n", 49); + std::ignore = write (2, "can't get name of executable file to pass to gdb\n", 49); } } diff --git a/compiler/compiler-settings.cpp b/compiler/compiler-settings.cpp index d19da1e18d..abd519d677 100644 --- a/compiler/compiler-settings.cpp +++ b/compiler/compiler-settings.cpp @@ -312,7 +312,7 @@ void CompilerSettings::init() { ss << " -std=c++17"; #elif __cplusplus <= 202002L ss << " -std=c++20"; - ss << " -Wno-unused-result -Wno-type-limits -Wno-attributes -Wno-ignored-attributes"; + ss << " -Wno-type-limits -Wno-attributes -Wno-ignored-attributes"; #else #error unsupported __cplusplus value #endif From ee71a424dd6c90416fbf927a8334235eef8e0361 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=83=D1=82=D1=8E=D0=BD=D1=8F=D0=BD=20=D0=90?= =?UTF-8?q?=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=D0=A0=D0=BE=D0=BC=D0=B0=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=D0=B8=D1=87?= Date: Tue, 23 Jul 2024 04:43:18 +0300 Subject: [PATCH 30/45] revering --- .github/workflows/Build.yml | 14 +++++++------- .github/workflows/Dockerfile.focal | 1 - cmake/init-compilation-flags.cmake | 3 +-- compiler/compiler-settings.cpp | 1 - 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index 9828eb9005..f765154567 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -70,22 +70,22 @@ jobs: uses: actions/cache@v3 id: docker-image-cache with: - path: /tmp/docker-save-${{matrix.os}} - key: docker-save-${{matrix.os}}-${{ hashFiles('.github/workflows/Dockerfile.*', 'tests/python/requirements.txt') }} + path: kphp-build-env-${{matrix.os}}.tar + key: docker-image-cache-${{matrix.os}}-${{ hashFiles('.github/workflows/Dockerfile.*', 'tests/python/requirements.txt') }} - name: Build and save docker image if: steps.docker-image-cache.outputs.cache-hit != 'true' run: | - docker build -f $GITHUB_WORKSPACE/.github/workflows/Dockerfile.${{matrix.os}} $GITHUB_WORKSPACE -t kphp-build-img-${{matrix.os}} --cache-from=type=local,src=kphp-build-img-${{matrix.os}}-cache - docker tag kphp-build-img-${{matrix.os}} kphp-build-img-${{matrix.os}}-cache && mkdir -p /tmp/docker-save-${{matrix.os}} && docker save kphp-build-img-${{matrix.os}}-cache -o /tmp/docker-save-${{matrix.os}}/kphp-build-env-${{matrix.os}}.tar && ls -lh /tmp/docker-save-${{matrix.os}} + docker build -f $GITHUB_WORKSPACE/.github/workflows/Dockerfile.${{matrix.os}} $GITHUB_WORKSPACE -t kphp-build-img-${{matrix.os}} + docker save --output kphp-build-env-${{matrix.os}}.tar kphp-build-img-${{matrix.os}} - name: Load docker image from cache if: steps.docker-image-cache.outputs.cache-hit == 'true' - run: docker load --input /tmp/docker-save-${{matrix.os}}/kphp-build-env-${{matrix.os}}.tar + run: docker load --input kphp-build-env-${{matrix.os}}.tar - name: Start docker container run: | - docker run -dt --name kphp-build-container-${{matrix.os}} kphp-build-img-${{matrix.os}}-cache + docker run -dt --name kphp-build-container-${{matrix.os}} kphp-build-img-${{matrix.os}} docker cp $GITHUB_WORKSPACE/. kphp-build-container-${{matrix.os}}:${{env.kphp_root_dir}} - name: Add git safe directory @@ -170,7 +170,7 @@ jobs: brew update brew install re2c cmake coreutils openssl libiconv re2 pcre yaml-cpp zstd googletest shivammathur/php/php@7.4 brew link --overwrite --force shivammathur/php/php@7.4 - /usr/local/Frameworks/Python.framework/Versions/3.12/bin/python3.12 -m pip install --upgrade pip --break-system-packages && /usr/local/Frameworks/Python.framework/Versions/3.12/bin/pip3 install --break-system-packages jsonschema + /usr/local/Frameworks/Python.framework/Versions/3.12/bin/python3.12 -m pip install --upgrade pip --break-system-packages && /usr/local/Frameworks/Python.framework/Versions/3.12/bin/pip3 install jsonschema install --break-system-packages jsonschema - name: Run cmake run: cmake -DCMAKE_CXX_COMPILER=${{matrix.compiler}} -DCMAKE_CXX_STANDARD=${{matrix.cpp}} -DDOWNLOAD_MISSING_LIBRARIES=On -S $GITHUB_WORKSPACE -B ${{runner.workspace}}/build diff --git a/.github/workflows/Dockerfile.focal b/.github/workflows/Dockerfile.focal index 8df13e0327..ef22cdf0d4 100644 --- a/.github/workflows/Dockerfile.focal +++ b/.github/workflows/Dockerfile.focal @@ -9,7 +9,6 @@ RUN apt-get update && \ wget -qO - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - && \ add-apt-repository ppa:ubuntu-toolchain-r/test && \ echo "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-18 main" >> /etc/apt/sources.list && \ - echo "deb-src http://apt.llvm.org/focal/ llvm-toolchain-focal-18 main" >> /etc/apt/sources.list && \ echo "deb https://artifactory-external.vkpartner.ru/artifactory/kphp focal main" >> /etc/apt/sources.list && \ echo "deb http://apt.postgresql.org/pub/repos/apt focal-pgdg main" > /etc/apt/sources.list.d/pgdg.list && \ wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - && \ diff --git a/cmake/init-compilation-flags.cmake b/cmake/init-compilation-flags.cmake index 268b0cda29..d9da3ff222 100644 --- a/cmake/init-compilation-flags.cmake +++ b/cmake/init-compilation-flags.cmake @@ -106,8 +106,7 @@ endif() add_compile_options(-Werror -Wall -Wextra -Wunused-function -Wfloat-conversion -Wno-sign-compare -Wuninitialized -Wno-redundant-move -Wno-missing-field-initializers) if(COMPILE_RUNTIME_LIGHT) - add_compile_options(-Wno-type-limits -Wno-attributes -Wno-ignored-attributes) - add_compile_options(-Wno-vla-extension) + add_compile_options(-Wno-vla-cxx-extension) endif() if(NOT APPLE) diff --git a/compiler/compiler-settings.cpp b/compiler/compiler-settings.cpp index abd519d677..95f77c5735 100644 --- a/compiler/compiler-settings.cpp +++ b/compiler/compiler-settings.cpp @@ -312,7 +312,6 @@ void CompilerSettings::init() { ss << " -std=c++17"; #elif __cplusplus <= 202002L ss << " -std=c++20"; - ss << " -Wno-type-limits -Wno-attributes -Wno-ignored-attributes"; #else #error unsupported __cplusplus value #endif From 62454890793710dec87b758f35f5e43f4234771a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=83=D1=82=D1=8E=D0=BD=D1=8F=D0=BD=20=D0=90?= =?UTF-8?q?=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=D0=A0=D0=BE=D0=BC=D0=B0=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=D0=B8=D1=87?= Date: Tue, 23 Jul 2024 05:10:17 +0300 Subject: [PATCH 31/45] different flags for gcc and clang --- cmake/init-compilation-flags.cmake | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cmake/init-compilation-flags.cmake b/cmake/init-compilation-flags.cmake index d9da3ff222..8a2282084c 100644 --- a/cmake/init-compilation-flags.cmake +++ b/cmake/init-compilation-flags.cmake @@ -106,7 +106,11 @@ endif() add_compile_options(-Werror -Wall -Wextra -Wunused-function -Wfloat-conversion -Wno-sign-compare -Wuninitialized -Wno-redundant-move -Wno-missing-field-initializers) if(COMPILE_RUNTIME_LIGHT) - add_compile_options(-Wno-vla-cxx-extension) + if(COMPILER_GCC) + add_compile_options(-Wno-vla-cxx-extension) + elseif(COMPILER_CLANG) + add_compile_options(-Wvla-cxx-extension) + endif() endif() if(NOT APPLE) From 984ca27fc930398d0d2507dcd8acfed6f80549a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=83=D1=82=D1=8E=D0=BD=D1=8F=D0=BD=20=D0=90?= =?UTF-8?q?=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=D0=A0=D0=BE=D0=BC=D0=B0=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=D0=B8=D1=87?= Date: Tue, 23 Jul 2024 05:19:04 +0300 Subject: [PATCH 32/45] size_t is unsigned type --- runtime-light/stdlib/rpc/rpc-buffer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime-light/stdlib/rpc/rpc-buffer.h b/runtime-light/stdlib/rpc/rpc-buffer.h index 3d8f0b0f3e..64bb74ea0b 100644 --- a/runtime-light/stdlib/rpc/rpc-buffer.h +++ b/runtime-light/stdlib/rpc/rpc-buffer.h @@ -43,7 +43,7 @@ class RpcBuffer : private vk::not_copyable { } void reset(size_t pos) noexcept { - php_assert(pos >= 0 && pos <= size()); + php_assert(pos > 0 && pos <= size()); m_pos = pos; m_remaining = size() - m_pos; } From f0de71c4e515cecc25c853fbde001184f838e800 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=83=D1=82=D1=8E=D0=BD=D1=8F=D0=BD=20=D0=90?= =?UTF-8?q?=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=D0=A0=D0=BE=D0=BC=D0=B0=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=D0=B8=D1=87?= Date: Tue, 23 Jul 2024 06:13:32 +0300 Subject: [PATCH 33/45] allow dangling reference so tl-parser-new.cpp can be compiled --- .github/workflows/Dockerfile.focal | 2 +- cmake/init-compilation-flags.cmake | 1 + compiler/compiler-settings.cpp | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/Dockerfile.focal b/.github/workflows/Dockerfile.focal index ef22cdf0d4..02bb83d049 100644 --- a/.github/workflows/Dockerfile.focal +++ b/.github/workflows/Dockerfile.focal @@ -20,7 +20,7 @@ RUN apt-get update && \ python3.7 -m pip install pip && python3.7 -m pip install -r /tmp/requirements.txt && \ apt-get install -y --no-install-recommends curl-kphp-vk kphp-timelib libuber-h3-dev libfmt-dev libgtest-dev libgmock-dev libre2-dev libpcre3-dev \ libzstd-dev libyaml-cpp-dev libnghttp2-dev zlib1g-dev php7.4-dev libldap-dev libkrb5-dev \ - postgresql postgresql-server-dev-all libnuma-dev composer unzip && \ + postgresql postgresql-server-dev-all libnuma-dev composer unzip libstdc++-6 && \ rm -rf /var/lib/apt/lists/* ENV ASAN_OPTIONS=detect_leaks=0 diff --git a/cmake/init-compilation-flags.cmake b/cmake/init-compilation-flags.cmake index 8a2282084c..31f8de0f40 100644 --- a/cmake/init-compilation-flags.cmake +++ b/cmake/init-compilation-flags.cmake @@ -111,6 +111,7 @@ if(COMPILE_RUNTIME_LIGHT) elseif(COMPILER_CLANG) add_compile_options(-Wvla-cxx-extension) endif() + add_compile_options(-Wno-dangling-reference) endif() if(NOT APPLE) diff --git a/compiler/compiler-settings.cpp b/compiler/compiler-settings.cpp index 95f77c5735..419e0a2802 100644 --- a/compiler/compiler-settings.cpp +++ b/compiler/compiler-settings.cpp @@ -312,6 +312,7 @@ void CompilerSettings::init() { ss << " -std=c++17"; #elif __cplusplus <= 202002L ss << " -std=c++20"; + ss << " -Wno-dangling-reference"; #else #error unsupported __cplusplus value #endif From 4f2cc92bfa424b8e66e8db3e7d6a034e90fe4541 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=83=D1=82=D1=8E=D0=BD=D1=8F=D0=BD=20=D0=90?= =?UTF-8?q?=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=D0=A0=D0=BE=D0=BC=D0=B0=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=D0=B8=D1=87?= Date: Tue, 23 Jul 2024 07:23:55 +0300 Subject: [PATCH 34/45] fix --- .github/workflows/Build.yml | 12 ++++++------ .github/workflows/Dockerfile.focal | 2 +- cmake/init-compilation-flags.cmake | 8 ++------ common/dl-utils-lite.cpp | 9 ++++----- compiler/compiler-settings.cpp | 1 - runtime-light/stdlib/rpc/rpc-buffer.h | 2 +- 6 files changed, 14 insertions(+), 20 deletions(-) diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index f765154567..30c5f4b644 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -42,12 +42,12 @@ jobs: asan: on ubsan: off light_runtime: off - - os: focal - compiler: g++-11 - cpp: 20 - asan: off - ubsan: off - light_runtime: on + # - os: focal + # compiler: g++-11 + # cpp: 20 + # asan: off + # ubsan: off + # light_runtime: on - os: focal compiler: clang++-18 cpp: 20 diff --git a/.github/workflows/Dockerfile.focal b/.github/workflows/Dockerfile.focal index 02bb83d049..ef22cdf0d4 100644 --- a/.github/workflows/Dockerfile.focal +++ b/.github/workflows/Dockerfile.focal @@ -20,7 +20,7 @@ RUN apt-get update && \ python3.7 -m pip install pip && python3.7 -m pip install -r /tmp/requirements.txt && \ apt-get install -y --no-install-recommends curl-kphp-vk kphp-timelib libuber-h3-dev libfmt-dev libgtest-dev libgmock-dev libre2-dev libpcre3-dev \ libzstd-dev libyaml-cpp-dev libnghttp2-dev zlib1g-dev php7.4-dev libldap-dev libkrb5-dev \ - postgresql postgresql-server-dev-all libnuma-dev composer unzip libstdc++-6 && \ + postgresql postgresql-server-dev-all libnuma-dev composer unzip && \ rm -rf /var/lib/apt/lists/* ENV ASAN_OPTIONS=detect_leaks=0 diff --git a/cmake/init-compilation-flags.cmake b/cmake/init-compilation-flags.cmake index 31f8de0f40..1f19b42700 100644 --- a/cmake/init-compilation-flags.cmake +++ b/cmake/init-compilation-flags.cmake @@ -106,12 +106,7 @@ endif() add_compile_options(-Werror -Wall -Wextra -Wunused-function -Wfloat-conversion -Wno-sign-compare -Wuninitialized -Wno-redundant-move -Wno-missing-field-initializers) if(COMPILE_RUNTIME_LIGHT) - if(COMPILER_GCC) - add_compile_options(-Wno-vla-cxx-extension) - elseif(COMPILER_CLANG) - add_compile_options(-Wvla-cxx-extension) - endif() - add_compile_options(-Wno-dangling-reference) + add_compile_options(-Wno-vla-cxx-extension) endif() if(NOT APPLE) @@ -131,6 +126,7 @@ add_compile_options(-fdebug-prefix-map="${CMAKE_BINARY_DIR}=${CMAKE_SOURCE_DIR}" if(COMPILE_RUNTIME_LIGHT) get_directory_property(TRY_COMPILE_COMPILE_OPTIONS COMPILE_OPTIONS) string (REPLACE ";" " " TRY_COMPILE_COMPILE_OPTIONS "${TRY_COMPILE_COMPILE_OPTIONS}") + cmake_print_variables(TRY_COMPILE_COMPILE_OPTIONS) file(WRITE "${PROJECT_BINARY_DIR}/check_coroutine_include.cpp" "#include\n" "int main() {}\n") diff --git a/common/dl-utils-lite.cpp b/common/dl-utils-lite.cpp index 6bf9d35218..8648274d6c 100644 --- a/common/dl-utils-lite.cpp +++ b/common/dl-utils-lite.cpp @@ -7,7 +7,6 @@ #include #include #include -#include #include #include #include @@ -50,9 +49,9 @@ double dl_time() { } void dl_print_backtrace(void **trace, int trace_size) { - std::ignore = write (2, "\n------- Stack Backtrace -------\n", 33); + write (2, "\n------- Stack Backtrace -------\n", 33); backtrace_symbols_fd (trace, trace_size, 2); - std::ignore = write (2, "-------------------------------\n", 32); + write (2, "-------------------------------\n", 32); } void dl_print_backtrace() { @@ -72,7 +71,7 @@ void dl_print_backtrace_gdb() { name_buf[res] = 0; int child_pid = fork(); if (child_pid < 0) { - std::ignore = write (2, "Can't fork() to run gdb\n", 24); + write (2, "Can't fork() to run gdb\n", 24); _exit (0); } if (!child_pid) { @@ -84,7 +83,7 @@ void dl_print_backtrace_gdb() { waitpid (child_pid, nullptr, 0); } } else { - std::ignore = write (2, "can't get name of executable file to pass to gdb\n", 49); + write (2, "can't get name of executable file to pass to gdb\n", 49); } } diff --git a/compiler/compiler-settings.cpp b/compiler/compiler-settings.cpp index 419e0a2802..95f77c5735 100644 --- a/compiler/compiler-settings.cpp +++ b/compiler/compiler-settings.cpp @@ -312,7 +312,6 @@ void CompilerSettings::init() { ss << " -std=c++17"; #elif __cplusplus <= 202002L ss << " -std=c++20"; - ss << " -Wno-dangling-reference"; #else #error unsupported __cplusplus value #endif diff --git a/runtime-light/stdlib/rpc/rpc-buffer.h b/runtime-light/stdlib/rpc/rpc-buffer.h index 64bb74ea0b..3d8f0b0f3e 100644 --- a/runtime-light/stdlib/rpc/rpc-buffer.h +++ b/runtime-light/stdlib/rpc/rpc-buffer.h @@ -43,7 +43,7 @@ class RpcBuffer : private vk::not_copyable { } void reset(size_t pos) noexcept { - php_assert(pos > 0 && pos <= size()); + php_assert(pos >= 0 && pos <= size()); m_pos = pos; m_remaining = size() - m_pos; } From 83273c37d0e4f1fb048b306e48555a5c37434e24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=83=D1=82=D1=8E=D0=BD=D1=8F=D0=BD=20=D0=90?= =?UTF-8?q?=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=D0=A0=D0=BE=D0=BC=D0=B0=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=D0=B8=D1=87?= Date: Tue, 23 Jul 2024 09:36:50 +0300 Subject: [PATCH 35/45] ignoring return value of write --- common/dl-utils-lite.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/common/dl-utils-lite.cpp b/common/dl-utils-lite.cpp index 8648274d6c..8315eaa5b2 100644 --- a/common/dl-utils-lite.cpp +++ b/common/dl-utils-lite.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include "common/server/crash-dump.h" #include "common/stats/provider.h" @@ -49,9 +50,9 @@ double dl_time() { } void dl_print_backtrace(void **trace, int trace_size) { - write (2, "\n------- Stack Backtrace -------\n", 33); + std::ignore = write (2, "\n------- Stack Backtrace -------\n", 33); backtrace_symbols_fd (trace, trace_size, 2); - write (2, "-------------------------------\n", 32); + std::ignore = write (2, "-------------------------------\n", 32); } void dl_print_backtrace() { @@ -71,7 +72,7 @@ void dl_print_backtrace_gdb() { name_buf[res] = 0; int child_pid = fork(); if (child_pid < 0) { - write (2, "Can't fork() to run gdb\n", 24); + std::ignore = write (2, "Can't fork() to run gdb\n", 24); _exit (0); } if (!child_pid) { @@ -83,7 +84,7 @@ void dl_print_backtrace_gdb() { waitpid (child_pid, nullptr, 0); } } else { - write (2, "can't get name of executable file to pass to gdb\n", 49); + std::ignore = write (2, "can't get name of executable file to pass to gdb\n", 49); } } From 25ca5f2b4429f1065fec071bbd102231640a92ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=83=D1=82=D1=8E=D0=BD=D1=8F=D0=BD=20=D0=90?= =?UTF-8?q?=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=D0=A0=D0=BE=D0=BC=D0=B0=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=D0=B8=D1=87?= Date: Tue, 23 Jul 2024 09:37:47 +0300 Subject: [PATCH 36/45] size_t is unsigned type --- runtime-light/stdlib/rpc/rpc-buffer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime-light/stdlib/rpc/rpc-buffer.h b/runtime-light/stdlib/rpc/rpc-buffer.h index 3d8f0b0f3e..64bb74ea0b 100644 --- a/runtime-light/stdlib/rpc/rpc-buffer.h +++ b/runtime-light/stdlib/rpc/rpc-buffer.h @@ -43,7 +43,7 @@ class RpcBuffer : private vk::not_copyable { } void reset(size_t pos) noexcept { - php_assert(pos >= 0 && pos <= size()); + php_assert(pos > 0 && pos <= size()); m_pos = pos; m_remaining = size() - m_pos; } From 9ed7351484f9b20cfb1e12b471dabc326758d89e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=83=D1=82=D1=8E=D0=BD=D1=8F=D0=BD=20=D0=90?= =?UTF-8?q?=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=D0=A0=D0=BE=D0=BC=D0=B0=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=D0=B8=D1=87?= Date: Tue, 23 Jul 2024 09:41:52 +0300 Subject: [PATCH 37/45] disable warning --- cmake/init-compilation-flags.cmake | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmake/init-compilation-flags.cmake b/cmake/init-compilation-flags.cmake index 1f19b42700..0d4a37aa4e 100644 --- a/cmake/init-compilation-flags.cmake +++ b/cmake/init-compilation-flags.cmake @@ -107,6 +107,9 @@ add_compile_options(-Werror -Wall -Wextra -Wunused-function -Wfloat-conversion - -Wuninitialized -Wno-redundant-move -Wno-missing-field-initializers) if(COMPILE_RUNTIME_LIGHT) add_compile_options(-Wno-vla-cxx-extension) + if(COMPILER_GCC) + add_compile_options(-Wno-dangling-pointer) + endif() endif() if(NOT APPLE) From 882f983e49e25e3e016a781220267829545590ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=83=D1=82=D1=8E=D0=BD=D1=8F=D0=BD=20=D0=90?= =?UTF-8?q?=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=D0=A0=D0=BE=D0=BC=D0=B0=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=D0=B8=D1=87?= Date: Tue, 23 Jul 2024 09:45:19 +0300 Subject: [PATCH 38/45] turn on focal g++-11 --- .github/workflows/Build.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index 30c5f4b644..f765154567 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -42,12 +42,12 @@ jobs: asan: on ubsan: off light_runtime: off - # - os: focal - # compiler: g++-11 - # cpp: 20 - # asan: off - # ubsan: off - # light_runtime: on + - os: focal + compiler: g++-11 + cpp: 20 + asan: off + ubsan: off + light_runtime: on - os: focal compiler: clang++-18 cpp: 20 From 5630c2b38823cd31bc1ba55d73a3b77f6f070436 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=83=D1=82=D1=8E=D0=BD=D1=8F=D0=BD=20=D0=90?= =?UTF-8?q?=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=D0=A0=D0=BE=D0=BC=D0=B0=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=D0=B8=D1=87?= Date: Tue, 23 Jul 2024 10:00:26 +0300 Subject: [PATCH 39/45] fix with flag json_functions simple_encode_ --- cmake/init-compilation-flags.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/init-compilation-flags.cmake b/cmake/init-compilation-flags.cmake index 0d4a37aa4e..03c2657082 100644 --- a/cmake/init-compilation-flags.cmake +++ b/cmake/init-compilation-flags.cmake @@ -108,7 +108,7 @@ add_compile_options(-Werror -Wall -Wextra -Wunused-function -Wfloat-conversion - if(COMPILE_RUNTIME_LIGHT) add_compile_options(-Wno-vla-cxx-extension) if(COMPILER_GCC) - add_compile_options(-Wno-dangling-pointer) + add_compile_options(-Wno-dangling-pointer -Wno-attributes) endif() endif() From caa0b2b0055424253196b532d3a4469d0e1b7525 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=83=D1=82=D1=8E=D0=BD=D1=8F=D0=BD=20=D0=90?= =?UTF-8?q?=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=D0=A0=D0=BE=D0=BC=D0=B0=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=D0=B8=D1=87?= Date: Tue, 23 Jul 2024 16:53:26 +0300 Subject: [PATCH 40/45] add clang-format job --- .github/workflows/Build.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index f765154567..d5c06e7317 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -13,6 +13,17 @@ env: kphp_build_dir: /home/kitten/kphp/build jobs: + # clang-format: + # runs-on: ubuntu-latest + # steps: + # - uses: actions/checkout@v3 + # - name: Install clang-format + # run: wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - && \ + # apt-get update && apt-get install clang-format-18 + # - name: debug + # run: which clang-format-18 + # - name: Run clang-format + # run: find ./runtime-light/ -iname '*.h' -o -iname '*.cpp' | xargs clang-format-18 --dry-run -Werror build-linux: runs-on: ubuntu-latest strategy: @@ -93,6 +104,7 @@ jobs: "git config --global --add safe.directory ${{env.kphp_root_dir}}" - name: Check formatting in light runtime folder + continue-on-error: true if: ${{ matrix.os == 'focal' && matrix.light_runtime == 'on' }} run: docker exec kphp-build-container-${{matrix.os}} bash -c "find ${{env.kphp_root_dir}}/runtime-light/ -iname '*.h' -o -iname '*.cpp' | xargs clang-format-18 --dry-run -Werror" From 3138ca63e1dc15dbcfd2f7bba26b32ca42be70f1 Mon Sep 17 00:00:00 2001 From: Andrey Arutiunian Date: Wed, 28 Aug 2024 03:11:48 +0300 Subject: [PATCH 41/45] remove clang-format to different PR --- .github/workflows/Build.yml | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index d5c06e7317..3cd7be42a7 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -13,17 +13,6 @@ env: kphp_build_dir: /home/kitten/kphp/build jobs: - # clang-format: - # runs-on: ubuntu-latest - # steps: - # - uses: actions/checkout@v3 - # - name: Install clang-format - # run: wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - && \ - # apt-get update && apt-get install clang-format-18 - # - name: debug - # run: which clang-format-18 - # - name: Run clang-format - # run: find ./runtime-light/ -iname '*.h' -o -iname '*.cpp' | xargs clang-format-18 --dry-run -Werror build-linux: runs-on: ubuntu-latest strategy: From 7683a57f86a75054148c85c4c6a6029c9c140876 Mon Sep 17 00:00:00 2001 From: Andrey Arutiunian Date: Wed, 28 Aug 2024 03:28:40 +0300 Subject: [PATCH 42/45] updater --- common/dl-utils-lite.cpp | 9 ++-- runtime-light/header.h | 17 ++++-- runtime-light/stdlib/rpc/rpc-buffer.h | 2 +- runtime-light/utils/json-functions.cpp | 66 ++++++++++++++---------- runtime-light/utils/json-functions.h | 29 ++++++----- runtime-light/utils/to-array-processor.h | 4 +- 6 files changed, 72 insertions(+), 55 deletions(-) diff --git a/common/dl-utils-lite.cpp b/common/dl-utils-lite.cpp index 8315eaa5b2..8648274d6c 100644 --- a/common/dl-utils-lite.cpp +++ b/common/dl-utils-lite.cpp @@ -22,7 +22,6 @@ #include #include #include -#include #include "common/server/crash-dump.h" #include "common/stats/provider.h" @@ -50,9 +49,9 @@ double dl_time() { } void dl_print_backtrace(void **trace, int trace_size) { - std::ignore = write (2, "\n------- Stack Backtrace -------\n", 33); + write (2, "\n------- Stack Backtrace -------\n", 33); backtrace_symbols_fd (trace, trace_size, 2); - std::ignore = write (2, "-------------------------------\n", 32); + write (2, "-------------------------------\n", 32); } void dl_print_backtrace() { @@ -72,7 +71,7 @@ void dl_print_backtrace_gdb() { name_buf[res] = 0; int child_pid = fork(); if (child_pid < 0) { - std::ignore = write (2, "Can't fork() to run gdb\n", 24); + write (2, "Can't fork() to run gdb\n", 24); _exit (0); } if (!child_pid) { @@ -84,7 +83,7 @@ void dl_print_backtrace_gdb() { waitpid (child_pid, nullptr, 0); } } else { - std::ignore = write (2, "can't get name of executable file to pass to gdb\n", 49); + write (2, "can't get name of executable file to pass to gdb\n", 49); } } diff --git a/runtime-light/header.h b/runtime-light/header.h index d513554a0f..5bae9daf93 100644 --- a/runtime-light/header.h +++ b/runtime-light/header.h @@ -107,7 +107,8 @@ struct PlatformCtx { * `stream_d` will be assigned `0`. * however `stream_d=0` itself is not an error marker */ - enum OpenStreamResult (*open)(size_t name_len, const char *name, uint64_t *stream_d); + enum OpenStreamResult (*open)(size_t name_len, const char *name, + uint64_t *stream_d); /* * If the write or read status is `Blocked` - then the platform ensures that * the component receives this `stream_d` via `take_update` when the status is @@ -117,7 +118,8 @@ struct PlatformCtx { * `new_status` will be assigned as * `{.read_status = 0, .write_status = 0, .please_shutdown = 0}`. */ - enum GetStatusResult (*get_stream_status)(uint64_t stream_d, struct StreamStatus *new_status); + enum GetStatusResult (*get_stream_status)(uint64_t stream_d, + struct StreamStatus *new_status); /* * Return processed bytes (written or read). * Guaranteed to return `0` if the stream is `Closed`, `Blocked` or @@ -188,7 +190,8 @@ struct PlatformCtx { * * `deadline` will be assigned `0` if `timer_d` invalid */ - enum TimerStatus (*get_timer_status)(uint64_t timer_d, struct TimePoint *deadline); + enum TimerStatus (*get_timer_status)(uint64_t timer_d, + struct TimePoint *deadline); /* * Return: `bool`. * If `True`: the update was successfully received. @@ -259,11 +262,15 @@ struct ImageInfo { }; // Every image should provide these symbols -enum PollStatus vk_k2_poll(const struct ImageState *image_state, const struct PlatformCtx *pt_ctx, struct ComponentState *component_ctx); +enum PollStatus vk_k2_poll(const struct ImageState *image_state, + const struct PlatformCtx *pt_ctx, + struct ComponentState *component_ctx); // platform_ctx without IO stuff (nullptr instead io-functions) // for now, returning nullptr will indicate error -struct ComponentState *vk_k2_create_component_state(const struct ImageState *image_state, const struct PlatformCtx *pt_ctx); +struct ComponentState * +vk_k2_create_component_state(const struct ImageState *image_state, + const struct PlatformCtx *pt_ctx); // platform_ctx without IO stuff (nullptr instead io-functions) // for now, returning nullptr will indicate error diff --git a/runtime-light/stdlib/rpc/rpc-buffer.h b/runtime-light/stdlib/rpc/rpc-buffer.h index 64bb74ea0b..3d8f0b0f3e 100644 --- a/runtime-light/stdlib/rpc/rpc-buffer.h +++ b/runtime-light/stdlib/rpc/rpc-buffer.h @@ -43,7 +43,7 @@ class RpcBuffer : private vk::not_copyable { } void reset(size_t pos) noexcept { - php_assert(pos > 0 && pos <= size()); + php_assert(pos >= 0 && pos <= size()); m_pos = pos; m_remaining = size() - m_pos; } diff --git a/runtime-light/utils/json-functions.cpp b/runtime-light/utils/json-functions.cpp index 58d88c05a2..5fde8e0723 100644 --- a/runtime-light/utils/json-functions.cpp +++ b/runtime-light/utils/json-functions.cpp @@ -7,13 +7,13 @@ #include "common/algorithms/find.h" #include "runtime-light/component/component.h" // -// #include "runtime/string_functions.h" +//#include "runtime/string_functions.h" // note: json-functions.cpp is used for non-typed json implementation: for json_encode() and json_decode() // for classes, e.g. `JsonEncoder::encode(new A)`, see json-writer.cpp and from/to visitors namespace { -void json_append_one_char(unsigned int c, string_buffer &sb) noexcept { +void json_append_one_char(unsigned int c, string_buffer & sb) noexcept { sb.append_char('\\'); sb.append_char('u'); sb.append_char("0123456789abcdef"[c >> 12]); @@ -22,7 +22,7 @@ void json_append_one_char(unsigned int c, string_buffer &sb) noexcept { sb.append_char("0123456789abcdef"[c & 15]); } -bool json_append_char(unsigned int c, string_buffer &sb) noexcept { +bool json_append_char(unsigned int c, string_buffer & sb) noexcept { if (c < 0x10000) { if (0xD7FF < c && c < 0xE000) { return false; @@ -39,7 +39,8 @@ bool json_append_char(unsigned int c, string_buffer &sb) noexcept { return false; } -bool do_json_encode_string_php(const JsonPath &json_path, const char *s, int len, int64_t options, string_buffer &sb) noexcept { + +bool do_json_encode_string_php(const JsonPath &json_path, const char *s, int len, int64_t options, string_buffer & sb) noexcept { int begin_pos = sb.size(); if (options & JSON_UNESCAPED_UNICODE) { sb.reserve(2 * len + 2); @@ -177,7 +178,7 @@ string JsonPath::to_string() const { } unsigned num_parts = std::clamp(depth, 0U, static_cast(arr.size())); string result; - result.reserve_at_least((num_parts + 1) * 8); + result.reserve_at_least((num_parts+1) * 8); result.push_back('/'); for (unsigned i = 0; i < num_parts; i++) { const char *key = arr[i]; @@ -199,12 +200,13 @@ string JsonPath::to_string() const { namespace impl_ { -JsonEncoder::JsonEncoder(int64_t options, bool simple_encode, const char *json_obj_magic_key) noexcept - : options_(options) - , simple_encode_(simple_encode) - , json_obj_magic_key_(json_obj_magic_key) {} +JsonEncoder::JsonEncoder(int64_t options, bool simple_encode, const char *json_obj_magic_key) noexcept: + options_(options), + simple_encode_(simple_encode), + json_obj_magic_key_(json_obj_magic_key) { +} -bool JsonEncoder::encode(bool b, string_buffer &sb) noexcept { +bool JsonEncoder::encode(bool b, string_buffer & sb) noexcept { if (b) { sb.append("true", 4); } else { @@ -213,17 +215,17 @@ bool JsonEncoder::encode(bool b, string_buffer &sb) noexcept { return true; } -bool JsonEncoder::encode_null(string_buffer &sb) const noexcept { +bool JsonEncoder::encode_null(string_buffer & sb) const noexcept { sb.append("null", 4); return true; } -bool JsonEncoder::encode(int64_t i, string_buffer &sb) noexcept { +bool JsonEncoder::encode(int64_t i, string_buffer & sb) noexcept { sb << i; return true; } -bool JsonEncoder::encode(double d, string_buffer &sb) noexcept { +bool JsonEncoder::encode(double d, string_buffer & sb) noexcept { if (vk::any_of_equal(std::fpclassify(d), FP_INFINITE, FP_NAN)) { php_warning("%s: strange double %lf in function json_encode", json_path_.to_string().c_str(), d); if (options_ & JSON_PARTIAL_OUTPUT_ON_ERROR) { @@ -232,17 +234,17 @@ bool JsonEncoder::encode(double d, string_buffer &sb) noexcept { return false; } } else { - // todo:k2 implement f$number_format - sb << /*(simple_encode_ ? f$number_format(d, 6, string{"."}, string{}) : */ string{d} /*)*/; + //todo:k2 implement f$number_format + sb << /*(simple_encode_ ? f$number_format(d, 6, string{"."}, string{}) : */ string{d}/*)*/; } return true; } -bool JsonEncoder::encode(const string &s, string_buffer &sb) noexcept { +bool JsonEncoder::encode(const string &s, string_buffer & sb) noexcept { return do_json_encode_string_php(json_path_, s.c_str(), s.size(), options_, sb); } -bool JsonEncoder::encode(const mixed &v, string_buffer &sb) noexcept { +bool JsonEncoder::encode(const mixed &v, string_buffer & sb) noexcept { switch (v.get_type()) { case mixed::type::NUL: return encode_null(sb); @@ -278,22 +280,29 @@ bool do_json_decode(const char *s, int s_len, int &i, mixed &v, const char *json json_skip_blanks(s, i); switch (s[i]) { case 'n': - if (s[i + 1] == 'u' && s[i + 2] == 'l' && s[i + 3] == 'l') { + if (s[i + 1] == 'u' && + s[i + 2] == 'l' && + s[i + 3] == 'l') { i += 4; return true; } break; case 't': - if (s[i + 1] == 'r' && s[i + 2] == 'u' && s[i + 3] == 'e') { + if (s[i + 1] == 'r' && + s[i + 2] == 'u' && + s[i + 3] == 'e') { i += 4; - new (&v) mixed(true); + new(&v) mixed(true); return true; } break; case 'f': - if (s[i + 1] == 'a' && s[i + 2] == 'l' && s[i + 3] == 's' && s[i + 4] == 'e') { + if (s[i + 1] == 'a' && + s[i + 2] == 'l' && + s[i + 3] == 's' && + s[i + 4] == 'e') { i += 5; - new (&v) mixed(false); + new(&v) mixed(false); return true; } break; @@ -355,7 +364,8 @@ bool do_json_decode(const char *s, int s_len, int &i, mixed &v, const char *json } if (0xD7FF < num && num < 0xE000) { - if (s[i + 1] == '\\' && s[i + 2] == 'u' && isxdigit(s[i + 3]) && isxdigit(s[i + 4]) && isxdigit(s[i + 5]) && isxdigit(s[i + 6])) { + if (s[i + 1] == '\\' && s[i + 2] == 'u' && + isxdigit(s[i + 3]) && isxdigit(s[i + 4]) && isxdigit(s[i + 5]) && isxdigit(s[i + 6])) { i += 2; int u = 0; for (int t = 0; t < 4; t++) { @@ -409,7 +419,7 @@ bool do_json_decode(const char *s, int s_len, int &i, mixed &v, const char *json } value.shrink(l); - new (&v) mixed(value); + new(&v) mixed(value); i++; return true; } @@ -436,7 +446,7 @@ bool do_json_decode(const char *s, int s_len, int &i, mixed &v, const char *json i++; } - new (&v) mixed(res); + new(&v) mixed(res); return true; } case '{': { @@ -473,7 +483,7 @@ bool do_json_decode(const char *s, int s_len, int &i, mixed &v, const char *json res[string{json_obj_magic_key}] = true; } - new (&v) mixed(res); + new(&v) mixed(res); return true; } default: { @@ -485,7 +495,7 @@ bool do_json_decode(const char *s, int s_len, int &i, mixed &v, const char *json int64_t intval = 0; if (php_try_to_int(s + i, j - i, &intval)) { i = j; - new (&v) mixed(intval); + new(&v) mixed(intval); return true; } @@ -493,7 +503,7 @@ bool do_json_decode(const char *s, int s_len, int &i, mixed &v, const char *json double floatval = strtod(s + i, &end_ptr); if (end_ptr == s + j) { i = j; - new (&v) mixed(floatval); + new(&v) mixed(floatval); return true; } } diff --git a/runtime-light/utils/json-functions.h b/runtime-light/utils/json-functions.h index 7805da79d9..15626a7e23 100644 --- a/runtime-light/utils/json-functions.h +++ b/runtime-light/utils/json-functions.h @@ -9,6 +9,7 @@ #include "common/mixin/not_copyable.h" #include "runtime-core/runtime-core.h" + constexpr int64_t JSON_UNESCAPED_UNICODE = 1; constexpr int64_t JSON_FORCE_OBJECT = 16; constexpr int64_t JSON_PRETTY_PRINT = 128; // TODO: add actual support to untyped @@ -21,7 +22,7 @@ constexpr int64_t JSON_AVAILABLE_FLAGS_TYPED = JSON_PRETTY_PRINT | JSON_PRESERVE struct JsonPath { constexpr static int MAX_DEPTH = 8; - std::array arr; + std::array arr; unsigned depth = 0; void enter(const char *key) noexcept { @@ -46,31 +47,31 @@ class JsonEncoder : vk::not_copyable { public: JsonEncoder(int64_t options, bool simple_encode, const char *json_obj_magic_key = nullptr) noexcept; - // todo:k2 change static_SB everywhere to string_buffer arg - bool encode(bool b, string_buffer &sb) noexcept; - bool encode(int64_t i, string_buffer &sb) noexcept; - bool encode(const string &s, string_buffer &sb) noexcept; - bool encode(double d, string_buffer &sb) noexcept; - bool encode(const mixed &v, string_buffer &sb) noexcept; + //todo:k2 change static_SB everywhere to string_buffer arg + bool encode(bool b, string_buffer & sb) noexcept; + bool encode(int64_t i, string_buffer & sb) noexcept; + bool encode(const string &s, string_buffer & sb) noexcept; + bool encode(double d, string_buffer & sb) noexcept; + bool encode(const mixed &v, string_buffer & sb) noexcept; template - bool encode(const array &arr, string_buffer &sb) noexcept; + bool encode(const array &arr, string_buffer & sb) noexcept; template - bool encode(const Optional &opt, string_buffer &sb) noexcept; + bool encode(const Optional &opt, string_buffer & sb) noexcept; private: - bool encode_null(string_buffer &sb) const noexcept; + bool encode_null(string_buffer & sb) const noexcept; JsonPath json_path_; const int64_t options_{0}; - // todo:k2 use simple_encode + //todo:k2 use simple_encode [[maybe_unused]] const bool simple_encode_{false}; const char *json_obj_magic_key_{nullptr}; }; template -bool JsonEncoder::encode(const array &arr, string_buffer &sb) noexcept { +bool JsonEncoder::encode(const array &arr, string_buffer & sb) noexcept { bool is_vector = arr.is_vector(); const bool force_object = static_cast(JSON_FORCE_OBJECT & options_); if (!force_object && !is_vector && arr.is_pseudo_vector()) { @@ -141,7 +142,7 @@ bool JsonEncoder::encode(const array &arr, string_buffer &sb) noexcept { } template -bool JsonEncoder::encode(const Optional &opt, string_buffer &sb) noexcept { +bool JsonEncoder::encode(const Optional &opt, string_buffer & sb) noexcept { switch (opt.value_state()) { case OptionalState::has_value: return encode(opt.val(), sb); @@ -169,7 +170,7 @@ Optional f$json_encode(const T &v, int64_t options = 0, bool simple_enco return sb.c_str(); } -// todo:k2 implement string f$vk_json_encode_safe(const T &v, bool simple_encode = true) noexcept +//todo:k2 implement string f$vk_json_encode_safe(const T &v, bool simple_encode = true) noexcept template inline Optional f$vk_json_encode(const T &v) noexcept { diff --git a/runtime-light/utils/to-array-processor.h b/runtime-light/utils/to-array-processor.h index 47ff7ec4a2..19ac809395 100644 --- a/runtime-light/utils/to-array-processor.h +++ b/runtime-light/utils/to-array-processor.h @@ -86,7 +86,7 @@ class ToArrayVisitor { add_value(field_name, instance.is_null() ? mixed{} : f$to_array_debug(instance, with_class_names_)); } - template + template void process_impl(const char *field_name, const std::tuple &value) { ToArrayVisitor tuple_processor{with_class_names_}; tuple_processor.result_.reserve(sizeof...(Args), true); @@ -95,7 +95,7 @@ class ToArrayVisitor { add_value(field_name, std::move(tuple_processor).flush_result()); } - template + template void process_impl(const char *field_name, const shape, T...> &value) { ToArrayVisitor shape_processor{with_class_names_}; shape_processor.result_.reserve(sizeof...(Is), true); From 251a03902f8e680f4d2d717bc7f11ddf821ca6bf Mon Sep 17 00:00:00 2001 From: Andrey Arutiunian Date: Wed, 28 Aug 2024 03:30:36 +0300 Subject: [PATCH 43/45] update --- runtime-light/utils/panic.h | 6 +++--- runtime-light/utils/php_assert.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/runtime-light/utils/panic.h b/runtime-light/utils/panic.h index 7dfe5e956a..d11fbed624 100644 --- a/runtime-light/utils/panic.h +++ b/runtime-light/utils/panic.h @@ -11,9 +11,9 @@ #include "runtime-light/utils/logs.h" inline void critical_error_handler() { - constexpr const char *message = "script panic"; - const PlatformCtx &ptx = *get_platform_context(); - ComponentState &ctx = *get_component_context(); + constexpr const char * message = "script panic"; + const PlatformCtx & ptx = *get_platform_context(); + ComponentState & ctx = *get_component_context(); ptx.log(Debug, strlen(message), message); if (ctx.not_finished()) { diff --git a/runtime-light/utils/php_assert.h b/runtime-light/utils/php_assert.h index 81d534e5dd..41d30d4f7b 100644 --- a/runtime-light/utils/php_assert.h +++ b/runtime-light/utils/php_assert.h @@ -7,7 +7,7 @@ #include #include -#include "common/mixin/not_copyable.h" #include "common/wrappers/likely.h" +#include "common/mixin/not_copyable.h" #include "runtime-core/utils/kphp-assert-core.h" From 6cbbfc5b1e896015217d30037af93cf5f3877d93 Mon Sep 17 00:00:00 2001 From: Andrey Arutiunian Date: Thu, 29 Aug 2024 12:28:15 +0300 Subject: [PATCH 44/45] update --- .github/workflows/Build.yml | 6 ------ .github/workflows/Dockerfile.focal | 2 +- runtime-core/runtime-core.cmake | 3 +-- 3 files changed, 2 insertions(+), 9 deletions(-) diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index 8414fcfbc9..1f0eb687e3 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -95,12 +95,6 @@ jobs: run: docker exec kphp-build-container-${{matrix.os}} bash -c "git config --global --add safe.directory ${{env.kphp_root_dir}}" - - name: Check formatting in light runtime folder - continue-on-error: true - if: ${{ matrix.os == 'focal' && matrix.light_runtime == 'on' }} - run: docker exec kphp-build-container-${{matrix.os}} bash -c - "find ${{env.kphp_root_dir}}/runtime-light/ -iname '*.h' -o -iname '*.cpp' | xargs clang-format-18 --dry-run -Werror" - - name: Build all run: docker exec kphp-build-container-${{matrix.os}} bash -c "cmake -DCMAKE_CXX_COMPILER=${{matrix.compiler}} -DCMAKE_CXX_STANDARD=${{matrix.cpp}} -DCOMPILE_RUNTIME_LIGHT=${{matrix.light_runtime}} -DADDRESS_SANITIZER=${{matrix.asan}} -DUNDEFINED_SANITIZER=${{matrix.ubsan}} -DPDO_DRIVER_MYSQL=ON -DPDO_DRIVER_PGSQL=ON -DPDO_LIBS_STATIC_LINKING=ON -S ${{env.kphp_root_dir}} -B ${{env.kphp_build_dir}} && make -C ${{env.kphp_build_dir}} -j$(nproc) all" diff --git a/.github/workflows/Dockerfile.focal b/.github/workflows/Dockerfile.focal index ef22cdf0d4..0ecf4779dc 100644 --- a/.github/workflows/Dockerfile.focal +++ b/.github/workflows/Dockerfile.focal @@ -15,7 +15,7 @@ RUN apt-get update && \ add-apt-repository ppa:deadsnakes/ppa && \ apt-get update && \ apt-get install -y --no-install-recommends \ - git cmake make clang g++ g++-10 g++-11 clang-18 libclang-rt-18-dev clang-format-18 gperf netcat \ + git cmake make clang g++ g++-10 g++-11 clang-18 libclang-rt-18-dev gperf netcat \ python3.7 python3-pip python3.7-distutils python3.7-dev libpython3.7-dev python3-jsonschema python3-setuptools mysql-server libmysqlclient-dev && \ python3.7 -m pip install pip && python3.7 -m pip install -r /tmp/requirements.txt && \ apt-get install -y --no-install-recommends curl-kphp-vk kphp-timelib libuber-h3-dev libfmt-dev libgtest-dev libgmock-dev libre2-dev libpcre3-dev \ diff --git a/runtime-core/runtime-core.cmake b/runtime-core/runtime-core.cmake index 764298b4ce..06e00db1bc 100644 --- a/runtime-core/runtime-core.cmake +++ b/runtime-core/runtime-core.cmake @@ -30,5 +30,4 @@ endif() prepend(KPHP_CORE_SRC ${RUNTIME_CORE_DIR}/ "${KPHP_CORE_SRC}") vk_add_library(runtime-core OBJECT ${KPHP_CORE_SRC}) set_property(TARGET runtime-core PROPERTY POSITION_INDEPENDENT_CODE ON) -target_compile_options(runtime-core PUBLIC -fPIC) - +target_compile_options(runtime-core PUBLIC -fPIC) \ No newline at end of file From b5f7182ad567c05e7e37f945af10ec786c5a2113 Mon Sep 17 00:00:00 2001 From: Andrey Arutiunian Date: Thu, 29 Aug 2024 12:29:41 +0300 Subject: [PATCH 45/45] test --- .github/workflows/Build.yml | 12 ++++++------ .github/workflows/Dockerfile.focal | 4 ++-- cmake/init-compilation-flags.cmake | 4 ---- cmake/popular-common.cmake | 6 ++++-- common/dl-utils-lite.cpp | 9 +++++---- 5 files changed, 17 insertions(+), 18 deletions(-) diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index 1f0eb687e3..d00e901b23 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -18,12 +18,12 @@ jobs: strategy: matrix: include: - - os: buster - compiler: g++ - cpp: 17 - asan: off - ubsan: off - light_runtime: off + # - os: buster + # compiler: g++ + # cpp: 17 + # asan: off + # ubsan: off + # light_runtime: off - os: focal compiler: clang++ cpp: 17 diff --git a/.github/workflows/Dockerfile.focal b/.github/workflows/Dockerfile.focal index 0ecf4779dc..c2c002ffe9 100644 --- a/.github/workflows/Dockerfile.focal +++ b/.github/workflows/Dockerfile.focal @@ -16,9 +16,9 @@ RUN apt-get update && \ apt-get update && \ apt-get install -y --no-install-recommends \ git cmake make clang g++ g++-10 g++-11 clang-18 libclang-rt-18-dev gperf netcat \ - python3.7 python3-pip python3.7-distutils python3.7-dev libpython3.7-dev python3-jsonschema python3-setuptools mysql-server libmysqlclient-dev && \ + python3.7 python3-pip python3.7-distutils python3.7-dev libpython3.7-dev python3-jsonschema python3-setuptools python3-wheel mysql-server libmysqlclient-dev libc++-dev libc++abi-dev && \ python3.7 -m pip install pip && python3.7 -m pip install -r /tmp/requirements.txt && \ - apt-get install -y --no-install-recommends curl-kphp-vk kphp-timelib libuber-h3-dev libfmt-dev libgtest-dev libgmock-dev libre2-dev libpcre3-dev \ + apt-get install -y --no-install-recommends curl-kphp-vk=20240315.focal.63.build.50 kphp-timelib libuber-h3-dev libfmt-dev libgtest-dev libgmock-dev libre2-dev libpcre3-dev \ libzstd-dev libyaml-cpp-dev libnghttp2-dev zlib1g-dev php7.4-dev libldap-dev libkrb5-dev \ postgresql postgresql-server-dev-all libnuma-dev composer unzip && \ rm -rf /var/lib/apt/lists/* diff --git a/cmake/init-compilation-flags.cmake b/cmake/init-compilation-flags.cmake index c46bda904b..56ed20257d 100644 --- a/cmake/init-compilation-flags.cmake +++ b/cmake/init-compilation-flags.cmake @@ -106,10 +106,6 @@ endif() add_compile_options(-Werror -Wall -Wextra -Wunused-function -Wfloat-conversion -Wno-sign-compare -Wuninitialized -Wno-redundant-move -Wno-missing-field-initializers) if(COMPILE_RUNTIME_LIGHT) - add_compile_options(-Wno-vla-cxx-extension) - if(COMPILER_GCC) - add_compile_options(-Wno-dangling-pointer -Wno-attributes) - endif() add_compile_options(-Wno-vla-extension) endif() diff --git a/cmake/popular-common.cmake b/cmake/popular-common.cmake index 41fe692d1e..d95f1bae9b 100644 --- a/cmake/popular-common.cmake +++ b/cmake/popular-common.cmake @@ -45,8 +45,10 @@ vk_add_library(light_common OBJECT ${LIGHT_COMMON_SOURCES}) set_property(TARGET light_common PROPERTY POSITION_INDEPENDENT_CODE ON) if (COMPILE_RUNTIME_LIGHT) - target_compile_options(light_common PUBLIC -stdlib=libc++) - target_link_options(light_common PUBLIC -stdlib=libc++ -static-libstdc++) + if(CMAKE_CXX_COMPILER_ID MATCHES Clang) + target_compile_options(light_common PUBLIC -stdlib=libc++) + target_link_options(light_common PUBLIC -stdlib=libc++ -static-libstdc++) + endif() endif() vk_add_library(popular_common OBJECT ${POPULAR_COMMON_SOURCES} ${LIGHT_COMMON_SOURCES}) diff --git a/common/dl-utils-lite.cpp b/common/dl-utils-lite.cpp index 8648274d6c..8315eaa5b2 100644 --- a/common/dl-utils-lite.cpp +++ b/common/dl-utils-lite.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include "common/server/crash-dump.h" #include "common/stats/provider.h" @@ -49,9 +50,9 @@ double dl_time() { } void dl_print_backtrace(void **trace, int trace_size) { - write (2, "\n------- Stack Backtrace -------\n", 33); + std::ignore = write (2, "\n------- Stack Backtrace -------\n", 33); backtrace_symbols_fd (trace, trace_size, 2); - write (2, "-------------------------------\n", 32); + std::ignore = write (2, "-------------------------------\n", 32); } void dl_print_backtrace() { @@ -71,7 +72,7 @@ void dl_print_backtrace_gdb() { name_buf[res] = 0; int child_pid = fork(); if (child_pid < 0) { - write (2, "Can't fork() to run gdb\n", 24); + std::ignore = write (2, "Can't fork() to run gdb\n", 24); _exit (0); } if (!child_pid) { @@ -83,7 +84,7 @@ void dl_print_backtrace_gdb() { waitpid (child_pid, nullptr, 0); } } else { - write (2, "can't get name of executable file to pass to gdb\n", 49); + std::ignore = write (2, "can't get name of executable file to pass to gdb\n", 49); } }