Rpm

RHEL 5 64 位系統上 GLIBCXX_3_4_9 庫的應用程序需要 libstdc++

  • November 20, 2014

我需要在 redhat 5 系統上擁有包含用於 64 位平台的 GLIBCXX_3_4_9 庫的 libstdc++。這是應用程序所要求的。我嘗試從 RHEL 6 儲存庫安裝以下 rpm,但收到了幾條依賴失敗錯誤消息

libstdc++-docs-4.4.7-4.el6.x86_64.rpm
libstdc++-devel-4.4.7-4.el6.x86_64.rpm
libstdc++-4.4.7-4.el6.x86_64.rpm
compat-libstdc++-33-3.2.3-69.el6.x86_64.rpm
compat-libstdc++-296-2.96-144.el6.i686.rpm


# rpm -Uvh libstdc++-4.4.7-4.el6.x86_64.rpm libstdc++-devel-4.4.7-4.el6.x86_64.rpm compat-libstdc++-296-2.96-144.el6.i686.rpm compat-libstdc++-33-3.2.3-69.el6.x86_64.rpm

           warning: libstdc++-4.4.7-4.el6.x86_64.rpm: Header V3 RSA/SHA256 signature: NOKEY, key ID fd431d51
       error: Failed dependencies:
               glibc >= 2.10.90-7 is needed by libstdc++-4.4.7-4.el6.x86_64
               rpmlib(FileDigests) <= 4.6.0-1 is needed by libstdc++-4.4.7-4.el6.x86_64
               rpmlib(PayloadIsXz) <= 5.2-1 is needed by libstdc++-4.4.7-4.el6.x86_64
               rpmlib(FileDigests) <= 4.6.0-1 is needed by libstdc++-devel-4.4.7-4.el6.x86_64
               rpmlib(PayloadIsXz) <= 5.2-1 is needed by libstdc++-devel-4.4.7-4.el6.x86_64
               libc.so.6(GLIBC_2.12) is needed by compat-libstdc++-296-2.96-144.el6.i686
               rpmlib(FileDigests) <= 4.6.0-1 is needed by compat-libstdc++-296-2.96-144.el6.i686
               rpmlib(PayloadIsXz) <= 5.2-1 is needed by compat-libstdc++-296-2.96-144.el6.i686
               rpmlib(FileDigests) <= 4.6.0-1 is needed by compat-libstdc++-33-3.2.3-69.el6.x86_64
               rpmlib(PayloadIsXz) <= 5.2-1 is needed by compat-libstdc++-33-3.2.3-69.el6.x86_64
               libstdc++ = 4.1.2-54.el5 is needed by (installed) gcc-c++-4.1.2-54.el5.x86_64
               libstdc++ = 4.1.2 is needed by (installed) libstdc++44-devel-4.4.7-1.el5.x86_64
               libstdc++ = 4.1.2 is needed by (installed) libstdc++44-devel-4.4.7-1.el5.i386
               libstdc++-devel = 4.1.2-54.el5 is needed by (installed) gcc-c++-4.1.2-54.el5.x86_64

有沒有辦法在 redheat 5(64 位)系統上安裝這個 libstdc++.so.6.0.9 或更高版本?

更新:

這是輸出yum search

  # yum search gcc-c++ 
  Loaded plugins: product-id, rhnplugin, security, subscription-manager
  This system is not registered to Red Hat Subscription Management. You can use                subscription-manager to register.
  This system is receiving updates from RHN Classic or RHN Satellite.
 ======================================================================================         Matched: gcc-c++ ======================================================================================
   gcc-c++.x86_64 : C++ support for GCC

