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

Unable to compile 0.11.7.3 on Windows and MacOS #74

Closed
newhoggy opened this issue Dec 20, 2022 · 9 comments
Closed

Unable to compile 0.11.7.3 on Windows and MacOS #74

newhoggy opened this issue Dec 20, 2022 · 9 comments

Comments

@newhoggy
Copy link

newhoggy commented Dec 20, 2022

The commit where the build started failing is this one

commit c41e27deb0c48735efbae595311ac4fb820e6e8c (HEAD)
Author: Vladimir Shabanov <[email protected]>
Date:   Sun Dec 11 20:32:54 2022 +0000

    Converted FFI imports from ccall to capi.

    Fixes #73. Part of #63.
$ uname -a
Darwin MacBook-Pro.local 22.2.0 Darwin Kernel Version 22.2.0: Fri Nov 11 02:03:51 PST 2022; root:xnu-8792.61.2~4/RELEASE_ARM64_T6000 arm64

I have openssl@3 installed via Homebrew and PKG_CONFIG_PATH set like this:

export PKG_CONFIG_PATH="/opt/homebrew/opt/openssl@3/lib/pkgconfig"
$ pkg-config --libs libssl
-L/opt/homebrew/Cellar/openssl@3/3.0.7/lib -lssl
@newhoggy newhoggy changed the title Unable to compile hack Unable to compile 0.11.7.3 on Windows and MacOS Dec 20, 2022
@newhoggy
Copy link
Author

The error I get when building is this:

cabal build all --enable-tests
Build profile: -w ghc-9.4.3 -O1
In order, the following will be built (use -v for more details):
 - HsOpenSSL-0.11.7.2 (lib:HsOpenSSL, test:test-der, test:test-dsa, test:test-evp-base64, test:test-evp-digest) (file OpenSSL.hs changed)
Preprocessing library for HsOpenSSL-0.11.7.2..
Building library for HsOpenSSL-0.11.7.2..
[27 of 33] Compiling OpenSSL.X509     ( /Users/jky/wrk/iohk/HsOpenSSL/dist-newstyle/build/aarch64-osx/ghc-9.4.3/HsOpenSSL-0.11.7.2/build/OpenSSL/X509.hs, /Users/jky/wrk/iohk/HsOpenSSL/dist-newstyle/build/aarch64-osx/ghc-9.4.3/HsOpenSSL-0.11.7.2/build/OpenSSL/X509.o, /Users/jky/wrk/iohk/HsOpenSSL/dist-newstyle/build/aarch64-osx/ghc-9.4.3/HsOpenSSL-0.11.7.2/build/OpenSSL/X509.dyn_o ) [Mismatched dynamic interface file]

/var/folders/lm/7n3llnm96td8rxcdz1vx7j7w0000gn/T/ghc40796_0/ghc_22.c:25:100: error:
     error: implicit declaration of function 'X509_email_free' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
   |
25 | void ghczuwrapperZC4ZCHsOpenSSLzm0zi11zi7zi2zminplaceZCOpenSSLziX509ZCX509zuemailzufree(void* a1) {X509_email_free(a1);}
   |                                                                                                    ^
void ghczuwrapperZC4ZCHsOpenSSLzm0zi11zi7zi2zminplaceZCOpenSSLziX509ZCX509zuemailzufree(void* a1) {X509_email_free(a1);}
                                                                                                   ^

/var/folders/lm/7n3llnm96td8rxcdz1vx7j7w0000gn/T/ghc40796_0/ghc_22.c:28:108: error:
     error: implicit declaration of function 'X509_get1_email' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
   |
28 | void* ghczuwrapperZC5ZCHsOpenSSLzm0zi11zi7zi2zminplaceZCOpenSSLziX509ZCX509zuget1zuemail(X509* a1) {return X509_get1_email(a1);}
   |                                                                                                            ^
void* ghczuwrapperZC5ZCHsOpenSSLzm0zi11zi7zi2zminplaceZCOpenSSLziX509ZCX509zuget1zuemail(X509* a1) {return X509_get1_email(a1);}
                                                                                                           ^

/var/folders/lm/7n3llnm96td8rxcdz1vx7j7w0000gn/T/ghc40796_0/ghc_22.c:28:108: error:
     note: did you mean 'X509_get_ext'?
   |
28 | void* ghczuwrapperZC5ZCHsOpenSSLzm0zi11zi7zi2zminplaceZCOpenSSLziX509ZCX509zuget1zuemail(X509* a1) {return X509_get1_email(a1);}
   |                                                                                                            ^

/usr/local/include/openssl/x509.h:1096:17: error:
     note: 'X509_get_ext' declared here
     |
1096 | X509_EXTENSION *X509_get_ext(const X509 *x, int loc);
     |                 ^
X509_EXTENSION *X509_get_ext(const X509 *x, int loc);
                ^

