Skip to content
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

Hack to include cabal_macros.h causes build failure with stack / GHC 9.10 #92

Open
andreasabel opened this issue Jul 2, 2024 · 4 comments

Comments

@andreasabel
Copy link
Collaborator

andreasabel commented Jul 2, 2024

/* A dirty hack to work around for broken versions of Cabal:
* https://github.com/phonohawk/HsOpenSSL/issues/8
*
* The trick is to abuse the fact that -Icbits is (almost) always
* passed to hsc2hs so we can reach the cabal_macros.h from cbits, but
* see #23, #24 and #25...
*/
#if !defined(MIN_VERSION_base) && \
!defined(HSOPENSSL_NEED_NOT_INCLUDE_CABAL_MACROS_H)
# include "../dist/build/autogen/cabal_macros.h"
#endif

HsOpenSSL                        > Building library for HsOpenSSL-0.11.7.7...
HsOpenSSL                        > [ 1 of 33] Compiling OpenSSL
HsOpenSSL                        > /private/var/folders/lg/qcd3v89j59l3m6520kr42bdm0000gn/T/stack-88a7366d6a42ff03/HsOpenSSL-0.11.7.7/In file included from /var/folders/lg/qcd3v89j59l3m6520kr42bdm0000gn/T/ghc51255_0/ghc_22.c:7:0: error:
HsOpenSSL                        > [ 2 of 33] Compiling OpenSSL.DH.Internal
HsOpenSSL                        >                 
HsOpenSSL                        >                 
HsOpenSSL                        > /private/var/folders/lg/qcd3v89j59l3m6520kr42bdm0000gn/T/stack-88a7366d6a42ff03/HsOpenSSL-0.11.7.7/cbits/HsOpenSSL.h:32:12: error:
HsOpenSSL                        >      fatal error: '../dist/build/autogen/cabal_macros.h' file not found
HsOpenSSL                        >    |            
HsOpenSSL                        > 32 | #  include "../dist/build/autogen/cabal_macros.h"
HsOpenSSL                        >    |            ^
HsOpenSSL                        >                 
HsOpenSSL                        > #  include "../dist/build/autogen/cabal_macros.h"
HsOpenSSL                        >            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HsOpenSSL                        > 1 error generated.
HsOpenSSL                        > <no location info>: error:
HsOpenSSL                        >     `gcc' failed in phase `C Compiler'. (Exit code: 1)
HsOpenSSL                        >               

This happens when I build a project with stack that uses HsOpenSSL (does not happen when I do stack build in the HsOpenSSL project).
I am on macOS (Monterey).
The problem is not limited to macOS, though https://github.com/hackage-trustees/hackage-cli/actions/runs/9759798062/job/26937247345:

Not sure what the reason is that the hack no longer works with GHC 9.10. Maybe a change in the Cabal library?

@andreasabel andreasabel changed the title Hack to include cabal_macros.h causes build failure with stack Hack to include cabal_macros.h causes build failure with stack / GHC 9.10 Jul 2, 2024
@vshabanov
Copy link
Collaborator

Unfortunately, I have no time to check it. I will gladly accept a PR with a fix.

@andreasabel
Copy link
Collaborator Author

If you give me commit rights (here and on hackage) I can give it a shot. Probably I will first see to update the CI, to make sure the fix is portable.

@vshabanov
Copy link
Collaborator

vshabanov commented Jul 6, 2024

This repo is now under haskell-cryptography org, I'm not sure whether I can give commit rights. @Kleidukos, could you give commit rights to HsOpenSSL to @andreasabel ? He helps a lot in keeping things building (maintains CI of https://github.com/haskell/text-icu and in a number of other projects) and works on Agda.

@andreasabel, I added you to the list of HsOpenSSL maintainers:
https://hackage.haskell.org/package/HsOpenSSL/maintainers/

@Kleidukos
Copy link
Member

@vshabanov You should now be able to manage the access list, and I'll send an invitation to Andreas too!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants