New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include dist/build/autogen dir in the -I search list for cabal sandbox installations #1351

roman opened this Issue May 30, 2013 · 2 comments


None yet
3 participants
Copy link

roman commented May 30, 2013

This in order for libraries with C dependencies to be built with cabal-sandbox

This issue was discovered in a conversation with @dcoutts on #haskell IRC channel which I'll replicate over here, to add some context to the ticket:

romanandreg: dcoutts_: master branch of cabal, I'm trying to install HsOpenSSL through a sandbox, can't find cabal_macros.h file on cbits/HsOpenSSL.h

romanandreg: dcoutts_: when installing without a sandbox, works perfectly

romanandreg: dcoutts_: Gist for + info

dcoutts_: romanandreg: using same version of cabal-install in both cases?

romanandreg: yes, it was

dcoutts_: romanandreg: of course cbits/HsOpenSSL.h should not be trying to #include that file in the first place, because it's hard coding the dist dir location

dcoutts_: romanandreg: indeed that might be the issue, I'm not sure if the sandbox changes the dist dir

dcoutts_: romanandreg: should be easy to check, does dist exist in that dir?

dcoutts_: romanandreg: oh you're installing a tarball so you can't check

dcoutts_: romanandreg: ah yes there we go, dist/dist-sandbox-dc2d92ee

dcoutts_: romanandreg: so the bug is in the HsOpenSSL package because it's hard coding ../dist/build/autogen/cabal_macros.h

dcoutts_: romanandreg: but the location of the dist dir is not known to the package

romanandreg: dcoutts_: ohh…

romanandreg: dcoutts_: so basically hack the HsOpenSSL project to not rely on the fixed path of dist

dcoutts_: romanandreg: yes

dcoutts_: romanandreg: in principle it is currently impossible

dcoutts_: romanandreg: but it sounds like it'd be a useful feature to include the dist/build/autogen dir in the -I search list

dcoutts_: romanandreg: for .c files I mean


This comment has been minimized.

Copy link

23Skidoo commented May 31, 2013

So we want to always pass $DIST_PREF/build/autogen in the -I search list. OK, should be easy to fix.


This comment has been minimized.

Copy link

dcoutts commented May 31, 2013

Yes, easy. Look at the ghcOptCppIncludePath in componentGhcOptions vs componentCcGhcOptions:

      ghcOptCppIncludePath  = [autogenModulesDir lbi, odir]
                                    ++ PD.includeDirs bi,


      ghcOptCppIncludePath = odir : PD.includeDirs bi,

So all we need to do is change the latter to be the same as the former, so both include autogenModulesDir lbi.

@23Skidoo 23Skidoo closed this in 4dc2a10 May 31, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment