On Sun, Jun 23, 2013 at 12:15 PM, Dawe <[email protected]> wrote: > On Jun 22, 2013 23:33, Matthias Kilian wrote: >> On Sat, Jun 22, 2013 at 11:07:25PM +0200, Matthias Kilian wrote: >> > I also wonder if it wouldn't be better to go e step further and use >> > pg_config instead of krb5-config. That one could be submitted to >> > upstream. >> >> I just noticed that the Setup.hs of hs-postgresql-libpq already >> checks for and uses pg_config -- it just doesn't ask it for the >> libraries to link with. So it may be enough to extend psqlBuildInfo in >> Setup.hs with something like this: >> >> ... >> libs <- pgconfig ["--libs"] >> >> return emptyBuildInfo { >> extraLibDirs = [strip libDir], >> includeDirs = [strip incDir], >> extraLibs = map (drop 2) $ words libs >> } >> >> Ciao, >> Kili >> > > I played a bit with extending Setup.hs. In general it works fine to set the > extraLibs variable there but unfortunately we can't just use the output of > pg_config or krb5-config because ghci needs them in a certain order. > crypto needs to be in front of ssl. > asn1 needs to be in front of krb5. > > If my understanding is right, we need to provide the library names, that > libpq.so depends on so the ghci linker resolves them. > $ ldd /usr/local/lib/libpq.so.5.5 on my system lists the following: > libpq.so.5.5 > libkrb5.so.19.0 > libasn1.so.19.0 > libcrypto.so.22.0 > libwind.so.0.0 > libroken.so.0.0 > libcom_err.so.19.0 > libheimbase.so.0.0 > libssl.so.19.0 > > $ pg_config --libs gives: > -lpgport -lxml2 -lssl -lcrypto -lz -lreadline -ltermcap -lm > > and $ krb5-config --libs gives > -L/usr/lib -lkrb5 -lasn1 -lcrypto -lwind -lroken -lcom_err -lheimbase > > The order and output of all three tools isn't right for the ghci linker. > So we would need to write code that reorders the output and maybe drops some > of > the superfluous names. > I think maintaining that code to make sure the right order is maintained is > likely more work in case some Kerberos libs change again compared to the > hardcoded list in the cabal file. What do you think? > Maybe I'm just not seeing the obvious graceful solution :) >
In the meantime, I will unbreak the port :)
