{"action":"closed","issue":{"url":"https://api.github.com/repos/haskell-game/sdl2/issues/100","labels_url":"https://api.github.com/repos/haskell-game/sdl2/issues/100/labels{/name}","comments_url":"https://api.github.com/repos/haskell-game/sdl2/issues/100/comments","events_url":"https://api.github.com/repos/haskell-game/sdl2/issues/100/events","html_url":"https://github.com/haskell-game/sdl2/issues/100","id":124372822,"number":100,"title":"If a cabal library depends on `sdl2` and `libusb` (via `pkgconfig`), it seg faults on initialization","user":{"login":"ocharles","id":20878,"avatar_url":"https://avatars.githubusercontent.com/u/20878?v=3","gravatar_id":"","url":"https://api.github.com/users/ocharles","html_url":"https://github.com/ocharles","followers_url":"https://api.github.com/users/ocharles/followers","following_url":"https://api.github.com/users/ocharles/following{/other_user}","gists_url":"https://api.github.com/users/ocharles/gists{/gist_id}","starred_url":"https://api.github.com/users/ocharles/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ocharles/subscriptions","organizations_url":"https://api.github.com/users/ocharles/orgs","repos_url":"https://api.github.com/users/ocharles/repos","events_url":"https://api.github.com/users/ocharles/events{/privacy}","received_events_url":"https://api.github.com/users/ocharles/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-12-30T16:57:28Z","updated_at":"2016-01-01T11:46:34Z","closed_at":"2016-01-01T11:46:34Z","body":"Take the following program:\r\n\r\n```haskell\r\n{-# LANGUAGE OverloadedStrings #-}\r\n\r\nmodule Main where\r\n\r\nimport Linear\r\nimport qualified SDL\r\n\r\nwidth, height :: Int\r\nwidth = 1280\r\nheight = 720\r\n\r\nmain :: IO ()\r\nmain =\r\n  do SDL.initializeAll\r\n     w <-\r\n       SDL.createWindow\r\n         \"bgfx with SDL2\"\r\n         SDL.defaultWindow {SDL.windowInitialSize =\r\n                              fromIntegral <$> V2 width height}\r\n     return ()\r\n```\r\n\r\nWhen compiled with the following `cabal Executable` all is well:\r\n\r\n```cabal\r\nexecutable on-the-limit\r\n  main-is:             Main.hs\r\n  build-depends:       base >=4.8 && <4.9, sdl2, linear\r\n  hs-source-dirs:      src\r\n  default-language:    Haskell2010\r\n```\r\n\r\nHowever, if a build-dependency on `libusb` is added:\r\n\r\n```cabal\r\nexecutable on-the-limit\r\n  main-is:             Main.hs\r\n  build-depends:       base >=4.8 && <4.9, sdl2, linear\r\n  hs-source-dirs:      src\r\n  default-language:    Haskell2010\r\n  pkgconfig-depends: libusb-1.0 >= 1.0.16\r\n```\r\n\r\nThen the program will segfault."}}