Merge pull request #2386 from pullmoll/mongodb

mongodb: unbreak musl
This commit is contained in:
Enno Boland 2015-08-27 13:12:50 +02:00
commit dfcf3fec8c
4 changed files with 98 additions and 1 deletions

View File

@ -0,0 +1,31 @@
There is no walkcontext(3) for musl libc, so we effectively
disable backtracing symbols without removing the functions.
They just always return zero symbols.
--- src/mongo/platform/backtrace.cpp 2015-08-24 02:39:52.000000000 +0200
+++ src/mongo/platform/backtrace.cpp 2015-08-26 19:27:26.738866698 +0200
@@ -81,7 +81,7 @@
// to Linux's display, but slightly different.
//
int addrtosymstr(void* address, char* outputBuffer, int outputBufferSize) {
- Dl_info_t symbolInfo;
+ Dl_info symbolInfo;
if (dladdr(address, &symbolInfo) == 0) { // no info: "[address]"
return snprintf(outputBuffer, outputBufferSize, "[0x%p]", address);
}
@@ -113,10 +113,15 @@
+#if defined(__sunos__)
if (getcontext(&context) != 0) {
return 0;
}
int wcReturn = walkcontext(
&context,
reinterpret_cast<WalkcontextCallbackFunc>(WalkcontextCallback::callbackFunction),
static_cast<void*>(&walkcontextCallback));
+#else
+ // We have no walkcontext(3) for musl libc
+ int wcReturn = -1;
+#endif
if (wcReturn == 0) {
return walkcontextCallback.getCount();
}

View File

@ -0,0 +1,21 @@
Add a definition for the macro __ELF_NATIVE_CLASS which depends
on the native arch's word size.
--- src/mongo/util/stacktrace_posix.cpp 2015-08-24 02:39:52.000000000 +0200
+++ src/mongo/util/stacktrace_posix.cpp 2015-08-26 18:59:52.290831910 +0200
@@ -37,6 +37,15 @@
#include <string>
#include <sys/utsname.h>
+#if !defined(__GLIBC__)
+#if defined __x86_64__ && !defined __ILP32__
+# define __WORDSIZE 64
+#else
+# define __WORDSIZE 32
+#endif
+#define __ELF_NATIVE_CLASS __WORDSIZE
+#endif
+
#include "mongo/base/init.h"
#include "mongo/db/jsobj.h"
#include "mongo/platform/backtrace.h"

View File

@ -0,0 +1,37 @@
--- src/mongo/util/processinfo_linux2.cpp 2015-08-24 02:39:52.000000000 +0200
+++ src/mongo/util/processinfo_linux2.cpp 2015-08-26 18:47:57.444816879 +0200
@@ -34,7 +34,9 @@
#include <stdio.h>
#include <unistd.h>
#include <sys/mman.h>
+#if defined(__GLIBC__)
#include <gnu/libc-version.h>
+#endif
#include <sys/utsname.h>
#include "processinfo.h"
@@ -420,12 +422,14 @@
}
void ProcessInfo::getExtraInfo(BSONObjBuilder& info) {
+#if defined(__GLIBC__)
// [dm] i don't think mallinfo works. (64 bit.) ??
struct mallinfo malloc_info =
mallinfo(); // structure has same name as function that returns it. (see malloc.h)
info.append("heap_usage_bytes",
malloc_info.uordblks /*main arena*/ + malloc_info.hblkhd /*mmap blocks*/);
// docs claim hblkhd is included in uordblks but it isn't
+#endif
LinuxProc p(_pid);
info.appendNumber("page_faults", static_cast<long long>(p._maj_flt));
@@ -460,7 +464,9 @@
BSONObjBuilder bExtra;
bExtra.append("versionString", LinuxSysHelper::readLineFromFile("/proc/version"));
+#if defined(__GLIBC__)
bExtra.append("libcVersion", gnu_get_libc_version());
+#endif
if (!verSig.empty())
// optional
bExtra.append("versionSignature", verSig);

View File

@ -1,7 +1,7 @@
# Template file for 'mongodb'
pkgname=mongodb
version=3.0.6
revision=1
revision=2
hostmakedepends="scons"
makedepends="boost-devel pcre-devel snappy-devel libressl-devel libpcap-devel gperftools-devel"
conf_files="/etc/mongodb/mongodb.conf"
@ -36,6 +36,14 @@ do_configure() {
find . -name SConstruct -print0 | xargs -0 sed -i "s/-Werror/-Wno-error/g"
}
post_configure() {
case "$XBPS_TARGET_MACHINE" in
*-musl) # Disable strtouq(3)
sed -i src/third_party/wiredtiger/build_linux/wiredtiger_config.h \
-e "s;#define HAVE_STRTOUQ 1;#undef HAVE_STRTOUQ;"
esac
}
do_build() {
scons core ${makejobs} \
--cc=$CC \