/var/folders/lm/7n3llnm96td8rxcdz1vx7j7w0000gn/T/ghc40796_0/ghc_22.c:28:108: error:
     warning: incompatible integer to pointer conversion returning 'int' from a function with result type 'void *' [-Wint-conversion]
   |
28 | void* ghczuwrapperZC5ZCHsOpenSSLzm0zi11zi7zi2zminplaceZCOpenSSLziX509ZCX509zuget1zuemail(X509* a1) {return X509_get1_email(a1);}
   |                                                                                                            ^
void* ghczuwrapperZC5ZCHsOpenSSLzm0zi11zi7zi2zminplaceZCOpenSSLziX509ZCX509zuget1zuemail(X509* a1) {return X509_get1_email(a1);}
                                                                                                           ^~~~~~~~~~~~~~~~~~~

In file included from /var/folders/lm/7n3llnm96td8rxcdz1vx7j7w0000gn/T/ghc40796_0/ghc_22.c:45:0: error:


In file included from cbits/HsOpenSSL.h:20:0: error:

/usr/local/include/openssl/x509v3.h:1011:27: error:
     error: conflicting types for 'X509_get1_email'
     |
1011 | STACK_OF(OPENSSL_STRING) *X509_get1_email(X509 *x);
     |                           ^
STACK_OF(OPENSSL_STRING) *X509_get1_email(X509 *x);
                          ^

/var/folders/lm/7n3llnm96td8rxcdz1vx7j7w0000gn/T/ghc40796_0/ghc_22.c:28:108: error:
     note: previous implicit declaration is here
   |
28 | void* ghczuwrapperZC5ZCHsOpenSSLzm0zi11zi7zi2zminplaceZCOpenSSLziX509ZCX509zuget1zuemail(X509* a1) {return X509_get1_email(a1);}
   |                                                                                                            ^
void* ghczuwrapperZC5ZCHsOpenSSLzm0zi11zi7zi2zminplaceZCOpenSSLziX509ZCX509zuget1zuemail(X509* a1) {return X509_get1_email(a1);}
                                                                                                           ^

In file included from /var/folders/lm/7n3llnm96td8rxcdz1vx7j7w0000gn/T/ghc40796_0/ghc_22.c:45:0: error:


In file included from cbits/HsOpenSSL.h:20:0: error:

/usr/local/include/openssl/x509v3.h:1013:6: error:
     error: conflicting types for 'X509_email_free'
     |
1013 | void X509_email_free(STACK_OF(OPENSSL_STRING) *sk);
     |      ^
void X509_email_free(STACK_OF(OPENSSL_STRING) *sk);
     ^

/var/folders/lm/7n3llnm96td8rxcdz1vx7j7w0000gn/T/ghc40796_0/ghc_22.c:25:100: error:
     note: previous implicit declaration is here
   |
25 | void ghczuwrapperZC4ZCHsOpenSSLzm0zi11zi7zi2zminplaceZCOpenSSLziX509ZCX509zuemailzufree(void* a1) {X509_email_free(a1);}
   |                                                                                                    ^
void ghczuwrapperZC4ZCHsOpenSSLzm0zi11zi7zi2zminplaceZCOpenSSLziX509ZCX509zuemailzufree(void* a1) {X509_email_free(a1);}
                                                                                                   ^
1 warning and 4 errors generated.

<no location info>: error:
    `gcc' failed in phase `C Compiler'. (Exit code: 1)

@glguy
Copy link

glguy commented Dec 20, 2022

The issue seems to be that we need to import x509v3.h and not x509.h in the various CApi FFI imports. replacing those import got things building again for me.

@juhp
Copy link

juhp commented Dec 21, 2022

Seeing the same issue for Stackage Nightly for Linux

juhp added a commit to commercialhaskell/stackage that referenced this issue Dec 21, 2022
@kamek-pf
Copy link

Same thing here on Linux with Cabal.

@vshabanov
Copy link
Collaborator

Can you check whether ac3ca14 (or https://hackage.haskell.org/package/HsOpenSSL-0.11.7.4/candidate) compiles for you?

@vshabanov
Copy link
Collaborator

Sorry, can you check 2062a24 instead?

@newhoggy
Copy link
Author

build-1.txt

build-2.txt

Builds for me, but with a lot of warnings.

@vshabanov
Copy link
Collaborator

Published 0.11.7.4 with these fixes, 0.11.7.3 is deprecated on Hackage.

There are a lot of warnings since there are a lot of deprecated functions in OpenSSL 3.0 (#63). Plus there are const/non-const pointer conversion warnings due to CApiFFI (perhaps it's possible to fix those).

@amesgen
Copy link

amesgen commented Dec 21, 2022

Plus there are const/non-const pointer conversion warnings due to CApiFFI (perhaps it's possible to fix those).

Sadly, this is not possible right now, but it will be in GHC 9.6 via ConstPtr (see https://gitlab.haskell.org/ghc/ghc/-/issues/22043).

juhp added a commit to commercialhaskell/stackage that referenced this issue Dec 22, 2022
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

6 participants