Skip to content

Commit 6c04893

Browse files
committed
FIX: attempt to add musl compatability
1 parent 546a43f commit 6c04893

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

ext/mini_racer_extension/mini_racer_extension.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,30 @@
66
#include <pthread.h>
77
#include <math.h>
88

9+
#if defined(__linux__) && !defined(__GLIBC__)
10+
// musl compatibility for glibc-linked libraries (e.g. libv8-node)
11+
// some versions of libv8-node are accidentally linked against glibc symbols
12+
// or compiled with a toolchain that emits these C23 compatibility symbols
13+
unsigned long long __isoc23_strtoull(const char *nptr, char **endptr, int base) {
14+
return strtoull(nptr, endptr, base);
15+
}
16+
unsigned long __isoc23_strtoul(const char *nptr, char **endptr, int base) {
17+
return strtoul(nptr, endptr, base);
18+
}
19+
long long __isoc23_strtoll(const char *nptr, char **endptr, int base) {
20+
return strtoll(nptr, endptr, base);
21+
}
22+
long __isoc23_strtol(const char *nptr, char **endptr, int base) {
23+
return strtol(nptr, endptr, base);
24+
}
25+
double __isoc23_strtod(const char *nptr, char **endptr) {
26+
return strtod(nptr, endptr);
27+
}
28+
float __isoc23_strtof(const char *nptr, char **endptr) {
29+
return strtof(nptr, endptr);
30+
}
31+
#endif
32+
933
#include "ruby.h"
1034
#include "ruby/encoding.h"
1135
#include "ruby/version.h"

0 commit comments

Comments
 (0)