
#318: Library cannnot be used when registered in-place on OS X ----------------------------+----------------------------------------------- Reporter: guest | Owner: Type: defect | Status: closed Priority: normal | Milestone: Cabal-1.8 Component: Cabal library | Version: 1.4.0.1 Severity: normal | Resolution: fixed Keywords: | Difficulty: easy (<4 hours) Ghcversion: 6.8.3 | Platform: Mac OS ----------------------------+----------------------------------------------- Comment (by guest): With this change, if multiple {{{ar}}} invocations add object files with identical names, only one of these object files is kept in the archive. This can happen if a package has two modules with the same basename and {{{--enable-split-objs}}} is used. Here is a toy script that demonstrates the problem: {{{ # AR="/usr/bin/ar -q -c" AR="/usr/bin/ar -r -s -c" echo 'void f() { }' > a.c gcc -c a.c rm a.a $AR a.a a.o $AR a.a a.o ar -s a.a ar -t a.a }}} To solve this problem, we can go back to using 'ar -q' and then doing a 'ranlib' or 'ar -s' in the end. However, I'd propose that we rename the {{{.o}}} files to have unique names, because that has a better chance of being portable. (For linking, the name of the object file in the archive is immaterial) The problem manifests itself in the form of link errors when using the affected package, like this one: {{{ /opt/ghc-6.11/lib/HTTP-4000.0.7/ghc-6.11.20090605/libHSHTTP-4000.0.7.a(Headers__166.o): In function `sbwI_info': (.text+0xbe): undefined reference to `HTTPzm4000zi0zi7_NetworkziStream_ErrorParse_con_info' }}} I'm using GNU ar of binutils 2.18. I'm not sure whether this is a bug in {{{ar}}} or not. -- Ticket URL: http://hackage.haskell.org/trac/hackage/ticket/318#comment:12 Hackage http://haskell.org/cabal/ Hackage: Cabal and related projects