{"action":"closed","issue":{"url":"https://api.github.com/repos/vaibhavsagar/experiments/issues/5","repository_url":"https://api.github.com/repos/vaibhavsagar/experiments","labels_url":"https://api.github.com/repos/vaibhavsagar/experiments/issues/5/labels{/name}","comments_url":"https://api.github.com/repos/vaibhavsagar/experiments/issues/5/comments","events_url":"https://api.github.com/repos/vaibhavsagar/experiments/issues/5/events","html_url":"https://github.com/vaibhavsagar/experiments/issues/5","id":331550206,"node_id":"MDU6SXNzdWUzMzE1NTAyMDY=","number":5,"title":"static-haskell-nix: Explain linker warning","user":{"login":"nh2","id":399535,"node_id":"MDQ6VXNlcjM5OTUzNQ==","avatar_url":"https://avatars1.githubusercontent.com/u/399535?v=4","gravatar_id":"","url":"https://api.github.com/users/nh2","html_url":"https://github.com/nh2","followers_url":"https://api.github.com/users/nh2/followers","following_url":"https://api.github.com/users/nh2/following{/other_user}","gists_url":"https://api.github.com/users/nh2/gists{/gist_id}","starred_url":"https://api.github.com/users/nh2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nh2/subscriptions","organizations_url":"https://api.github.com/users/nh2/orgs","repos_url":"https://api.github.com/users/nh2/repos","events_url":"https://api.github.com/users/nh2/events{/privacy}","received_events_url":"https://api.github.com/users/nh2/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-06-12T11:37:40Z","updated_at":"2018-06-12T20:20:07Z","closed_at":"2018-06-12T20:20:07Z","author_association":"NONE","body":"From https://vaibhavsagar.com/blog/2018/01/03/static-haskell-nix/\r\n\r\n```\r\n\"Using '<function>' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking\"\r\n```\r\n\r\n> but these don’t seem to cause any issues in practice\r\n\r\nI think that isn't quite accurate -- you are probably just lucky and ran the compiled program on a machine that happened to have the same (or compatible) version of glibc as your build system has.\r\n\r\nglibc is not really compatible with static linking. It loads stuff dynamically at run time and assumes to find the same glibc version as on the machine the was compiled. You'll get hard errors if that isn't the case.\r\n\r\nSee https://stackoverflow.com/questions/8657908/deploying-yesod-to-heroku-cant-build-statically#answer-8658468 for some details.\r\n\r\nAs it's said there:\r\n\r\n> Contrary to popular belief, static linking [of glibc] produces less, not more, portable executables on Linux.\r\n\r\nTo be really more portable, you have to link against a libc that doesn't force dynamic behaviour as glibc does. For example, the `musl` libc. That's what Alpine Linux uses, and the reason that in the [past](https://www.fpcomplete.com/blog/2016/10/static-compilation-with-stack) `stack` supported building statically linked binaries in an Alpine Docker image (but this is [currently broken](https://github.com/commercialhaskell/stack/issues/2387#issuecomment-366775979) with the latest Alpine and GHC releases).\r\n\r\nYou may want to update the article with this info, otherwise people will get some bad surprises.\r\n\r\nHopefully that will also motivate more people to improve the static linking situation, e.g. by making `musl` work nicely to solve the issue."}}
{"actor":{"display_login":"vaibhavsagar"}}