
However, with ghci (which has a custom module loader and linker, I think), it seems to attempt to link all of the modules in the lib, and this fails badly if you don;t have every back-end DBMS client installed.
The only way I could find to fix that was to adjust the build to only include modules that will link successfully (i.e. those for which you have a DBMS client installed).
I looked yesterday at a slightly nicer way of doing what you're already doing. We can use flags to turn on/off the various backends. What is tricky is doing that such that the default is chosen automagically.
To be fair, this is arguably ghci's fault. If the loader/linker in ghci was more like gnu ld, then we could just build all of the modules, and let the linker handle pulling in the optional bits. But I have no idea if ghc HQ plan to fix it. I don't know if there's another use case for this kind of behaviour that would justify adding it to cabal. Alistair