我已從 rhn 6 儲存庫下載 gcc++ 的最新版本,但收到以下錯誤:

       # yum install gcc-c++-4.4.7-4.el6.x86_64.rpm
       Loaded plugins: product-id, rhnplugin, security, subscription-manager
       This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
       This system is receiving updates from RHN Classic or RHN Satellite.
       Setting up Install Process
       Examining gcc-c++-4.4.7-4.el6.x86_64.rpm: gcc-c++-4.4.7-4.el6.x86_64
       Marking gcc-c++-4.4.7-4.el6.x86_64.rpm as an update to gcc-c++-4.1.2-54.el5.x86_64
       Resolving Dependencies
       --> Running transaction check
       ---> Package gcc-c++.x86_64 0:4.4.7-4.el6 set to be updated
       --> Processing Dependency: gcc = 4.4.7-4.el6 for package: gcc-c++
       --> Processing Dependency: libstdc++ = 4.4.7-4.el6 for package: gcc-c++
       --> Processing Dependency: libstdc++-devel = 4.4.7-4.el6 for package: gcc-c++
       --> Processing Dependency: libc.so.6(GLIBC_2.11)(64bit) for package: gcc-c++
       --> Processing Dependency: libc.so.6(GLIBC_2.7)(64bit) for package: gcc-c++
       --> Processing Dependency: libgmp.so.3()(64bit) for package: gcc-c++
       --> Processing Dependency: libmpfr.so.1()(64bit) for package: gcc-c++
       --> Running transaction check
       ---> Package gcc-c++.x86_64 0:4.4.7-4.el6 set to be updated
       --> Processing Dependency: gcc = 4.4.7-4.el6 for package: gcc-c++
       --> Processing Dependency: libstdc++ = 4.4.7-4.el6 for package: gcc-c++
       --> Processing Dependency: libstdc++-devel = 4.4.7-4.el6 for package: gcc-c++
       --> Processing Dependency: libc.so.6(GLIBC_2.11)(64bit) for package: gcc-c++
       --> Processing Dependency: libc.so.6(GLIBC_2.7)(64bit) for package: gcc-c++
       --> Processing Dependency: libmpfr.so.1()(64bit) for package: gcc-c++
       ---> Package gmp.x86_64 0:4.1.4-10.el5 set to be updated
       --> Finished Dependency Resolution
       gcc-c++-4.4.7-4.el6.x86_64 from /gcc-c++-4.4.7-4.el6.x86_64 has depsolving problems
         --> Missing Dependency: libstdc++-devel = 4.4.7-4.el6 is needed by package gcc-c++-4.4.7-4.el6.x86_64 (/gcc-c++-4.4.7-4.el6.x86_64)
       gcc-c++-4.4.7-4.el6.x86_64 from /gcc-c++-4.4.7-4.el6.x86_64 has depsolving problems
         --> Missing Dependency: libmpfr.so.1()(64bit) is needed by package gcc-c++-4.4.7-4.el6.x86_64 (/gcc-c++-4.4.7-4.el6.x86_64)
       gcc-c++-4.4.7-4.el6.x86_64 from /gcc-c++-4.4.7-4.el6.x86_64 has depsolving problems
         --> Missing Dependency: libc.so.6(GLIBC_2.7)(64bit) is needed by package gcc-c++-4.4.7-4.el6.x86_64 (/gcc-c++-4.4.7-4.el6.x86_64)
       gcc-c++-4.4.7-4.el6.x86_64 from /gcc-c++-4.4.7-4.el6.x86_64 has depsolving problems
         --> Missing Dependency: gcc = 4.4.7-4.el6 is needed by package gcc-c++-4.4.7-4.el6.x86_64 (/gcc-c++-4.4.7-4.el6.x86_64)
       gcc-c++-4.4.7-4.el6.x86_64 from /gcc-c++-4.4.7-4.el6.x86_64 has depsolving problems
         --> Missing Dependency: libstdc++ = 4.4.7-4.el6 is needed by package gcc-c++-4.4.7-4.el6.x86_64 (/gcc-c++-4.4.7-4.el6.x86_64)
       gcc-c++-4.4.7-4.el6.x86_64 from /gcc-c++-4.4.7-4.el6.x86_64 has depsolving problems
         --> Missing Dependency: libc.so.6(GLIBC_2.11)(64bit) is needed by package gcc-c++-4.4.7-4.el6.x86_64 (/gcc-c++-4.4.7-4.el6.x86_64)
       Error: Missing Dependency: libstdc++ = 4.4.7-4.el6 is needed by package gcc-c++-4.4.7-4.el6.x86_64 (/gcc-c++-4.4.7-4.el6.x86_64)
       Error: Missing Dependency: libc.so.6(GLIBC_2.7)(64bit) is needed by package gcc-c++-4.4.7-4.el6.x86_64 (/gcc-c++-4.4.7-4.el6.x86_64)
       Error: Missing Dependency: gcc = 4.4.7-4.el6 is needed by package gcc-c++-4.4.7-4.el6.x86_64 (/gcc-c++-4.4.7-4.el6.x86_64)
       Error: Missing Dependency: libstdc++-devel = 4.4.7-4.el6 is needed by package gcc-c++-4.4.7-4.el6.x86_64 (/gcc-c++-4.4.7-4.el6.x86_64)
       Error: Missing Dependency: libc.so.6(GLIBC_2.11)(64bit) is needed by package gcc-c++-4.4.7-4.el6.x86_64 (/gcc-c++-4.4.7-4.el6.x86_64)
       Error: Missing Dependency: libmpfr.so.1()(64bit) is needed by package gcc-c++-4.4.7-4.el6.x86_64 (/gcc-c++-4.4.7-4.el6.x86_64)

