{"action":"created","issue":{"url":"https://api.github.com/repos/commercialhaskell/stack/issues/1987","repository_url":"https://api.github.com/repos/commercialhaskell/stack","labels_url":"https://api.github.com/repos/commercialhaskell/stack/issues/1987/labels{/name}","comments_url":"https://api.github.com/repos/commercialhaskell/stack/issues/1987/comments","events_url":"https://api.github.com/repos/commercialhaskell/stack/issues/1987/events","html_url":"https://github.com/commercialhaskell/stack/issues/1987","id":145490549,"number":1987,"title":"recompile with -fPIC when adding library dependent code as build-depenency of library","user":{"login":"bneijt","id":61703,"avatar_url":"https://avatars.githubusercontent.com/u/61703?v=3","gravatar_id":"","url":"https://api.github.com/users/bneijt","html_url":"https://github.com/bneijt","followers_url":"https://api.github.com/users/bneijt/followers","following_url":"https://api.github.com/users/bneijt/following{/other_user}","gists_url":"https://api.github.com/users/bneijt/gists{/gist_id}","starred_url":"https://api.github.com/users/bneijt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bneijt/subscriptions","organizations_url":"https://api.github.com/users/bneijt/orgs","repos_url":"https://api.github.com/users/bneijt/repos","events_url":"https://api.github.com/users/bneijt/events{/privacy}","received_events_url":"https://api.github.com/users/bneijt/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/commercialhaskell/stack/labels/type:%20bug","name":"type: bug","color":"eb6420"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-04-03T12:43:19Z","updated_at":"2016-04-04T20:10:40Z","closed_at":null,"body":"My project compiles locally, however I can't get it to compile on Travis-CI. I have tried different versions of both stack and ghc, but can't seem to get a reproducable build.\r\n\r\nSteps to reproduce:\r\n- Use stack new to create a project\r\n- Add a library as an external dependency of the \"library\" package in cabal\r\n- Add the library dependency to stack.yml\r\n- Add travis file\r\n- Build locally and let Travis CI build it using the stack on Travis manual.\r\n\r\nI have created an example repository with code to show the result:\r\nhttps://github.com/bneijt/fpic\r\nhttps://travis-ci.org/bneijt/fpic\r\n\r\n\r\nExpected result:\r\n    Normal compilation, no errors\r\n\r\nActual result\r\n[1 of 1] Compiling Lib              ( src/Lib.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/Lib.o )\r\nProgress: 1/3/usr/bin/ld: .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/Lib.dyn_o: relocation R_X86_64_PC32 against symbol `fpiczu2fjQ7h3pNG41YDOOD1F9B2_Lib_someFunc2_closure' can not be used when making a shared object; recompile with -fPIC\r\n/usr/bin/ld: final link failed: Bad value\r\ncollect2: ld returned 1 exit status\r\nProgress: 2/3\r\n--  While building package fpic-0.1.0.0 using:\r\n      /home/travis/.stack/setup-exe-cache/x86_64-linux/setup-Simple-Cabal-1.22.5.0-ghc-7.10.3 --builddir=.stack-work/dist/x86_64-linux/Cabal-1.22.5.0 build lib:fpic exe:fpic-exe test:fpic-test --ghc-options \" -ddump-hi -ddump-to-file\"\r\n\r\n    Process exited with code: ExitFailure 1\r\n\r\nThe FAQ mentions this problem, but the problem is reproducible and seems to be related to using a package that requires an external library as a dependency."},"comment":{"url":"https://api.github.com/repos/commercialhaskell/stack/issues/comments/205474677","html_url":"https://github.com/commercialhaskell/stack/issues/1987#issuecomment-205474677","issue_url":"https://api.github.com/repos/commercialhaskell/stack/issues/1987","id":205474677,"user":{"login":"mgsloan","id":22570,"avatar_url":"https://avatars.githubusercontent.com/u/22570?v=3","gravatar_id":"","url":"https://api.github.com/users/mgsloan","html_url":"https://github.com/mgsloan","followers_url":"https://api.github.com/users/mgsloan/followers","following_url":"https://api.github.com/users/mgsloan/following{/other_user}","gists_url":"https://api.github.com/users/mgsloan/gists{/gist_id}","starred_url":"https://api.github.com/users/mgsloan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mgsloan/subscriptions","organizations_url":"https://api.github.com/users/mgsloan/orgs","repos_url":"https://api.github.com/users/mgsloan/repos","events_url":"https://api.github.com/users/mgsloan/events{/privacy}","received_events_url":"https://api.github.com/users/mgsloan/received_events","type":"User","site_admin":false},"created_at":"2016-04-04T20:10:40Z","updated_at":"2016-04-04T20:10:40Z","body":"Thanks for the repo!  Does `--ghc-options -fPIC` fix the issue?"}}