Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Porting to OS X #2

Open
goxberry opened this issue Feb 1, 2018 · 6 comments
Open

Porting to OS X #2

goxberry opened this issue Feb 1, 2018 · 6 comments

Comments

@goxberry
Copy link
Member

goxberry commented Feb 1, 2018

I've been interested in using mpiP to try and understand some parallel bugs I've been having, and I like to use my laptop for small-scale debugging, so I started porting mpiP over to OS X.

I have a build that works without BFD or libelf/libdwarf support in spack/spack#7146. The patch therein is inelegant, and I suspect there is a simpler one that will work better, but it's a starting point. Would the devs on this project be interested in a patch if I file a PR?

I also have a branch of spack that builds mpiP on OS X with libelf/libdwarf support, and I can build examples, but libdwarf throws an error in mpip (Code 134, DW_DLE_ARANGE_OFFSET_BAD: The debug_arange entry has a DIE offset that is larger than the size of the .debug_info section). I suspect this error might be due to spack packages inconsistently using GNU libtool or Apple's BSD libtool, but was wondering if you guys might have more insight into that bug, or interest in that capability.

@goxberry
Copy link
Member Author

goxberry commented Feb 1, 2018

Managed to get bfd support working also, and native system libunwind support.

@cchambreau
Copy link
Collaborator

cchambreau commented Feb 2, 2018 via email

@goxberry
Copy link
Member Author

goxberry commented Feb 2, 2018

Sounds good! I'll submit two PRs this weekend.

The first would be a patch to get base mpiP functionality working.

The second would be patches for BFD support.

I'm still interested in trying to get libelf/libdwarf support working also, but I'm not sure how to proceed there. I have some ideas (trying alternate versions of libelf and libdwarf like the ones in Apple's dtrace library, or elftoolchain; also trying to improve spack's support of darwin's build toolchains), but those are really just guesses -- I don't have a good sense of how to narrow down the problem further.

@tgamblin
Copy link
Member

tgamblin commented Feb 5, 2018

@goxberry: are you trying to get libelf/libdwarf working to get symbol info? I'm not sure that is the way to go, as OS X doesn't even use ELF. Its binaries are mach-o. You'd likely need to add some support for non-elf binaries.

@goxberry
Copy link
Member Author

goxberry commented Feb 8, 2018

@tgamblin Good point! The situation on OS X is weird; there are ELF libraries in some places, I don't know why. I know pretty much nothing about how shared libraries work. I'm looking at setting up a Linux environment locally so I don't have to worry about Mach-O vs ELF, and I can still play with some of the interesting instrumentation libraries to figure out what's going on with my MPI code.

The patch re: BFD should be cross-platform; their devs are stubborn about insisting that the macros PACKAGE and VERSION are defined.

It seems like if someone wanted to figure out the Mach-O equivalent to traversing the link_map in the _r_debug_ data structure, the answer would be buried in the headers in /usr/include/mach-o. I don't know that it's really worth doing so.

@bkmgit
Copy link
Contributor

bkmgit commented Nov 29, 2018

On linux, one needs to get the config.h file in the bfd build subdirectory of the binutils build directory. This has defines PACKAGE to be binutils and also gets the version of binutils. It also has a number of other platform specific configuration options - https://sourceware.org/ml/binutils/2018-11/msg00247.html

artpol84 added a commit to artpol84/mpiP that referenced this issue Jun 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants