...
The file src/mongo/platform/backtrace.cpp includes dlfcn.h without #define _GNU_SOURCE to access functions like dladdr(). According to the man page this doesn't seem right and as a matter of fact it didn't compile with a toolchain missing
jonathan.reams@10gen.com commented on Fri, 12 Jun 2015 16:54:57 +0000: raffopazzo, sorry it took so long to get back on this. I actually got a repro environment with uclibc, and adding _GNU_SOURCE solved one problem but brought up another one; so we've opted for a different approach to this. the code in backtrace.cpp is only for use on Solaris 10 where we don't have execinfo.h. Every other platform I could find had execinfo.h/backtrace available; in fact uclibc has backtrace available as a compile-time option. For platforms that really don't have execinfo.h available, we aren't going to try to emulate backtrace and mongo just won't print a stacktrace. xgen-internal-githook commented on Fri, 12 Jun 2015 15:40:13 +0000: Author: {u'username': u'jbreams', u'name': u'Jonathan Reams', u'email': u'jbreams@mongodb.com'} Message: SERVER-17199 Fix compile on OSX Branch: master https://github.com/mongodb/mongo/commit/0e014f112131780672d6c34ae1b492d614118d5f xgen-internal-githook commented on Fri, 12 Jun 2015 13:15:34 +0000: Author: {u'username': u'jbreams', u'name': u'Jonathan Reams', u'email': u'jbreams@mongodb.com'} Message: SERVER-17199 Fix compiles on platforms without execinfo.h Branch: master https://github.com/mongodb/mongo/commit/9a00e51f76afd0f68e96196ad8e11924de254d8e raffopazzo commented on Thu, 14 May 2015 16:41:52 +0000: I imagine it's a 1-liner. You can try and send me the patch and I'll try, but I'm having problem building master due to some boost problem in V8-3.25 jonathan.reams@10gen.com commented on Thu, 14 May 2015 15:12:10 +0000: raffopazzo, I'm having trouble finding a reproduction environment on my end. Can I email you a patch, and you can test it in your environment? raffopazzo commented on Thu, 30 Apr 2015 08:04:16 +0000: I was cross-compiling for a mips-uclibc-linux platform. Since uClibc mimics glibc, this should be treated as a glibc platform, which according to the man page requires #define _GNU_SOURCE: Glibc extensions: dladdr() and dlvsym() Glibc adds two functions not described by POSIX, with prototypes #define _GNU_SOURCE /* See feature_test_macros(7) */ #include int dladdr(void *addr, Dl_info *info); void *dlvsym(void *handle, char *symbol, char *version); jonathan.reams@10gen.com commented on Wed, 29 Apr 2015 20:05:09 +0000: The code in backtrace.cpp only gets executed if your platform doesn't have execinfo.h (e.g. Solaris), and on Solaris and other non-glibc platforms, _GNU_SOURCE isn't required to use dlopen. Is there a platform you're building on that doesn't have execinfo.h and uses the dlopen to emulate the backtrace calls? On my local Linux install, a missing execinfo.h causes a configure error because libstdc++ depends on calling backtrace. raffopazzo commented on Fri, 6 Feb 2015 11:59:54 +0000: I raised this issue uncertain whether you guys reckoned it'd be worth. Happy to reject it if you think the code's ok as is, but I believe it's not compliant with the docs BTW, the priority is Major by default. Not sure whether this should be lowered.
Compile with a toolchain missing execinfo.h