SSL_get0_group_name not found when reading hdf5 file in C

61 Views Asked by At

I try to read and print a weight matrix stored in an hdf5 file but can't get my following simple C code running. I use CLion as an IDE, build my code with make and clang using CMake and MinGW as a Toolset.

#include <stdio.h>
#include <cblas.h>
#include <hdf5.h>

#define FILENAME "src/model/model_weights.hdf5"
#define ROWS 3
#define COLS 3

void print_matrix(const char *name, double *matrix, int rows, int cols) {
    printf("%s:\n", name);
    for (int i = 0; i < rows; ++i) {
        for (int j = 0; j < cols; ++j) {
            printf("%f\t", matrix[i * cols + j]);
        }
        printf("\n");
    }
    printf("\n");
}


int main(void){
    hid_t file_id, dataset_id, dataspace_id;
    herr_t status;
    double data[10];

    file_id = H5Fopen("model_weights.hdf5", H5F_ACC_RDONLY, H5P_DEFAULT);

    // Open dataset
    dataset_id = H5Dopen2(file_id, "/dataset_name", H5P_DEFAULT);

    // Read dataset
    status = H5Dread(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, data);

    // Close dataset
    status = H5Dclose(dataset_id);

    // Close file
    status = H5Fclose(file_id);

    print_matrix("data", data, ROWS, COLS);
    return 0;
}

My CMakeLists.txt file looks like this:

cmake_minimum_required(VERSION 3.27)

set(LIB_DIR "C:/msys64/mingw64/lib")
set(MODEL_DIR "N:/Project_1/src/models")
set(CMAKE_C_STANDARD 23)

project(Project_1 C)

find_package(OpenBLAS REQUIRED)
find_package(HDF5 REQUIRED COMPONENTS C)
find_package(CURL REQUIRED)

include_directories(${HDF5_INCLUDE_DIRS})
include_directories(${LIB_DIR})
include_directories(${MODEL_DIR})

add_executable(Project_1 src/main.c)

find_library(OPENBLAS_LIBRARY NAMES openblas PATHS ${LIB_DIR})
find_library(HDF5_LIBRARY NAMES hdf5 PATHS ${LIB_DIR})
find_library(CURL_LIBRARY NAMES libcurl PATHS ${LIB_DIR})

if(NOT OPENBLAS_LIBRARY)
    message(FATAL_ERROR "OpenBLAS library not found ${CMAKE_SYSTEM_LIBRARY_PATH}")
endif()

target_include_directories(Project_1 PRIVATE ${HDF5_INCLUDE_DIRS})
target_link_libraries(Project_1 OpenBLAS::OpenBLAS)
target_link_libraries(Project_1 ${HDF5_C_LIBRARIES})

I get the following error after building and running the exe:

The procedure entry point "SSL_get0_group_name" was not found in the DLL "C:\msys64\mingw64\bin\libcurl-4.dll".

Like you can see I also tried to add curl to my CMake file. Reinstalling curl-4 using pacman in mingw-w64 couldn't solve the issue as well. Is the SSL entry point stored in the libcurl-4.dll at all or do I have to reinstall my openssl here? Can you explain me why this entry point is relevant at all here?

0

There are 0 best solutions below