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

DYLD_INSERT_LIBRARIES no longer works on El Capitan #11

Closed
jacereda opened this issue Apr 16, 2016 · 16 comments
Closed

DYLD_INSERT_LIBRARIES no longer works on El Capitan #11

jacereda opened this issue Apr 16, 2016 · 16 comments

Comments

@jacereda
Copy link
Owner

No description provided.

@jacereda
Copy link
Owner Author

For build systems, a possible workaround would be to copy required tools out of the system path.

@ndmitchell
Copy link
Contributor

What are the "required tools"? If someone runs gcc, which that involve copying gcc out of the system path? Or just the fsatrace dlls? Or something else? Is creating a symlink to whatever the relevant piece is sufficient?

@jacereda
Copy link
Owner Author

jacereda commented Apr 17, 2016

If you're using gcc it won't be installed in a system path, so it should be fine.
If you use the clang in Xcode, copying the clang binary to any non-system location and running from there should suffice. Maybe this could be built into the tool (check if the binary is present in /tmp/fsatrace/, copy if it isn't present and run from there).

@ndmitchell
Copy link
Contributor

Is a hard link sufficient instead of an actual copy?

@jacereda
Copy link
Owner Author

I think hard links aren't allowed in 10.11.

@ndmitchell
Copy link
Contributor

Hmm, won't copying the binary still change the argv[0] value, and thus things that go hunting for adjacent binaries (which I know gcc does) will fail. That seems even more problematic.

@jacereda
Copy link
Owner Author

Well, gcc binaries won't be signed nor installed on system paths. But yes, the solution wouldn't be very solid.

@jacereda
Copy link
Owner Author

jacereda commented May 6, 2016

I've started working on a workaround for this problem in shake:

jacereda/shake@cf5e949

But looks like I'm misunderstanding how newCacheIO works. Looks like /bin/sh is copied several times when running the lint test. What am I doing wrong? Is there a better way to achieve this?

@ndmitchell
Copy link
Contributor

It looks sensible to me, at first brush. I suggest you add: print e just inside the newCacheIO. You should never get called with the same value twice. If you do, newCacheIO is wrong. If you don't, hopefully it will give you a clue as to why you are getting two bin/sh things.

@jacereda
Copy link
Owner Author

jacereda commented May 6, 2016

With this:

fcache <- newCacheIO $ \e -> liftIO $ do
    print e
    ...

I get several "/bin/sh" messages printed.

@ndmitchell
Copy link
Contributor

Can you add a print just before fcache - ensure we're only creating one fcache value.

@jacereda
Copy link
Owner Author

jacereda commented May 6, 2016

OK, looks like running the test suite enters Development.Shake.Core.run several times. Is there a better place for that cache than Global? In any case, I don't mind if the test suite is a bit slower than it could because it copies binaries more times than necessary... I guess a normal build won't reenter run, right?

@ndmitchell
Copy link
Contributor

The test suite calls run many many times.

Maybe the cache should exist only/mostly on disk? Why not just do a doesFileExist on the file you'd like to be there, and treat its presence as a signal than you've already copied it across. No need to newCacheIO at all.

Looking quickly, perhaps something like /bin/sh should be copied to $TEMP/fsatrace-fakes/<hash>/sh, where <hash> is the hash of /bin/sh - so if there are two sh binaries they don't get confused.

@jacereda
Copy link
Owner Author

jacereda commented May 6, 2016

Hmm, that would imply hashing the binary, I'll just prepend $TEMP to the found path, so if you have /bin/foo and /usr/bin/foo they will get different paths.

@ndmitchell
Copy link
Contributor

I just meant hashing the filepath, but yeah, prepending $TEMP is a much simpler solution :)

@jacereda
Copy link
Owner Author

I'll just close this. If the hack ends up being too problematic, maybe by then Apple provides some decent way to trace binaries. Other than that, FUSE might be an option.

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

2 participants