Opened 2 months ago

Closed 8 weeks 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 Difficulty: Easy (less than 1 hour)
Test Case: Blocked By:
Blocking: Related Tickets:

Description

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'

Attachments (1)

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

Download all attachments as: .zip

Change History (6)

comment:1 Changed 2 months ago by kgardas

  • Owner set to kgardas

comment:2 Changed 2 months ago by kgardas

  • Milestone set to 7.8.1
  • Status changed from new to patch
  • Version changed from 7.9 to 7.8.1-rc1

comment:3 Changed 8 weeks 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 <austin@well-typed.com>

comment:4 Changed 8 weeks ago by thoughtpolice

  • Status changed from patch to merge

comment:5 Changed 8 weeks ago by thoughtpolice

  • Resolution set to fixed
  • Status changed from merge to closed
Note: See TracTickets for help on using tickets.