Disable stripping of hs libraries in Cabal.

It appears that strip --strip-unneeded sometimes strips too much.

For example, if you take libHStf-random-0.5-926BwEbiHzi7pBkp4dTxOe.a
from the hs-tf-random package on i386 and run strip --strip-unneeded
on it, the T Threefish_256_Process_Block symbol (from threefish_block.o)
is stripped, which shouldn't happen. Note: this specific case applies
to i386, not to amd64. But...

doug@ reported a similar problem for the haskell library texmath,
which we don't yet have in the ports tree, and he made some even
more weird observation: texmath contains the two C source files
cbits/{key,val}ToASCII.c, defining the symbols keylookup (in
keyToAscii.c) and toASCIILut (in valToASCII.c), where both are just
some lookup tables. With strip --strip-unneeded enabled, the resulting
libHStexmath-*.a archive is missing keylookup. doug@ then concatenated
both .c files to a new one and changed the .cabal file of texmath
to use that single one instead, and suddenly the symbol keylookup
no longer was removed.

I'll try to make a port for texmath (which would be required anyway
for porting pandoc) so people who want help to debug this don't
have to build all the haskell goo themselves.
This commit is contained in:
kili 2015-09-27 20:07:47 +00:00
parent d1aad7d391
commit 7325eff544
2 changed files with 18 additions and 1 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.123 2015/09/19 07:42:56 kili Exp $
# $OpenBSD: Makefile,v 1.124 2015/09/27 20:07:47 kili Exp $
COMMENT-main = compiler for the functional language Haskell
COMMENT-doc = documentation for GHC
@ -14,6 +14,7 @@ NO_CCACHE = Yes
DISTNAME = ghc-${MODGHC_VER}
PKGNAME-main = ghc-${MODGHC_VER}
REVISION-main = 0
PKGNAME-doc = ghc-doc-${MODGHC_VER}
CATEGORIES = lang devel
HOMEPAGE = https://www.haskell.org/ghc/

View File

@ -0,0 +1,16 @@
$OpenBSD: patch-libraries_Cabal_Cabal_Distribution_Simple_Program_Strip_hs,v 1.1 2015/09/27 20:07:47 kili Exp $
Work around unresolved symbols when linking against hs packages
that use FFI and contain some code compiled from C sources.
--- libraries/Cabal/Cabal/Distribution/Simple/Program/Strip.hs.orig Wed Feb 25 06:13:11 2015
+++ libraries/Cabal/Cabal/Distribution/Simple/Program/Strip.hs Sun Sep 27 21:41:40 2015
@@ -52,6 +52,8 @@ stripLib verbosity (Platform arch os) conf path = do
return ()
IOS -> return ()
Solaris -> return ()
+ OpenBSD -> -- '--strip-unneeded' sometimes strips too much on OpenBSD.
+ return ()
Windows -> -- Stripping triggers a bug in 'strip.exe' for
-- libraries with lots identically named modules. See
-- #1784.