I have an empty program (module Main where main = return ()
) which segfaults if I include a specific library in build-depends, in cabal file.
The library is my own, and the segfault is some sort of interaction of bumblebee drivers with opengl and haskell (the segfault only occurs if I optirun
, which works with other programs, in stack trace I only see libGL.so), but that isn't my question.
My question is, how can a program with no code segfault? More precisely, what code of my library runs just because it's in build-depends? How do I debug this nonsense?
Edit. If I change the order in which extra-libraries are listed, when compiling my library, the problem goes away. Specifically, I moved GL, GLEW before sfml-*. The question remains, though. How could I have discovered this, apart form aimlessly fiddling with build files?