[SERVER-17199] Fix building on platforms without execinfo.h Created: 06/Feb/15 Updated: 05/Feb/16 Resolved: 12/Jun/15 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Build |
| Affects Version/s: | None |
| Fix Version/s: | 3.1.5 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Raffaele Rossi | Assignee: | Jonathan Reams |
| Resolution: | Done | Votes: | 0 |
| Labels: | build-jbr | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Backwards Compatibility: | Fully Compatible |
| Operating System: | ALL |
| Steps To Reproduce: | Compile with a toolchain missing execinfo.h |
| Sprint: | Platform 2 04/24/15, BUILD 4 06/05/15, Build 5 06/26/16 |
| Participants: |
| Description |
|
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 <execinfo.h> |
| Comments |
| Comment by Jonathan Reams [ 12/Jun/15 ] |
|
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. |
| Comment by Githook User [ 12/Jun/15 ] |
|
Author: {u'username': u'jbreams', u'name': u'Jonathan Reams', u'email': u'jbreams@mongodb.com'}Message: |
| Comment by Githook User [ 12/Jun/15 ] |
|
Author: {u'username': u'jbreams', u'name': u'Jonathan Reams', u'email': u'jbreams@mongodb.com'}Message: |
| Comment by Raffaele Rossi [ 14/May/15 ] |
|
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 |
| Comment by Jonathan Reams [ 14/May/15 ] |
|
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? |
| Comment by Raffaele Rossi [ 30/Apr/15 ] |
|
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:
|
| Comment by Jonathan Reams [ 29/Apr/15 ] |
|
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. |
| Comment by Raffaele Rossi [ 06/Feb/15 ] |
|
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 |