Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix musl build #1701

Merged
merged 2 commits into from
Aug 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1078,9 +1078,15 @@ OPTION(ENABLE_BYTERANGE "Enable byte-range access to remote datasets.." OFF)
# Check for the math library so it can be explicitly linked.
IF(NOT WIN32)
FIND_LIBRARY(HAVE_LIBM NAMES math m libm)
MESSAGE(STATUS "Found Math library: ${HAVE_LIBM}")
IF(NOT HAVE_LIBM)
MESSAGE(FATAL_ERROR "Unable to find the math library.")
CHECK_FUNCTION_EXISTS(exp HAVE_LIBM_FUNC)
IF(NOT HAVE_LIBM_FUNC)
MESSAGE(FATAL_ERROR "Unable to find the math library.")
ELSE(NOT HAVE_LIBM_FUNC)
SET(HAVE_LIBM "")
ENDIF()
ELSE(NOT HAVE_LIBM)
MESSAGE(STATUS "Found Math library: ${HAVE_LIBM}")
ENDIF()
ENDIF()

Expand Down
3 changes: 3 additions & 0 deletions config.h.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,9 @@ with zip */
/* if true, HDF5 is at least version 1.10.5 and supports UTF8 paths */
#cmakedefine HDF5_UTF8_PATHS 1

/* if true, backtrace support will be used. */
#cmakedefine HAVE_EXECINFO_H 1

/* if true, include JNA bug fix */
#cmakedefine JNA 1

Expand Down
6 changes: 5 additions & 1 deletion libhdf5/hdf5debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "config.h"
#include <stdarg.h>
#include <stdio.h>
#if !defined _WIN32 && !defined __CYGWIN__
#ifdef HAVE_EXECINFO_H
#include <execinfo.h>
#endif

Expand All @@ -15,15 +15,18 @@

#define STSIZE 1000

#ifdef HAVE_EXECINFO_H
#ifdef H5BACKTRACE
# if !defined _WIN32 && !defined __CYGWIN__
static void* stacktrace[STSIZE];
# endif
#endif
#endif

int
nch5breakpoint(int err)
{
#ifdef HAVE_EXECINFO_H
#ifdef H5BACKTRACE
# if !defined _WIN32 && !defined __CYGWIN__
int count = 0;
Expand All @@ -39,6 +42,7 @@ nch5breakpoint(int err)
if(trace != NULL) free(trace);
# endif
# endif
#endif
#endif
return err;
}
Expand Down
5 changes: 3 additions & 2 deletions libsrc/posixio.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <stdint.h>

#ifdef HAVE_FCNTL_H
#include <fcntl.h>
Expand Down Expand Up @@ -120,7 +121,7 @@ static off_t nc_get_filelen(const int fd) {
off_t flen;

#ifdef HAVE_FILE_LENGTH_I64
__int64 file_len = 0;
int64_t file_len = 0;
if ((file_len = _filelengthi64(fd)) < 0) {
return file_len;
}
Expand Down Expand Up @@ -1829,7 +1830,7 @@ ncio_px_filesize(ncio *nciop, off_t *filesizep)
Use _filelengthi64 isntead. */
#ifdef HAVE_FILE_LENGTH_I64

__int64 file_len = 0;
int64_t file_len = 0;
if( (file_len = _filelengthi64(nciop->fd)) < 0) {
return errno;
}
Expand Down