From a448a544676c0e69a82fcf78162817e6cb9a0921 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, 21 Mar 2024 11:40:54 +0300 Subject: [PATCH 1/3] init --- .github/workflows/Build.yml | 30 ++++++++++++++--------------- .github/workflows/Dockerfile.buster | 12 ++++++++++-- cmake/init-compilation-flags.cmake | 3 +++ common/common-tests.cmake | 2 +- compiler/compiler.cmake | 2 +- net/net-tests.cmake | 2 +- runtime/runtime.cmake | 2 +- 7 files changed, 32 insertions(+), 21 deletions(-) diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index d3c8d31e5f..01740aa89b 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -18,21 +18,21 @@ jobs: strategy: matrix: include: - - os: buster - compiler: g++ - cpp: 17 - asan: off - ubsan: off - - os: focal - compiler: clang++ - cpp: 17 - asan: off - ubsan: on - - os: focal - compiler: g++-10 - cpp: 20 - asan: on - ubsan: off + # - os: buster + # compiler: g++ + # cpp: 17 + # asan: off + # ubsan: off + # - os: focal + # compiler: clang++ + # cpp: 17 + # asan: off + # ubsan: on + # - os: focal + # compiler: g++-10 + # cpp: 20 + # asan: on + # ubsan: off - os: jammy compiler: g++ cpp: 20 diff --git a/.github/workflows/Dockerfile.buster b/.github/workflows/Dockerfile.buster index 09f667fd8d..d2782ea8e6 100644 --- a/.github/workflows/Dockerfile.buster +++ b/.github/workflows/Dockerfile.buster @@ -24,8 +24,16 @@ RUN apt-get update && \ 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 perl && \ rm -rf /var/lib/apt/lists/* && \ - update-alternatives --set php /usr/bin/php7.4 + update-alternatives --set php /usr/bin/php7.4 && \ + apt remove openssl && \ + wget --no-check-certificate https://www.openssl.org/source/openssl-3.0.2.tar.gz && \ + tar -xvzf openssl-3.0.2.tar.gz && \ + cd openssl-3.0.2 && \ + chmod +x ./config && \ + ./Configure && \ + make && make test && make install && \ + ldconfig /usr/local/lib64/ RUN useradd -ms /bin/bash kitten diff --git a/cmake/init-compilation-flags.cmake b/cmake/init-compilation-flags.cmake index a9c8cf6fe4..16528f4cdd 100644 --- a/cmake/init-compilation-flags.cmake +++ b/cmake/init-compilation-flags.cmake @@ -35,6 +35,9 @@ endif() set(OPENSSL_USE_STATIC_LIBS TRUE) find_package(OpenSSL REQUIRED) include_directories(${OPENSSL_INCLUDE_DIR}) +# include_directories(/usr/local/include) +# link_directories(/usr/local/lib64) +cmake_print_variables(OPENSSL_VERSION) option(ADDRESS_SANITIZER "Enable address sanitizer") if(ADDRESS_SANITIZER) diff --git a/common/common-tests.cmake b/common/common-tests.cmake index ae0985dea2..237a23980c 100644 --- a/common/common-tests.cmake +++ b/common/common-tests.cmake @@ -19,5 +19,5 @@ prepend(COMMON_TESTS_SOURCES ${COMMON_DIR}/ wrappers/string_view-test.cpp) prepare_cross_platform_libs(COMMON_TESTS_LIBS zstd) -set(COMMON_TESTS_LIBS vk::common_src vk::net_src vk::binlog_src vk::unicode ${COMMON_TESTS_LIBS} ${EPOLL_SHIM_LIB} OpenSSL::Crypto z) +set(COMMON_TESTS_LIBS vk::common_src vk::net_src vk::binlog_src vk::unicode ${COMMON_TESTS_LIBS} ${EPOLL_SHIM_LIB} z) vk_add_unittest(common "${COMMON_TESTS_LIBS}" ${COMMON_TESTS_SOURCES}) diff --git a/compiler/compiler.cmake b/compiler/compiler.cmake index 636aaaa6d6..a7db24e333 100644 --- a/compiler/compiler.cmake +++ b/compiler/compiler.cmake @@ -265,7 +265,7 @@ add_executable(kphp2cpp ${KPHP_COMPILER_DIR}/kphp2cpp.cpp) target_include_directories(kphp2cpp PUBLIC ${KPHP_COMPILER_DIR}) prepare_cross_platform_libs(COMPILER_LIBS yaml-cpp re2) -set(COMPILER_LIBS vk::kphp2cpp_src vk::tlo_parsing_src vk::popular_common ${COMPILER_LIBS} fmt::fmt OpenSSL::Crypto pthread) +set(COMPILER_LIBS vk::kphp2cpp_src vk::tlo_parsing_src vk::popular_common ${COMPILER_LIBS} fmt::fmt pthread) if(NOT APPLE) list(APPEND COMPILER_LIBS stdc++fs) endif() diff --git a/net/net-tests.cmake b/net/net-tests.cmake index da3089def7..b9828d9d41 100644 --- a/net/net-tests.cmake +++ b/net/net-tests.cmake @@ -5,5 +5,5 @@ prepend(NET_TESTS_SOURCES ${BASE_DIR}/net/ time-slice-test.cpp) prepare_cross_platform_libs(NET_TESTS_LIBS zstd) -set(NET_TESTS_LIBS vk::common_src vk::net_src vk::binlog_src vk::unicode ${NET_TESTS_LIBS} ${EPOLL_SHIM_LIB} OpenSSL::Crypto z) +set(NET_TESTS_LIBS vk::common_src vk::net_src vk::binlog_src vk::unicode ${NET_TESTS_LIBS} ${EPOLL_SHIM_LIB} z) vk_add_unittest(net "${NET_TESTS_LIBS}" ${NET_TESTS_SOURCES}) diff --git a/runtime/runtime.cmake b/runtime/runtime.cmake index f7e0ab8222..fac3c31d88 100644 --- a/runtime/runtime.cmake +++ b/runtime/runtime.cmake @@ -147,7 +147,7 @@ target_include_directories(kphp_runtime PUBLIC ${BASE_DIR} /opt/curl7600/include add_dependencies(kphp_runtime kphp-timelib) prepare_cross_platform_libs(RUNTIME_LIBS yaml-cpp re2 zstd h3) # todo: linking between static libs is no-op, is this redundant? do we need to add mysqlclient here? -set(RUNTIME_LIBS vk::kphp_runtime vk::kphp_server vk::popular_common vk::unicode vk::common_src vk::binlog_src vk::net_src ${RUNTIME_LIBS} OpenSSL::Crypto m z pthread) +set(RUNTIME_LIBS vk::kphp_runtime vk::kphp_server vk::popular_common vk::unicode vk::common_src vk::binlog_src vk::net_src ${RUNTIME_LIBS} m z pthread) vk_add_library(kphp-full-runtime STATIC) target_link_libraries(kphp-full-runtime PUBLIC ${RUNTIME_LIBS}) set_target_properties(kphp-full-runtime PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${OBJS_DIR}) From 2f6a2a40b8b34e34924ddd959c89771eaadc0f39 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, 3 Apr 2024 09:35:42 +0300 Subject: [PATCH 2/3] update --- .github/workflows/Build.yml | 10 +++++----- .github/workflows/Dockerfile.buster | 3 +-- cmake/init-compilation-flags.cmake | 7 ++++--- common/common-tests.cmake | 2 +- compiler/compiler.cmake | 2 +- net/net-tests.cmake | 2 +- runtime/runtime.cmake | 2 +- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index 01740aa89b..8fcd88cfbe 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -18,11 +18,11 @@ jobs: strategy: matrix: include: - # - os: buster - # compiler: g++ - # cpp: 17 - # asan: off - # ubsan: off + - os: buster + compiler: g++ + cpp: 17 + asan: off + ubsan: off # - os: focal # compiler: clang++ # cpp: 17 diff --git a/.github/workflows/Dockerfile.buster b/.github/workflows/Dockerfile.buster index d2782ea8e6..6a8ce9a444 100644 --- a/.github/workflows/Dockerfile.buster +++ b/.github/workflows/Dockerfile.buster @@ -27,13 +27,12 @@ RUN apt-get update && \ postgresql postgresql-server-dev-all libnuma-dev composer perl && \ rm -rf /var/lib/apt/lists/* && \ update-alternatives --set php /usr/bin/php7.4 && \ - apt remove openssl && \ wget --no-check-certificate https://www.openssl.org/source/openssl-3.0.2.tar.gz && \ tar -xvzf openssl-3.0.2.tar.gz && \ cd openssl-3.0.2 && \ chmod +x ./config && \ ./Configure && \ - make && make test && make install && \ + make -j$(nproc) && make -j$(nproc) install && \ ldconfig /usr/local/lib64/ RUN useradd -ms /bin/bash kitten diff --git a/cmake/init-compilation-flags.cmake b/cmake/init-compilation-flags.cmake index 16528f4cdd..a0e60c7a67 100644 --- a/cmake/init-compilation-flags.cmake +++ b/cmake/init-compilation-flags.cmake @@ -32,12 +32,13 @@ else() add_link_options(-fno-lto) endif() +if(LINUX) + set(OPENSSL_ROOT_DIR "/usr/local") + set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS TRUE) +endif() set(OPENSSL_USE_STATIC_LIBS TRUE) find_package(OpenSSL REQUIRED) include_directories(${OPENSSL_INCLUDE_DIR}) -# include_directories(/usr/local/include) -# link_directories(/usr/local/lib64) -cmake_print_variables(OPENSSL_VERSION) option(ADDRESS_SANITIZER "Enable address sanitizer") if(ADDRESS_SANITIZER) diff --git a/common/common-tests.cmake b/common/common-tests.cmake index 237a23980c..ae0985dea2 100644 --- a/common/common-tests.cmake +++ b/common/common-tests.cmake @@ -19,5 +19,5 @@ prepend(COMMON_TESTS_SOURCES ${COMMON_DIR}/ wrappers/string_view-test.cpp) prepare_cross_platform_libs(COMMON_TESTS_LIBS zstd) -set(COMMON_TESTS_LIBS vk::common_src vk::net_src vk::binlog_src vk::unicode ${COMMON_TESTS_LIBS} ${EPOLL_SHIM_LIB} z) +set(COMMON_TESTS_LIBS vk::common_src vk::net_src vk::binlog_src vk::unicode ${COMMON_TESTS_LIBS} ${EPOLL_SHIM_LIB} OpenSSL::Crypto z) vk_add_unittest(common "${COMMON_TESTS_LIBS}" ${COMMON_TESTS_SOURCES}) diff --git a/compiler/compiler.cmake b/compiler/compiler.cmake index a7db24e333..636aaaa6d6 100644 --- a/compiler/compiler.cmake +++ b/compiler/compiler.cmake @@ -265,7 +265,7 @@ add_executable(kphp2cpp ${KPHP_COMPILER_DIR}/kphp2cpp.cpp) target_include_directories(kphp2cpp PUBLIC ${KPHP_COMPILER_DIR}) prepare_cross_platform_libs(COMPILER_LIBS yaml-cpp re2) -set(COMPILER_LIBS vk::kphp2cpp_src vk::tlo_parsing_src vk::popular_common ${COMPILER_LIBS} fmt::fmt pthread) +set(COMPILER_LIBS vk::kphp2cpp_src vk::tlo_parsing_src vk::popular_common ${COMPILER_LIBS} fmt::fmt OpenSSL::Crypto pthread) if(NOT APPLE) list(APPEND COMPILER_LIBS stdc++fs) endif() diff --git a/net/net-tests.cmake b/net/net-tests.cmake index b9828d9d41..da3089def7 100644 --- a/net/net-tests.cmake +++ b/net/net-tests.cmake @@ -5,5 +5,5 @@ prepend(NET_TESTS_SOURCES ${BASE_DIR}/net/ time-slice-test.cpp) prepare_cross_platform_libs(NET_TESTS_LIBS zstd) -set(NET_TESTS_LIBS vk::common_src vk::net_src vk::binlog_src vk::unicode ${NET_TESTS_LIBS} ${EPOLL_SHIM_LIB} z) +set(NET_TESTS_LIBS vk::common_src vk::net_src vk::binlog_src vk::unicode ${NET_TESTS_LIBS} ${EPOLL_SHIM_LIB} OpenSSL::Crypto z) vk_add_unittest(net "${NET_TESTS_LIBS}" ${NET_TESTS_SOURCES}) diff --git a/runtime/runtime.cmake b/runtime/runtime.cmake index fac3c31d88..f7e0ab8222 100644 --- a/runtime/runtime.cmake +++ b/runtime/runtime.cmake @@ -147,7 +147,7 @@ target_include_directories(kphp_runtime PUBLIC ${BASE_DIR} /opt/curl7600/include add_dependencies(kphp_runtime kphp-timelib) prepare_cross_platform_libs(RUNTIME_LIBS yaml-cpp re2 zstd h3) # todo: linking between static libs is no-op, is this redundant? do we need to add mysqlclient here? -set(RUNTIME_LIBS vk::kphp_runtime vk::kphp_server vk::popular_common vk::unicode vk::common_src vk::binlog_src vk::net_src ${RUNTIME_LIBS} m z pthread) +set(RUNTIME_LIBS vk::kphp_runtime vk::kphp_server vk::popular_common vk::unicode vk::common_src vk::binlog_src vk::net_src ${RUNTIME_LIBS} OpenSSL::Crypto m z pthread) vk_add_library(kphp-full-runtime STATIC) target_link_libraries(kphp-full-runtime PUBLIC ${RUNTIME_LIBS}) set_target_properties(kphp-full-runtime PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${OBJS_DIR}) From a9d35d5ce45addfeb53e2aac0d487c04231606f6 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, 3 Apr 2024 11:46:12 +0300 Subject: [PATCH 3/3] reduce changes --- .github/workflows/Dockerfile.buster | 5 ++--- cmake/init-compilation-flags.cmake | 5 +++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/Dockerfile.buster b/.github/workflows/Dockerfile.buster index 6a8ce9a444..e2000d64f9 100644 --- a/.github/workflows/Dockerfile.buster +++ b/.github/workflows/Dockerfile.buster @@ -31,8 +31,7 @@ RUN apt-get update && \ tar -xvzf openssl-3.0.2.tar.gz && \ cd openssl-3.0.2 && \ chmod +x ./config && \ - ./Configure && \ - make -j$(nproc) && make -j$(nproc) install && \ - ldconfig /usr/local/lib64/ + ./config --prefix="/usr/local/" && \ + make -j$(nproc) && make install RUN useradd -ms /bin/bash kitten diff --git a/cmake/init-compilation-flags.cmake b/cmake/init-compilation-flags.cmake index a0e60c7a67..57563a906f 100644 --- a/cmake/init-compilation-flags.cmake +++ b/cmake/init-compilation-flags.cmake @@ -32,9 +32,10 @@ else() add_link_options(-fno-lto) endif() -if(LINUX) - set(OPENSSL_ROOT_DIR "/usr/local") +if(NOT APPLE) + set(OPENSSL_ROOT_DIR "/usr/local/" CACHE INTERNAL "") set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS TRUE) + # set(CMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX=64) endif() set(OPENSSL_USE_STATIC_LIBS TRUE) find_package(OpenSSL REQUIRED)