以下腳本完成了所有工作。它不僅下載和編譯GCC4.4包,還下載和編譯必要的依賴項。您可能需要#yum install zsh在執行此腳本之前安裝,因為此腳本在 zsh shell 下執行。感謝 Simon Heimlicher 在他的部落格上提供了這個腳本。

   #!/usr/bin/env zsh
   # Download and compile GCC 4.4

   set -ue

   # Set minimal PATH to make sure we compile with the system compiler
   export PATH=/usr/sbin:/usr/bin:/sbin:/bin
   # Use bash as the shell for everything GNU
   export CONFIG_SHELL=/bin/bash

   # Set to true for verbose output
   VERBOSE=${VERBOSE:=false}

   out () { printf "\n%b\n\n" "$@" >&2 }
   fail () { printf "\n%b\n\n" " $@ " >&2; exit 1 }

   DSTROOT=${DSTROOT:=$HOME/local}
   PKGROOT=${PKGROOT:=$DSTROOT/pkg}
   SCRATCH=${SCRATCH:-$HOME/scratch}
   SRCDIR=${SRCDIR:=$SCRATCH/gcc/src}
   BUILDDIR=${BUILDDIR:=$SCRATCH/gcc/build}

   GCC_URL=http://mirror.switch.ch/ftp/mirror/gnu/gcc/gcc-4.4.7/gcc-4.4.7.tar.bz2

   GCC_PREREQUISITE_URLS=(
   ftp://gcc.gnu.org/pub/gcc/infrastructure/gmp-4.3.2.tar.bz2
   ftp://gcc.gnu.org/pub/gcc/infrastructure/mpfr-2.4.2.tar.bz2
   ftp://gcc.gnu.org/pub/gcc/infrastructure/mpc-0.8.1.tar.gz
   http://www.mr511.de/software/libelf-0.8.13.tar.gz
   )

   out "DSTROOT='$DSTROOT'
   PKGROOT='$PKGROOT'
   SRCDIR='$SRCDIR'
   BUILDDIR='$BUILDDIR'"

   runcmd() {
    RUN_RET=0
    RUN_CWD='.'
    RUN_FORCE=false
    o_cwd=''; o_force=''
    zparseopts -D -K -- c:=o_cwd f=o_force -cwd:=o_cwd -force=o_force
    if [[ $# -eq 0 ]]; then
        print "Usage: runcmd [-f] <command line to run>" >&2
        return 1
    fi
    if [[ -n $o_cwd ]]; then RUN_CWD=$o_cwd[2]; fi
    if [[ -n $o_force ]]; then RUN_FORCE=true; fi
    cmdline=$@
    if $VERBOSE; then
        print "Running\n    ${(@)cmdline}\nRUN_FORCE=$RUN_FORCE RUN_CWD=$RUN_CWD" >&2
    fi
    ( set +ue; cd $RUN_CWD && print ${(@)cmdline} | $CONFIG_SHELL -sue; )
    RUN_RET=$?
    if [[ $RUN_RET -ne 0 ]]; then
        if $RUN_FORCE; then
            print "\n### $cmdline\nexit $RUN_RET in CWD=$RUN_CWD\n" >&2
        else
            print "\n\n### $cmdline\nexit $RUN_RET in CWD=$RUN_CWD\nAbort." >&2
            exit $RUN_RET
        fi
    fi
    return $RUN_RET
   }

   prepare_pkg () {
    local srcdir=$1
    local url=$2
    local pkgvers=${${url##*/}%.(tar*|zip)}
    local pkg=${pkgvers%-*}
    local vers=${pkgvers#*-}
    local suffix=${${url##*/}##*.}
    out "Fetching $pkgvers from $url"
    case $suffix in
        gz)
        runcmd -c $srcdir curl -L $url \| tar xz
        ;;
        bz2|tbz)
        runcmd -c $srcdir curl -L $url \| tar xj
        ;;
        zip)
        runcmd -c $srcdir curl -L $url \| funzip
        ;;
        *)
        fail "Unknown archive format: $url"
        ;;
    esac
    if [[ ! -d $srcdir/$pkgvers ]]; then
        fail "Extraction of download from $url failed"
    fi
    runcmd -c $srcdir ln -sf $pkgvers $pkg
   }

   if $VERBOSE; then
    printf "Using system compiler: '%s'" $(which gcc)
    gcc --version
   fi

   out "Making directories \n$DSTROOT\n$PKGROOT\n$SRCDIR\n$BUILDDIR"

   runcmd mkdir -p $DSTROOT $PKGROOT $SRCDIR $BUILDDIR

   GCC_PKG=${${GCC_URL##*/}%.(tar*|zip)}
   GCC_SRC=$SRCDIR/$GCC_PKG
   GCC_PREFIX=$PKGROOT/$GCC_PKG
   GCC_BUILD=$BUILDDIR/$GCC_PKG-build

   if [[ -d $GCC_SRC ]]; then
    out "Using GCC downloaded at $GCC_SRC"
   else
    out "Downloading GCC"
    prepare_pkg $SRCDIR $GCC_URL
   fi

   out "Downloading prerequisites"
   for pkg ($GCC_PREREQUISITE_URLS); do
    prepare_pkg $GCC_SRC $pkg
   done

   if [[ -d $GCC_BUILD ]]; then
    out "Running 'make distclean' in $GCC_BUILD"
    runcmd -c $GCC_BUILD -f make distclean
   else
    out "Making GCC build directory $GCC_BUILD"
    runcmd mkdir -p $GCC_BUILD
   fi

   out "Configuring GCC"
   runcmd -c $GCC_BUILD $GCC_SRC/configure --prefix=$GCC_PREFIX \
   --enable-languages=c,c++,fortran \
   --enable-threads=posix \
   --enable-tls \
   --enable-libgomp \
   --enable-lto \
   --enable-shared \
   --enable-static \
   --disable-nls \
   --disable-multilib \
   --with-fpmath=sse

   out "Compiling GCC"
   runcmd -c $GCC_BUILD make -j 8 all

   out "Installing GCC"
   runcmd -c $GCC_BUILD make -j 8 install

   if which stow &>/dev/null; then
    out "Using 'stow' to symlink GCC from $GCC_PKG"
    runcmd -c $PKGROOT stow $GCC_PKG
   else
    out "Package manager 'stow' not found. GCC is installed in $GCC_PREFIX"
   fi

   print "All done"

引用自:https://unix.stackexchange.com/questions/156509