Skip to content

Commit

Permalink
Fix github CI
Browse files Browse the repository at this point in the history
Signed-off-by: Petr Shumilov <[email protected]>
  • Loading branch information
PetrShumilov committed Jan 28, 2025
1 parent 42032b9 commit a425fd9
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 30 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/Build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ jobs:
- 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}}"
"git config --global --add safe.directory '*'"

- name: Build all
run: docker exec kphp-build-container-${{matrix.os}} bash -c
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
brew install [email protected] re2c cmake coreutils openssl libiconv re2 pcre yaml-cpp zstd googletest shivammathur/php/[email protected]
brew link --overwrite --force shivammathur/php/[email protected]
/opt/homebrew/opt/[email protected]/libexec/bin/python -m pip install --upgrade pip --break-system-packages && /opt/homebrew/opt/[email protected]/libexec/bin/pip 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

Expand Down
11 changes: 7 additions & 4 deletions cmake/utils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,15 @@ function(update_git_submodules)

# Update submodules
execute_process(
COMMAND git submodule update --init --recursive
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive
WORKING_DIRECTORY ${BASE_DIR}
RESULT_VARIABLE update_result
ERROR_QUIET
OUTPUT_VARIABLE out1
ERROR_VARIABLE err1
#ERROR_QUIET
)

message("out='${out1}'")
message("err='${err1}'")
if(NOT update_result EQUAL 0)
message(FATAL_ERROR "Failed to update Git submodules.")
endif()
Expand Down
43 changes: 22 additions & 21 deletions compiler/compiler-settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ void append_3dparty_lib(std::string &ld_flags, const std::string &path_to_3dpart
ld_flags += " " + path_to_3dparty + "lib/lib" + libname + ".a";
}

