Opened 3 years ago

Closed 3 years ago

#8795 closed bug (fixed)

Build fails on Solaris 10 due to missing ranlib

Reported by: kgardas Owned by: kgardas
Priority: normal Milestone: 7.8.1
Component: Compiler Version: 7.8.1-rc1
Keywords: Cc:
Operating System: Solaris Architecture: x86_64 (amd64)
Type of failure: Building GHC failed Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


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 ... 
"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 =="   --constraint "hpc =="   --constraint "bin-package-db =="   --constraint "hoopl =="   --constraint "transformers =="   --constraint "terminfo ==" --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-
ghc-cabal: Cannot find the program 'ranlib' at ':' or on the path
gmake[1]: *** [libraries/Cabal/Cabal/dist-boot/] Error 1

the reason for this failure is that in 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

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'

Attachments (1)

0001-fix-build-failure-on-Solaris-10-due-to-RANLIB-being-.patch (983 bytes) - added by kgardas 3 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 Changed 3 years ago by kgardas

Owner: set to kgardas

comment:2 Changed 3 years ago by kgardas

Milestone: 7.8.1
Status: newpatch

comment:3 Changed 3 years ago by Austin Seipp <austin@…>

In 5c6ced556a989e7fccfa2d4adc6f6bbe538a8e6c/ghc:

fix build failure on Solaris 10 due to RANLIB being set to ':' by configure (#8795)

Signed-off-by: Austin Seipp <>

comment:4 Changed 3 years ago by thoughtpolice

Status: patchmerge

comment:5 Changed 3 years ago by thoughtpolice

Resolution: fixed
Status: mergeclosed
Note: See TracTickets for help on using tickets.