Skip to content

Commit 5ccb71d

Browse files
authored
Merge pull request #1701 from magnusuMET/bugfix/musl_build
fix musl build
2 parents b03988e + 5ec5007 commit 5ccb71d

File tree

4 files changed

+19
-5
lines changed

4 files changed

+19
-5
lines changed

Diff for: CMakeLists.txt

+8-2
Original file line numberDiff line numberDiff line change
@@ -1078,9 +1078,15 @@ OPTION(ENABLE_BYTERANGE "Enable byte-range access to remote datasets.." OFF)
10781078
# Check for the math library so it can be explicitly linked.
10791079
IF(NOT WIN32)
10801080
FIND_LIBRARY(HAVE_LIBM NAMES math m libm)
1081-
MESSAGE(STATUS "Found Math library: ${HAVE_LIBM}")
10821081
IF(NOT HAVE_LIBM)
1083-
MESSAGE(FATAL_ERROR "Unable to find the math library.")
1082+
CHECK_FUNCTION_EXISTS(exp HAVE_LIBM_FUNC)
1083+
IF(NOT HAVE_LIBM_FUNC)
1084+
MESSAGE(FATAL_ERROR "Unable to find the math library.")
1085+
ELSE(NOT HAVE_LIBM_FUNC)
1086+
SET(HAVE_LIBM "")
1087+
ENDIF()
1088+
ELSE(NOT HAVE_LIBM)
1089+
MESSAGE(STATUS "Found Math library: ${HAVE_LIBM}")
10841090
ENDIF()
10851091
ENDIF()
10861092

Diff for: config.h.cmake.in

+3
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,9 @@ with zip */
441441
/* if true, HDF5 is at least version 1.10.5 and supports UTF8 paths */
442442
#cmakedefine HDF5_UTF8_PATHS 1
443443

444+
/* if true, backtrace support will be used. */
445+
#cmakedefine HAVE_EXECINFO_H 1
446+
444447
/* if true, include JNA bug fix */
445448
#cmakedefine JNA 1
446449

Diff for: libhdf5/hdf5debug.c

+5-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#include "config.h"
66
#include <stdarg.h>
77
#include <stdio.h>
8-
#if !defined _WIN32 && !defined __CYGWIN__
8+
#ifdef HAVE_EXECINFO_H
99
#include <execinfo.h>
1010
#endif
1111

@@ -15,15 +15,18 @@
1515

1616
#define STSIZE 1000
1717

18+
#ifdef HAVE_EXECINFO_H
1819
#ifdef H5BACKTRACE
1920
# if !defined _WIN32 && !defined __CYGWIN__
2021
static void* stacktrace[STSIZE];
2122
# endif
2223
#endif
24+
#endif
2325

2426
int
2527
nch5breakpoint(int err)
2628
{
29+
#ifdef HAVE_EXECINFO_H
2730
#ifdef H5BACKTRACE
2831
# if !defined _WIN32 && !defined __CYGWIN__
2932
int count = 0;
@@ -39,6 +42,7 @@ nch5breakpoint(int err)
3942
if(trace != NULL) free(trace);
4043
# endif
4144
# endif
45+
#endif
4246
#endif
4347
return err;
4448
}

Diff for: libsrc/posixio.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <stdlib.h>
1616
#include <errno.h>
1717
#include <string.h>
18+
#include <stdint.h>
1819

1920
#ifdef HAVE_FCNTL_H
2021
#include <fcntl.h>
@@ -120,7 +121,7 @@ static off_t nc_get_filelen(const int fd) {
120121
off_t flen;
121122

122123
#ifdef HAVE_FILE_LENGTH_I64
123-
__int64 file_len = 0;
124+
int64_t file_len = 0;
124125
if ((file_len = _filelengthi64(fd)) < 0) {
125126
return file_len;
126127
}
@@ -1829,7 +1830,7 @@ ncio_px_filesize(ncio *nciop, off_t *filesizep)
18291830
Use _filelengthi64 isntead. */
18301831
#ifdef HAVE_FILE_LENGTH_I64
18311832

1832-
__int64 file_len = 0;
1833+
int64_t file_len = 0;
18331834
if( (file_len = _filelengthi64(nciop->fd)) < 0) {
18341835
return errno;
18351836
}

0 commit comments

Comments
 (0)