void append_curl([[maybe_unused]] std::string &cxx_flags, std::string &ld_flags, const std::string &path_to_3dparty) noexcept {
void append_curl([[maybe_unused]] std::string &cxx_flags, std::string &ld_flags, [[maybe_unused]] const std::string &path_to_3dparty) noexcept {
if (!contains_lib(ld_flags, "curl")) {
#if defined(__APPLE__)
ld_flags += " -lcurl";
Expand Down Expand Up @@ -367,7 +367,7 @@ void CompilerSettings::init() {
ld_flags.value_ = extra_ld_flags.get();
append_curl(cxx_default_flags, ld_flags.value_, third_party_path);
append_apple_options(cxx_default_flags, ld_flags.value_);
std::vector<vk::string_view> os_installed_libs{"pcre", "re2", "yaml-cpp", "h3", "z", "zstd", "nghttp2", "kphp-timelib"};
std::vector<vk::string_view> system_installed_static_libs{"pcre", "re2", "yaml-cpp", "h3", "z", "zstd", "nghttp2", "kphp-timelib"};

#ifdef KPHP_TIMELIB_LIB_DIR
ld_flags.value_ += " -L" KPHP_TIMELIB_LIB_DIR;
Expand All @@ -387,46 +387,47 @@ void CompilerSettings::init() {
ld_flags.value_ += " -L /usr/local/lib";
#endif

std::vector<vk::string_view> external_libs{"pthread", "m", "dl"};
std::vector<vk::string_view> system_installed_dynamic_libs{"pthread", "m", "dl"};

#ifdef PDO_DRIVER_MYSQL
#ifdef PDO_LIBS_STATIC_LINKING
os_installed_libs.emplace_back("mysqlclient");
system_installed_static_libs.emplace_back("mysqlclient");
#else
external_libs.emplace_back("mysqlclient");
system_installed_dynamic_libs.emplace_back("mysqlclient");
#endif
#endif

#ifdef PDO_DRIVER_PGSQL
#ifdef PDO_LIBS_STATIC_LINKING
ld_flags.value_ += fmt_format(" -L /usr/lib/postgresql/{}/lib/ ", PDO_DRIVER_PGSQL_VERSION);
os_installed_libs.emplace_back("pq");
os_installed_libs.emplace_back("pgcommon");
os_installed_libs.emplace_back("pgport");
system_installed_static_libs.emplace_back("pq");
system_installed_static_libs.emplace_back("pgcommon");
system_installed_static_libs.emplace_back("pgport");
// following common libraries are required for libpq.a
external_libs.emplace_back("ldap");
external_libs.emplace_back("gssapi_krb5");
system_installed_dynamic_libs.emplace_back("ldap");
system_installed_dynamic_libs.emplace_back("gssapi_krb5");
#else
external_libs.emplace_back("pq");
system_installed_dynamic_libs.emplace_back("pq");
#endif
#endif

append_3dparty_headers(cxx_default_flags, third_party_path, "openssl");
append_3dparty_lib(ld_flags.value_, third_party_path, "ssl");
append_3dparty_lib(ld_flags.value_, third_party_path, "crypto");

#if defined(__APPLE__)
append_if_doesnt_contain(ld_flags.value_, os_installed_libs, "-l");
append_if_doesnt_contain(ld_flags.value_, system_installed_static_libs, "-l");
auto flex_prefix = kphp_src_path.value_ + "objs/flex/lib";
append_if_doesnt_contain(ld_flags.value_, vk::to_array({"vk-flex-data"}), flex_prefix, ".a");
external_libs.emplace_back("iconv");
system_installed_dynamic_libs.emplace_back("iconv");
#else
append_3dparty_lib(ld_flags.value_, third_party_path, "vk-flex-data");
os_installed_libs.emplace_back("numa");
append_if_doesnt_contain(ld_flags.value_, os_installed_libs, "-l:lib", ".a");
external_libs.emplace_back("rt");
system_installed_static_libs.emplace_back("numa");
append_if_doesnt_contain(ld_flags.value_, system_installed_static_libs, "-l:lib", ".a");
system_installed_dynamic_libs.emplace_back("rt");
#endif
append_if_doesnt_contain(ld_flags.value_, external_libs, "-l");

append_3dparty_headers(cxx_default_flags, third_party_path, "openssl");
append_3dparty_lib(ld_flags.value_, third_party_path, "ssl");
append_3dparty_lib(ld_flags.value_, third_party_path, "crypto");

append_if_doesnt_contain(ld_flags.value_, system_installed_dynamic_libs, "-l");
ld_flags.value_ += " -rdynamic";

runtime_headers.value_ = "runtime-headers.h";
Expand Down
2 changes: 1 addition & 1 deletion runtime/runtime.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ target_link_libraries(kphp-full-runtime PUBLIC ${RUNTIME_LIBS})
set_target_properties(kphp-full-runtime PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${OBJS_DIR})

prepare_cross_platform_libs(RUNTIME_LINK_TEST_LIBS pcre nghttp2 kphp-timelib)
set(RUNTIME_LINK_TEST_LIBS vk::flex_data_static CURL::curl OpenSSL::SSL ${NUMA_LIB} ${RUNTIME_LINK_TEST_LIBS} ${EPOLL_SHIM_LIB} ${ICONV_LIB} ${RT_LIB})
set(RUNTIME_LINK_TEST_LIBS vk::flex_data_static CURL::curl OpenSSL::SSL ${NUMA_LIB} ${RUNTIME_LINK_TEST_LIBS} ${EPOLL_SHIM_LIB} ${ICONV_LIB} ${RT_LIB} dl)

if (PDO_DRIVER_MYSQL)
list(APPEND RUNTIME_LINK_TEST_LIBS mysqlclient)
Expand Down
13 changes: 11 additions & 2 deletions third-party/curl-cmake/curl.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
execute_process(
COMMAND ${GIT_EXECUTABLE} submodule update --remote third-party/curl
WORKING_DIRECTORY ${BASE_DIR}
)

set(CURL_INSTALL_DIR ${CMAKE_BINARY_DIR}/third-party/curl)
file(MAKE_DIRECTORY ${CURL_INSTALL_DIR})

set(CURL_COMPILE_FLAGS "-Wno-deprecated-declarations")
if(COMPILER_CLANG)
set(CURL_COMPILE_FLAGS "${CURL_COMPILE_FLAGS} -Wno-string-plus-int")
endif()

ExternalProject_Add(
curl
SOURCE_DIR ${THIRD_PARTY_DIR}/curl
Expand All @@ -21,8 +31,7 @@ ExternalProject_Add(
-DCMAKE_INSTALL_PREFIX=${CURL_INSTALL_DIR}
-DCMAKE_INSTALL_LIBDIR=${CURL_INSTALL_DIR}/lib/
-DCMAKE_INSTALL_INCLUDEDIR=${CURL_INSTALL_DIR}/include
-DCMAKE_CXX_FLAGS="-Wno-deprecated-declarations"
-DCMAKE_C_FLAGS="-Wno-deprecated-declarations"
-DCMAKE_C_FLAGS=${CURL_COMPILE_FLAGS}
BUILD_COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIG>
INSTALL_COMMAND
${CMAKE_COMMAND} --install . --config $<CONFIG> &&
Expand Down
5 changes: 5 additions & 0 deletions third-party/openssl-cmake/openssl.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
execute_process(
COMMAND ${GIT_EXECUTABLE} submodule update --remote third-party/openssl
WORKING_DIRECTORY ${BASE_DIR}
)

set(OPENSSL_INSTALL_DIR ${CMAKE_BINARY_DIR}/third-party/openssl)
file(MAKE_DIRECTORY ${OPENSSL_INSTALL_DIR})

Expand Down

0 comments on commit a425fd9

Please sign in to comment.