-
Notifications
You must be signed in to change notification settings - Fork 841
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
Forwarding DYLD_LIBRARY_PATH #1161
Comments
Just saw this issue after responding on Reddit. I'm not aware of anything Stack is doing to make |
|
Well, that explains that. If someone has an idea for how to resolve this issue, please send a PR, but my lack of OS X experience will prevent me from getting involved. |
Is this specific to Stack, or does the same thing happen with cabal-install? I just wonder if a workaround is even possible, because it would presumably require getting the subprocess to set I'm not a Mac developer, just a Un*x developer that happens run OS X on the desktop, so I don't have much understanding of System Integrity Protection at this point. I'm avoiding upgrading to El Capitan because I don't want to break my own development environment, but probably I should bite the bullet so I can look at these issues... |
Sounds like the only solution is to avoid going through a shell script wrapper, or distributing a custom shell. |
I can have a look at it when I'm back home. The idea is: I was able to compile with regular |
@alexbiehl Have you had a chance to look into this? I'm also still curious whether this is unique to Stack or whether cabal-install has the same problem. |
@borsboom After doing some tests on OSX, I can say it's not specific to stack. cabal-install has the same problem.
it causes the error (during the hsc2hs phase since it says
works. So it's not stack-specific, cabal does the same. |
Sounds like we should close this one out and file a bug with Cabal (if one doesn't already exist). |
@YPares: unless I am misunderstanding the issue, it actually looks like this problem is Stack-specific based on your results with cabal-install. As I understand it, Stack doesn't even work if you do set DYLD_LIBRARY_PATH, since El Capitan's System Integrity Protection prevents the environment variable from being passed through. Did you perform your test on El Capitan? |
@borsboom Yes, I'm on El Capitan. |
I've upgraded a system to El Capitan and was able to reproduce @bitemyapp's issue. Here's a quick example: On El Capitan (note the first command outputs an empty line):
vs. Yosemite (both commands output the path):
@YPares: can you try both commands on your El Capitan setup? And can you confirm that you didn't disable System Integrity Protection? |
aside: leaving out Stack entirely, just the following exhibits the same behaviour:
|
After I disabled System Integrity Protection, El Capitan behaves like Yosemite with respect to |
I've added a FAQ entry for this and linked to it from the OS X installation instructions. |
Hi, I am a newbie so sorry if this is a silly question. Disabling a security feature like this should be fine as a workaround I think. But would since the issue is now 'closed' does this mean this will not be 'fixed' in a way that would make it work on OSX without having to mess with OS security? Because I am just getting started with haskell and yesod but I am hoping to use a Mac mini as a production server for Yesod eventually and and I am worried I may have to do something like this on the production server to get Yesod to run? |
Telling users to disable SEP to use Stack is really disappointing. Indeed, as @kevin-lee's link shows, it's only binaries in system locations that aren't allowed to be affected by DYLD_* environment variables. Hopefully Stack can resolve this. |
Note that this isn't directly a problem with stack, but something that appears to affect all uses of cabal / ghc. While maybe there's a workaround that stack could attempt, the "proper" solution is likely a change outside of stack itself. |
Thanks mgsloan, In that case I guess someone has to report this to the cabal/ghc people I guess. I have sent the following message to the Haskell libraries mailing list. Please let me know if there is a better place to report this issue. Hi, At the moment the suggested workaround is to disable System Integrity Protection which sounds a bit scary to me. So I thought this might be a good idea to reported to someone in a Cabal team. At the moment I am using an Ubuntu Virtual Machine to avoid having to mess with SIP on my mac. Hope some clever/kind person from the Haskell community would be able to fix this soon. Thanks Sam |
@mgsloan ah, good point. Thank you, I'll keep investigating there. |
@cbarrett Thanks so much for investigating this. Please could you post a link if a bug is registered against cabal or GHC so I can keep track of any developments. I am hoping I don't have to use the VM for too long |
There is now another discussion about this (see #1799). Mac folks please try to help us come up with a hack that allows things to work without disabling SIP. @sam2000 Also, you will be able to run binaries produced by haskell. This is just an issue with passing environment variables when invoking a process during the build. |
(copied from #1799 (comment)) I think this may be happening at the GHC level as well. |
FYI: I've been doing some more testing, and I can now reproduce the issue with stack, cabal-install, and directly using |
And now I have workaround that worked in my case (more-or-less what I mentioned in #1161 (comment)). First I copied Potentially Stack could apply this sort of workaround itself. |
Opened a GHC issue to discuss solutions: https://ghc.haskell.org/trac/ghc/ticket/11617 |
Thank you @borsboom! All the work to get this sorted is much appreciated 😄 |
What wonderful news! I recently wanted to give yesod a try but when I realised that just setting it up required stack which means messing with OSX security stuff I gave up on it! Now what you have done gives me hope! Thank you so much Emanuel Borsboom! You are a star! Sent from my iPhone
|
@sam2000 Chances are Yesod will work out of the box, without making any changes to SIP, anyway. This is only necessary for the rare case when you have to set DYLD_LIBRARY_PATH, and I had to manually move a some libraries out of the location where Homebrew installs them in order to reproduce this. |
@EmanuelBorsboom in that case I will try this on my Mac. Thanks again! Sent from my iPhone
|
Gershom recently made this comment on the GHC issue:
I've never been bitten by this problem (I've always installed libraries using Homebrew, which puts them in Any ideas for workarounds that don't require DYLD_LIBRARY_PATH also appreciated. For example, maybe we can document an easy way to specify the location of libraries via the command-line rather than via the environment variable. |
Since the discussion here seems to have stalled without any feedback from anyone still having problems, I'm closing this issue. We can re-open later if necessary. |
Is it possible for |
To save some people that manual work, I'm providing the script I'm using. NOTE: the script must be ran from a stack project or you can pass If you're okay with that behaviour, I can try to implement it in the |
FTR this breaks inline-java. The reason is: the
|
I can reproduce this behaviour with
Thank you to @alexbiehl for finding the root cause and @bitemyapp for showing a fix. |
https://www.reddit.com/r/haskell/comments/3ooxu4/library_not_loaded_libmariadb2dylib_os_x/
Ah, I got the solution myself. It seems that I needed to do a
to add it to the search paths for dylds and it seems stack isn't forwarding env variables like
DYLD_LIBRARY_PATH
. I noticed because I tried to run the hsc2hs generated executable manually and it worked as expected.Is this intended behaviour for stack?
The text was updated successfully, but these errors were encountered: