From ead44269d8adaaef6269832e1e01d956e9115ca5 Mon Sep 17 00:00:00 2001 From: Marko Budiselic Date: Sat, 24 Aug 2024 14:42:52 +0200 Subject: [PATCH 01/10] Fix all OS builds --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 63a3d01..10542db 100644 --- a/README.md +++ b/README.md @@ -123,7 +123,7 @@ To build and install mgclient from source on Windows you will need: to understand versioning in a bit more details): VS >= 17 2022, MSVC >= 14.34, C >= 19.34 -### Windows Compiler +### Windows Compiler (FIX) ``` mkdir build From b21f520f285c25362df4af9f1dc04b3a7ee52945 Mon Sep 17 00:00:00 2001 From: Marko Budiselic Date: Sat, 24 Aug 2024 14:46:39 +0200 Subject: [PATCH 02/10] Move to macos-14 --- .github/workflows/ci.yml | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6aa0187..5d85a25 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,7 +18,7 @@ jobs: build_and_test_apple: strategy: matrix: - platform: [macos-11] + platform: [macos-14] runs-on: ${{ matrix.platform }} env: MG_VERSION: "1.4.0" diff --git a/README.md b/README.md index 10542db..63a3d01 100644 --- a/README.md +++ b/README.md @@ -123,7 +123,7 @@ To build and install mgclient from source on Windows you will need: to understand versioning in a bit more details): VS >= 17 2022, MSVC >= 14.34, C >= 19.34 -### Windows Compiler (FIX) +### Windows Compiler ``` mkdir build From be5c7b7e7fe3cc82c6460b92c3216e0ac4ee0f04 Mon Sep 17 00:00:00 2001 From: Marko Budiselic Date: Sat, 24 Aug 2024 14:57:14 +0200 Subject: [PATCH 03/10] Try 1 to fix the mac build --- include/mgclient.h | 10 +++++----- src/apple/mgsocket.c | 8 +++----- src/linux/mgsocket.c | 8 +++----- src/mgclient.c | 10 +++++----- src/mgsocket.h | 6 +++--- src/mgtransport.c | 4 +--- src/mgvalue.c | 3 +-- 7 files changed, 21 insertions(+), 28 deletions(-) diff --git a/include/mgclient.h b/include/mgclient.h index b916a6c..0c20ce4 100644 --- a/include/mgclient.h +++ b/include/mgclient.h @@ -137,17 +137,17 @@ extern "C" { /// Client software version. /// /// \return Client version in the major.minor.patch format. -MGCLIENT_EXPORT const char *mg_client_version(); +MGCLIENT_EXPORT const char *mg_client_version(void); /// Initializes the client (the whole process). /// Should be called at the beginning of each process using the client. /// /// \return Zero if initialization was successful. -MGCLIENT_EXPORT int mg_init(); +MGCLIENT_EXPORT int mg_init(void); /// Finalizes the client (the whole process). /// Should be called at the end of each process using the client. -MGCLIENT_EXPORT void mg_finalize(); +MGCLIENT_EXPORT void mg_finalize(void); /// An enum listing all the types as specified by Bolt protocol. enum mg_value_type { @@ -297,7 +297,7 @@ typedef struct mg_point_3d mg_point_3d; /// Constructs a nil \ref mg_value. /// /// \return Pointer to the newly constructed value or NULL if error occurred. -MGCLIENT_EXPORT mg_value *mg_value_make_null(); +MGCLIENT_EXPORT mg_value *mg_value_make_null(void); /// Constructs a boolean \ref mg_value. /// @@ -1221,7 +1221,7 @@ typedef int (*mg_trust_callback_type)(const char *, const char *, const char *, const char *, void *); /// Creates a new `mg_session_params` object. -MGCLIENT_EXPORT mg_session_params *mg_session_params_make(); +MGCLIENT_EXPORT mg_session_params *mg_session_params_make(void); /// Destroys a `mg_session_params` object. MGCLIENT_EXPORT void mg_session_params_destroy(mg_session_params *); diff --git a/src/apple/mgsocket.c b/src/apple/mgsocket.c index 0805879..680177c 100644 --- a/src/apple/mgsocket.c +++ b/src/apple/mgsocket.c @@ -16,8 +16,6 @@ #include -#include "mgcommon.h" - #define MG_RETRY_ON_EINTR(expression) \ __extension__({ \ long result; \ @@ -27,7 +25,7 @@ result; \ }) -int mg_socket_init() { return MG_SUCCESS; } +int mg_socket_init(void) { return MG_SUCCESS; } int mg_socket_create(int af, int type, int protocol) { int sockfd = socket(af, type, protocol); @@ -92,6 +90,6 @@ int mg_socket_pair(int d, int type, int protocol, int *sv) { int mg_socket_close(int sock) { return MG_RETRY_ON_EINTR(close(sock)); } -char *mg_socket_error() { return strerror(errno); } +char *mg_socket_error(void) { return strerror(errno); } -void mg_socket_finalize() {} +void mg_socket_finalize(void) {} diff --git a/src/linux/mgsocket.c b/src/linux/mgsocket.c index d7ba7db..6adefd4 100644 --- a/src/linux/mgsocket.c +++ b/src/linux/mgsocket.c @@ -17,8 +17,6 @@ #include #include -#include "mgcommon.h" - #ifdef __EMSCRIPTEN__ #include "emscripten.h" #include "mgwasm.h" @@ -36,7 +34,7 @@ // Please refer to https://man7.org/linux/man-pages/man2 for more details about // Linux system calls. -int mg_socket_init() { return MG_SUCCESS; } +int mg_socket_init(void) { return MG_SUCCESS; } int mg_socket_create(int af, int type, int protocol) { int sockfd = socket(af, type, protocol); @@ -151,6 +149,6 @@ int mg_socket_pair(int d, int type, int protocol, int *sv) { int mg_socket_close(int sock) { return MG_RETRY_ON_EINTR(close(sock)); } -char *mg_socket_error() { return strerror(errno); } +char *mg_socket_error(void) { return strerror(errno); } -void mg_socket_finalize() {} +void mg_socket_finalize(void) {} diff --git a/src/mgclient.c b/src/mgclient.c index df661f7..58d8284 100644 --- a/src/mgclient.c +++ b/src/mgclient.c @@ -29,9 +29,9 @@ #include "mgtransport.h" #include "mgvalue.h" -const char *mg_client_version() { return MGCLIENT_VERSION; } +const char *mg_client_version(void) { return MGCLIENT_VERSION; } -int mg_init_session_static_vars() { +int mg_init_session_static_vars(void) { mg_value *n_val = mg_value_make_integer(-1); if (!n_val) { goto fatal_failure; @@ -55,13 +55,13 @@ int mg_init_session_static_vars() { return MG_ERROR_CLIENT_ERROR; } -int mg_init() { +int mg_init(void) { int init_status = mg_init_session_static_vars(); if (init_status != 0) return init_status; return mg_socket_init(); } -void mg_finalize() { mg_socket_finalize(); } +void mg_finalize(void) { mg_socket_finalize(); } typedef struct mg_session_params { const char *address; @@ -78,7 +78,7 @@ typedef struct mg_session_params { void *trust_data; } mg_session_params; -mg_session_params *mg_session_params_make() { +mg_session_params *mg_session_params_make(void) { mg_session_params *params = mg_allocator_malloc(&mg_system_allocator, sizeof(mg_session_params)); if (!params) { diff --git a/src/mgsocket.h b/src/mgsocket.h index 14c3b7e..96143a8 100644 --- a/src/mgsocket.h +++ b/src/mgsocket.h @@ -54,7 +54,7 @@ typedef long ssize_t; /// Initializes underlying resources. Has to be called at the beginning of a /// process using socket resources. -int mg_socket_init(); +int mg_socket_init(void); /// Returns a descriptor referencing the new socket or MG_ERROR_SOCKET in the /// case of any failure. @@ -110,11 +110,11 @@ int mg_socket_close(int sock); /// Used to get a native error message after some socket call fails. /// Has to be called immediately after the failed socket function. -char *mg_socket_error(); +char *mg_socket_error(void); /// Should be called at the end of any process which previously called the /// \ref mg_socket_init function. -void mg_socket_finalize(); +void mg_socket_finalize(void); #ifdef __cplusplus } diff --git a/src/mgtransport.c b/src/mgtransport.c index 03980af..a134970 100644 --- a/src/mgtransport.c +++ b/src/mgtransport.c @@ -15,7 +15,6 @@ #include "mgtransport.h" #include -#include #include #include #ifdef MGCLIENT_ON_LINUX @@ -26,7 +25,6 @@ #include "mgallocator.h" #include "mgclient.h" -#include "mgcommon.h" #include "mgsocket.h" #ifdef __EMSCRIPTEN__ #include "mgwasm.h" @@ -160,7 +158,7 @@ static char *hex_encode(unsigned char *data, unsigned int len, return encoded; } -static void mg_openssl_init() { +static void mg_openssl_init(void) { #if OPENSSL_VERSION_NUMBER < 0x10100000L static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; static int mg_ssl_initialized = 0; diff --git a/src/mgvalue.c b/src/mgvalue.c index 54002f4..183bf93 100644 --- a/src/mgvalue.c +++ b/src/mgvalue.c @@ -19,7 +19,6 @@ #include "mgallocator.h" #include "mgclient.h" -#include "mgconstants.h" mg_string *mg_string_alloc(uint32_t size, mg_allocator *allocator) { char *block = mg_allocator_malloc(allocator, sizeof(mg_string) + size); @@ -178,7 +177,7 @@ mg_point_3d *mg_point_3d_alloc(mg_allocator *allocator) { return point_3d; } -mg_value *mg_value_make_null() { +mg_value *mg_value_make_null(void) { mg_value *value = mg_allocator_malloc(&mg_system_allocator, sizeof(mg_value)); if (!value) { return NULL; From ebe12cb39c90bb72d303e86433d5f3661e0068cb Mon Sep 17 00:00:00 2001 From: Marko Budiselic Date: Sat, 24 Aug 2024 15:04:41 +0200 Subject: [PATCH 04/10] Try 1 to fix the linux build --- .github/workflows/ci.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5d85a25..c06ef19 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,8 +20,6 @@ jobs: matrix: platform: [macos-14] runs-on: ${{ matrix.platform }} - env: - MG_VERSION: "1.4.0" steps: - name: Set-up repository uses: actions/checkout@v2 @@ -78,8 +76,8 @@ jobs: build_and_test_linux: strategy: matrix: - platform: [ubuntu-20.04, ubuntu-22.04] - mgversion: ["2.0.0", "2.3.0"] + platform: [ubuntu-24.04] + mgversion: ["2.19.0"] packages: ["gcc g++ clang"] gcc-postfix: [""] clang-postfix: [""] From 108e3e3c0d196c1f96ca0bc1b636887054016293 Mon Sep 17 00:00:00 2001 From: Marko Budiselic Date: Sat, 24 Aug 2024 15:07:25 +0200 Subject: [PATCH 05/10] Try 2 to fix the linux build --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c06ef19..23970d8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -98,7 +98,7 @@ jobs: if: steps.cache-memgraph-docker.outputs.cache-hit != 'true' run: | mkdir ~/memgraph - curl -L https://memgraph.com/download/memgraph/v${{ matrix.mgversion }}/docker/memgraph-${{ matrix.mgversion }}-docker.tar.gz > ~/memgraph/memgraph-docker.tar.gz + curl -L https://download.memgraph.com/memgraph/v${{ matrix.mgversion }}/docker/memgraph-${{ matrix.mgversion }}-docker.tar.gz > ~/memgraph/memgraph-docker.tar.gz - name: Load and run Memgraph Docker image run: | docker load -i ~/memgraph/memgraph-docker.tar.gz From 4339a332dcca1a497857846bfae9353e2eaa968e Mon Sep 17 00:00:00 2001 From: Marko Budiselic Date: Sat, 24 Aug 2024 15:08:58 +0200 Subject: [PATCH 06/10] Try 3 to fix the linux build --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 23970d8..2506b08 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -102,7 +102,7 @@ jobs: - name: Load and run Memgraph Docker image run: | docker load -i ~/memgraph/memgraph-docker.tar.gz - docker run -d -p 7687:7687 memgraph --telemetry-enabled=false + docker run -d -p 7687:7687 memgraph/memgraph --telemetry-enabled=false - name: Build with gcc, test and install mgclient run: | mkdir build-gcc && cd build-gcc From 88991ef9c97470c513fef70c34568958389d2f57 Mon Sep 17 00:00:00 2001 From: Marko Budiselic Date: Sat, 24 Aug 2024 15:12:25 +0200 Subject: [PATCH 07/10] Try 1 to upgrade WASM build OS --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2506b08..cb4e815 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -165,7 +165,7 @@ jobs: build_and_test_linux_wasm: strategy: matrix: - platform: [ubuntu-20.04] + platform: [ubuntu-24.04] runs-on: ${{ matrix.platform }} steps: - name: Set-up repository From c963fbe143b59346ac45ffaec9df97183dde8a98 Mon Sep 17 00:00:00 2001 From: Marko Budiselic Date: Sat, 24 Aug 2024 15:14:36 +0200 Subject: [PATCH 08/10] Try 1 to fix the windows build --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cb4e815..1d4eb40 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,7 +40,7 @@ jobs: fail-fast: false matrix: include: - - os: windows-2019 + - os: windows-2022 env: VCPKG_ROOT: "${{ github.workspace }}\\vcpkg" deps: "openssl:x64-windows" From 8b672d0c81391425201360ac1787241668a68610 Mon Sep 17 00:00:00 2001 From: Marko Budiselic Date: Sat, 24 Aug 2024 15:21:05 +0200 Subject: [PATCH 09/10] Try 1 to upgrade mingw --- .github/workflows/ci.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1d4eb40..e243e33 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -126,11 +126,11 @@ jobs: # Memgraph has to be started manually because systemd is not available on # WSL (init process does not exist). build_and_test_windows_mingw: - runs-on: windows-2019 + runs-on: windows-2022 strategy: matrix: include: [ - { msystem: MINGW64, arch: x86_64, mgversion: "1.4.0" } + { msystem: MINGW64, arch: x86_64, mgversion: "2.19.0" } ] defaults: run: @@ -145,13 +145,14 @@ jobs: install: git base-devel mingw-w64-${{ matrix.arch }}-toolchain mingw-w64-${{ matrix.arch }}-cmake mingw-w64-${{ matrix.arch }}-openssl - uses: Vampire/setup-wsl@v1 with: - distribution: Ubuntu-18.04 + distribution: Ubuntu-22.04 - name: Download, install and run Memgraph under WSL shell: wsl-bash {0} # root shell run: | mkdir ~/memgraph - curl -L https://download.memgraph.com/memgraph/v${{matrix.mgversion}}/ubuntu-18.04/memgraph_${{matrix.mgversion}}-community-1_amd64.deb --output ~/memgraph/memgraph-community.deb - dpkg -i ~/memgraph/memgraph-community.deb + # https://download.memgraph.com/memgraph/v2.19.0/ubuntu-24.04/memgraph_2.19.0-1_amd64.deb + curl -L https://download.memgraph.com/memgraph/v${{matrix.mgversion}}/ubuntu-22.04/memgraph_${{matrix.mgversion}}-1_amd64.deb --output ~/memgraph/memgraph.deb + dpkg -i ~/memgraph/memgraph.deb nohup /usr/lib/memgraph/memgraph --bolt-port 7687 --bolt-cert-file="" --bolt-key-file="" --data-directory="~/memgraph/data" --storage-properties-on-edges=true --storage-snapshot-interval-sec=0 --storage-wal-enabled=false --storage-recover-on-startup=false --storage-snapshot-on-exit=false --telemetry-enabled=false --log-file='' & sleep 1 # Wait for Memgraph a bit. - name: Build and test mgclient From 0ba5a74ef95ea1226d0a1ad906b8ad3f22ba6b6d Mon Sep 17 00:00:00 2001 From: Marko Budiselic Date: Sat, 24 Aug 2024 15:36:15 +0200 Subject: [PATCH 10/10] Try 2 to upgrade to mingw --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e243e33..b18b49b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -153,7 +153,7 @@ jobs: # https://download.memgraph.com/memgraph/v2.19.0/ubuntu-24.04/memgraph_2.19.0-1_amd64.deb curl -L https://download.memgraph.com/memgraph/v${{matrix.mgversion}}/ubuntu-22.04/memgraph_${{matrix.mgversion}}-1_amd64.deb --output ~/memgraph/memgraph.deb dpkg -i ~/memgraph/memgraph.deb - nohup /usr/lib/memgraph/memgraph --bolt-port 7687 --bolt-cert-file="" --bolt-key-file="" --data-directory="~/memgraph/data" --storage-properties-on-edges=true --storage-snapshot-interval-sec=0 --storage-wal-enabled=false --storage-recover-on-startup=false --storage-snapshot-on-exit=false --telemetry-enabled=false --log-file='' & + nohup /usr/lib/memgraph/memgraph --bolt-port 7687 --bolt-cert-file="" --bolt-key-file="" --data-directory="~/memgraph/data" --storage-properties-on-edges=true --storage-snapshot-interval-sec=0 --storage-wal-enabled=false --data-recovery-on-startup=false --storage-snapshot-on-exit=false --telemetry-enabled=false --log-file='' & sleep 1 # Wait for Memgraph a bit. - name: Build and test mgclient run: |