HsOpenSSL 0.10.1.4 won't build #8

Closed
ghost opened this Issue Mar 18, 2012 · 15 comments

Comments

Projects
None yet
5 participants
@ghost

ghost commented Mar 18, 2012

While trying to install the latest version of HsOpenSSL from Hackage or this git repo (0.10.1.4), the build died, complaining about a syntax error on line 54 of the X509.hsc file:

X509.hsc:54:21: error: missing binary operator before token "("

I am using GHC 7.0.4 on Debian.

Owner

depressed-pho commented Mar 19, 2012

Thanks for the report. I'll take a look.

Owner

depressed-pho commented Mar 19, 2012

This is weird. I need more information to identify the culprit.

  1. Try inserting {-# LANGUAGE CPP #-} at the beginning of OpenSSL/X509.hsc. If that works, I can fix the problem in a moment.
  2. And if it doesn't work, check whether dist/build/autogen/cabal_macros.h exists and it contains something like #define MIN_VERSION_base(major1,major2,minor) (...)
  3. If not, you might be using a way too old version of Cabal. What ghc-pkg list Cabal says?
@ghost

ghost commented Mar 20, 2012

The first fix did not work (when I asked about it in #haskell, that was actually what they suggested, loosely).

That *.h file appears to be there, with that define statement.

The Cabal version is 1.10.2.0.

Owner

depressed-pho commented Mar 20, 2012

Hmm... Then let me know how hsc2hs is called to preprocess *.hsc:

% runghc Setup.hs clean
% runghc Setup.hs configure
% runghc Setup.hs build -v

This will print something like:

creating dist/build/OpenSSL
/PATH/TO/hsc2hs --cc=/usr/bin/gcc --ld=/usr/bin/gcc
 ... --cflag=-include --cflag=dist/build/autogen/cabal_macros.h
 ... -o dist/build/OpenSSL/X509.hs OpenSSL/X509.hsc

The important thing is whether Cabal is calling hsc2hs with a cflag to inject cabal_macros.h. If this is the case, I have no idea what is going on...

FYI, I'm using ghc-7.4.1 / Cabal-1.14.0 and can't reproduce the problem.

Hi,

same problem here, I am unable to build 0.10.1.4.
I am running ubuntu 10.04, with latest haskell plateform and cabal-dev.

Here is the crash trace on my system, with gcc 4.4.3

creating dist/build/OpenSSL
/usr/local/haskell/ghc-7.0.4/bin/hsc2hs --cc=/usr/bin/gcc --ld=/usr/bin/gcc --cflag=-fno-stack-protector --lflag=-fno-stack-protector --cflag=-D__GLASGOW_HASKELL__=700 --cflag=-Dlinux_BUILD_OS --cflag=-Dlinux_HOST_OS --cflag=-Dx86_64_BUILD_ARCH --cflag=-Dx86_64_HOST_ARCH --cflag=-Icbits --cflag=-D --cflag=PTHREAD --cflag=-DCALLCONV=ccall --lflag=-lcrypto --lflag=-lssl --cflag=-I/usr/local/haskell/ghc-7.0.4/lib/ghc-7.0.4/time-1.2.0.3/include --cflag=-I/usr/local/haskell/hp-2011.4.0.0/lib/network-2.3.0.5/ghc-7.0.4/include --cflag=-I/usr/local/haskell/ghc-7.0.4/lib/ghc-7.0.4/unix-2.4.2.0/include --cflag=-I/usr/local/haskell/ghc-7.0.4/lib/ghc-7.0.4/bytestring-0.9.1.10/include --cflag=-I/usr/local/haskell/ghc-7.0.4/lib/ghc-7.0.4/base-4.3.1.0/include --cflag=-I/usr/local/haskell/ghc-7.0.4/lib/ghc-7.0.4/include --cflag=-I/usr/local/haskell/ghc-7.0.4/lib/ghc-7.0.4/include --lflag=-L/usr/local/haskell/ghc-7.0.4/lib/ghc-7.0.4/time-1.2.0.3 --lflag=-Wl,-R,/usr/local/haskell/ghc-7.0.4/lib/ghc-7.0.4/time-1.2.0.3 --lflag=-L/usr/local/haskell/ghc-7.0.4/lib/ghc-7.0.4/old-locale-1.0.0.2 --lflag=-Wl,-R,/usr/local/haskell/ghc-7.0.4/lib/ghc-7.0.4/old-locale-1.0.0.2 --lflag=-L/usr/local/haskell/hp-2011.4.0.0/lib/network-2.3.0.5/ghc-7.0.4 --lflag=-Wl,-R,/usr/local/haskell/hp-2011.4.0.0/lib/network-2.3.0.5/ghc-7.0.4 --lflag=-L/usr/local/haskell/ghc-7.0.4/lib/ghc-7.0.4/unix-2.4.2.0 --lflag=-Wl,-R,/usr/local/haskell/ghc-7.0.4/lib/ghc-7.0.4/unix-2.4.2.0 --lflag=-lrt --lflag=-lutil --lflag=-ldl --lflag=-L/usr/local/haskell/hp-2011.4.0.0/lib/parsec-3.1.1/ghc-7.0.4 --lflag=-Wl,-R,/usr/local/haskell/hp-2011.4.0.0/lib/parsec-3.1.1/ghc-7.0.4 --lflag=-L/usr/local/haskell/hp-2011.4.0.0/lib/mtl-2.0.1.0/ghc-7.0.4 --lflag=-Wl,-R,/usr/local/haskell/hp-2011.4.0.0/lib/mtl-2.0.1.0/ghc-7.0.4 --lflag=-L/usr/local/haskell/hp-2011.4.0.0/lib/transformers-0.2.2.0/ghc-7.0.4 --lflag=-Wl,-R,/usr/local/haskell/hp-2011.4.0.0/lib/transformers-0.2.2.0/ghc-7.0.4 --lflag=-L/usr/local/haskell/ghc-7.0.4/lib/ghc-7.0.4/bytestring-0.9.1.10 --lflag=-Wl,-R,/usr/local/haskell/ghc-7.0.4/lib/ghc-7.0.4/bytestring-0.9.1.10 --lflag=-L/usr/local/haskell/ghc-7.0.4/lib/ghc-7.0.4/base-4.3.1.0 --lflag=-Wl,-R,/usr/local/haskell/ghc-7.0.4/lib/ghc-7.0.4/base-4.3.1.0 --lflag=-L/usr/local/haskell/ghc-7.0.4/lib/ghc-7.0.4/integer-gmp-0.2.0.3 --lflag=-Wl,-R,/usr/local/haskell/ghc-7.0.4/lib/ghc-7.0.4/integer-gmp-0.2.0.3 --lflag=-lgmp --lflag=-L/usr/local/haskell/ghc-7.0.4/lib/ghc-7.0.4/ghc-prim-0.2.0.0 --lflag=-Wl,-R,/usr/local/haskell/ghc-7.0.4/lib/ghc-7.0.4/ghc-prim-0.2.0.0 --lflag=-L/usr/local/haskell/ghc-7.0.4/lib/ghc-7.0.4 --lflag=-Wl,-R,/usr/local/haskell/ghc-7.0.4/lib/ghc-7.0.4 --lflag=-lm --lflag=-lrt --lflag=-ldl --lflag=-L/usr/local/haskell/ghc-7.0.4/lib/ghc-7.0.4 --lflag=-Wl,-R,/usr/local/haskell/ghc-7.0.4/lib/ghc-7.0.4 -o dist/build/OpenSSL/X509.hs OpenSSL/X509.hsc
X509.hsc:54:21: error: missing binary operator before token "("
X509.hsc:54:21: error: missing binary operator before token "("
X509.hsc:54:21: error: missing binary operator before token "("
compiling dist/build/OpenSSL/X509_hsc_make.c failed (exit code 1)
command was: /usr/bin/gcc -c dist/build/OpenSSL/X509_hsc_make.c -o dist/build/OpenSSL/X509_hsc_make.o -fno-stack-protector -fno-stack-protector -D__GLASGOW_HASKELL__=700 -Dlinux_BUILD_OS -Dlinux_HOST_OS -Dx86_64_BUILD_ARCH -Dx86_64_HOST_ARCH -Icbits -D PTHREAD -DCALLCONV=ccall -I/usr/local/haskell/ghc-7.0.4/lib/ghc-7.0.4/time-1.2.0.3/include -I/usr/local/haskell/hp-2011.4.0.0/lib/network-2.3.0.5/ghc-7.0.4/include -I/usr/local/haskell/ghc-7.0.4/lib/ghc-7.0.4/unix-2.4.2.0/include -I/usr/local/haskell/ghc-7.0.4/lib/ghc-7.0.4/bytestring-0.9.1.10/include -I/usr/local/haskell/ghc-7.0.4/lib/ghc-7.0.4/base-4.3.1.0/include -I/usr/local/haskell/ghc-7.0.4/lib/ghc-7.0.4/include -I/usr/local/haskell/ghc-7.0.4/lib/ghc-7.0.4/include -I/usr/local/haskell/ghc-7.0.4/lib/ghc-7.0.4/include/
Owner

depressed-pho commented Mar 22, 2012

Thank you paul-r-ml, that was the very problem in old Cabal which I'm wondering how to work around...
Give me some time to think it over.

Owner

depressed-pho commented Apr 5, 2012

http://hackage.haskell.org/package/HsOpenSSL-0.10.2
Can you confirm that the problem is actually solved?

danchoi commented Oct 1, 2012

I'm still getting the error originally reported on OS X when I cabal install HsOpenSsl (0.10.3.3). I don't have a problem compiling HsOpenSsl on Ubuntu 12.

danchoi commented Oct 1, 2012

Here is the trace:

Resolving dependencies...
Configuring HsOpenSSL-0.10.3.3...
Preprocessing library HsOpenSSL-0.10.3.3...
PEM.hsc:58:22: error: missing binary operator before token "("
PEM.hsc:58:22: error: missing binary operator before token "("
PEM.hsc:58:22: error: missing binary operator before token "("
compiling dist/build/OpenSSL/PEM_hsc_make.c failed (exit code 1)
command was: /usr/bin/gcc -c dist/build/OpenSSL/PEM_hsc_make.c -o dist/build/OpenSSL/PEM_hsc_make.o -m64 -fno-stack-protector -m64 -D__GLASGOW_HASKELL__=704 -Ddarwin_BUILD_OS -Ddarwin_HOST_OS -Dx86_64_BUILD_ARCH -Dx86_64_HOST_ARCH -Icbits -D PTHREAD -DFAST_BIGNUM -DCALLCONV=ccall -I/usr/local/Cellar/ghc/7.4.2/lib/ghc-7.4.2/time-1.4/include -I/Users/choi/.cabal/lib/network-2.4.0.0/ghc-7.4.2/include -I/usr/local/Cellar/ghc/7.4.2/lib/ghc-7.4.2/unix-2.5.1.1/include -I/usr/local/Cellar/ghc/7.4.2/lib/ghc-7.4.2/bytestring-0.9.2.1/include -I/usr/local/Cellar/ghc/7.4.2/lib/ghc-7.4.2/base-4.5.1.0/include -I/usr/local/Cellar/ghc/7.4.2/lib/ghc-7.4.2/include -I/usr/local/Cellar/ghc/7.4.2/lib/ghc-7.4.2/include/
cabal: Error: some packages failed to install:
HsOpenSSL-0.10.3.3 failed during the building phase. The exception was:
ExitFailure 1

danchoi commented Oct 1, 2012

I got the library to build just by deleting the problematic macros. I'm on a recent GHC so deleting them didn't affect the build

@ghost

ghost commented Apr 4, 2013

I'm getting the exact same error as danchoi on centos 6.3 with ghc 7.4.2, cabal-install 0.10.2 and cabal 1.10.2.0.

roman commented May 30, 2013

Got bad news for you, the hack on:

https://github.com/phonohawk/HsOpenSSL/blob/24f927ef7cbe1b2be382846e03f150ee605aa789/cbits/HsOpenSSL.h#L29

Won't work when using cabal sandbox, which is the new version of cabal-dev, the code is relying on the folder name being "dist", while in cabal sandbox is something like "dist-sandbox-" and it won't compile correctly.

I already submitted an issue to haskell/cabal#1351 regarding this issue.

This hack won't work with any non-standard builddir, e.g. cabal configure --builddir foo && cabal build --builddir foo will also fail.

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