Build fails on Solaris 10 due to missing ranlib
Hello, On Solaris 10 and GHC HEAD I get this compilation failure:
Linking utils/ghc-cabal/dist/build/tmp/ghc-cabal ...
"touch" utils/ghc-cabal/dist/build/tmp/ghc-cabal
"cp" utils/ghc-cabal/dist/build/tmp/ghc-cabal inplace/bin/ghc-cabal
"inplace/bin/mkdirhier" compiler/stage1/build//.
"rm" -f compiler/stage1/build/Config.hs
Creating compiler/stage1/build/Config.hs ...
done.
"inplace/bin/ghc-cabal" configure libraries/Cabal/Cabal dist-boot "" --with-ghc="/home/karel/sfw/ghc-7.6.3-new-dist/bin/ghc" --with-ghc-pkg="/home/karel/sfw/ghc-7.6.3-new-dist/bin/ghc-pkg" --package-db=/silence/home/karel/vcs/ghc-src/ghc-sunos5.1x-ranlib-fix/libraries/bootstrapping.conf --disable-library-for-ghci --enable-library-vanilla --enable-library-for-ghci --disable-library-profiling --disable-shared --configure-option=CFLAGS=" -U__i686 " --configure-option=LDFLAGS=" " --configure-option=CPPFLAGS=" " --constraint "Cabal == 1.18.1.3" --constraint "hpc == 0.6.0.1" --constraint "bin-package-db == 0.0.0.0" --constraint "hoopl == 3.10.0.0" --constraint "transformers == 0.3.0.0" --constraint "terminfo == 0.4.0.0" --with-gcc="/usr/sfw/bin/gcc" --configure-option=--with-cc="/usr/sfw/bin/gcc" --with-ar="/usr/xpg4/bin/ar" --with-ranlib=":" --with-alex="/home/karel/.cabal/bin/alex" --with-happy="/home/karel/.cabal/bin/happy"
Configuring Cabal-1.18.1.3...
ghc-cabal: Cannot find the program 'ranlib' at ':' or on the path
gmake[1]: *** [libraries/Cabal/Cabal/dist-boot/package-data.mk] Error 1
the reason for this failure is that in configure.ac we're using FP_PROG_AR_NEEDS_RANLIB which is defined in aclocal.m4 and uses AC_PROG_RANLIB in its body. The problem is that if ranlib is not found then AC_PROG_RANLIB sets RANLIB variable to :' which is preferred way of no-op in POSIX shell even slightly more preferable than setting it to true (google for it if you care). Anyway, ghc-cabal tries to execute
:', but this fails since this is shell built-in and not the program/application on the target OS.
The fix should be easy, test if RANLIB is set to `:' and set it to true. This works since true is actually a program/application on Solaris 10:
{{{
$ which true
/usr/bin/true
}}}
Please note that such failure will happen on all OSes (Unix(-like)) which do not provide ranlib command. Also please note that Solaris 11 is not hit by this issue since it provides ranlib in a form of shell wrapper actually calling just `exit 0'
Trac metadata
Trac field | Value |
---|---|
Version | 7.9 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |