Skip to content

Commit e16d78b

Browse files
committed
fix musl build
1 parent 525ab4c commit e16d78b

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

Diff for: CMakeLists.txt

+9-2
Original file line numberDiff line numberDiff line change
@@ -876,9 +876,15 @@ ENDIF()
876876
# Check for the math library so it can be explicitly linked.
877877
IF(NOT WIN32)
878878
FIND_LIBRARY(HAVE_LIBM NAMES math m libm)
879-
MESSAGE(STATUS "Found Math library: ${HAVE_LIBM}")
880879
IF(NOT HAVE_LIBM)
881-
MESSAGE(FATAL_ERROR "Unable to find the math library.")
880+
CHECK_FUNCTION_EXISTS(exp HAVE_LIBM_FUNC)
881+
IF(NOT HAVE_LIBM_FUNC)
882+
MESSAGE(FATAL_ERROR "Unable to find the math library.")
883+
ELSE(NOT HAVE_LIBM_FUNC)
884+
SET(HAVE_LIBM "")
885+
ENDIF()
886+
ELSE(NOT HAVE_LIBM)
887+
MESSAGE(STATUS "Found Math library: ${HAVE_LIBM}")
882888
ENDIF()
883889
ENDIF()
884890

@@ -1313,6 +1319,7 @@ CHECK_INCLUDE_FILE("string.h" HAVE_STRING_H)
13131319
CHECK_INCLUDE_FILE("winsock2.h" HAVE_WINSOCK2_H)
13141320
CHECK_INCLUDE_FILE("ftw.h" HAVE_FTW_H)
13151321
CHECK_INCLUDE_FILE("libgen.h" HAVE_LIBGEN_H)
1322+
CHECK_INCLUDE_FILE("execinfo.h" HAVE_EXECINFO_H)
13161323

13171324
# Symbol Exists
13181325
CHECK_SYMBOL_EXISTS(isfinite "math.h" HAVE_DECL_ISFINITE)

Diff for: config.h.cmake.in

+3
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,9 @@ are set when opening a binary file on Windows. */
388388
with zip */
389389
#cmakedefine HDF5_SUPPORTS_PAR_FILTERS 1
390390

391+
/* if true, backtrace support will be used. */
392+
#cmakedefine HAVE_EXECINFO_H 1
393+
391394
/* if true, include JNA bug fix */
392395
#cmakedefine JNA 1
393396

Diff for: libhdf5/hdf5debug.c

+3-3
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,14 +15,14 @@
1515

1616
#define STSIZE 1000
1717

18-
#if !defined _WIN32 && !defined __CYGWIN__
18+
#ifdef HAVE_EXECINFO_H
1919
static void* stacktrace[STSIZE];
2020
#endif
2121

2222
int
2323
nch5breakpoint(int err)
2424
{
25-
#if !defined _WIN32 && !defined __CYGWIN__
25+
#ifdef HAVE_EXECINFO_H
2626
int count = 0;
2727
char** trace = NULL;
2828
int i;

0 commit comments

Comments
 (0)