我需要 libstdc++,其中包含适用于 redhat 5 系统上 64 位平台的 GLIBCXX_3_4_9 库。这是应用程序所必需的。我尝试从 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)
答案1
下面的脚本完成了这一切。它不仅下载并编译GCC4.4包,还下载并编译必要的依赖项。您可能需要#yum install zsh
在运行此脚本之前安装,因为此脚本在 zsh shell 下运行。感谢西蒙·海姆利彻在他的网站上提供了这个脚本博客。
#!/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"
答案2
RHEL6
root@ibxsv-asnis1 ~]# rpm -q --provides libstdc++
libstdc++ = 4.4.4-15.el6
libstdc++.so.6()(64bit)
libstdc++.so.6(CXXABI_1.3)(64bit)
libstdc++.so.6(CXXABI_1.3.1)(64bit)
libstdc++.so.6(CXXABI_1.3.2)(64bit)
libstdc++.so.6(CXXABI_1.3.3)(64bit)
libstdc++.so.6(GLIBCXX_3.4)(64bit)
libstdc++.so.6(GLIBCXX_3.4.1)(64bit)
libstdc++.so.6(GLIBCXX_3.4.10)(64bit)
libstdc++.so.6(GLIBCXX_3.4.11)(64bit)
libstdc++.so.6(GLIBCXX_3.4.12)(64bit)
libstdc++.so.6(GLIBCXX_3.4.13)(64bit)
libstdc++.so.6(GLIBCXX_3.4.2)(64bit)
libstdc++.so.6(GLIBCXX_3.4.3)(64bit)
libstdc++.so.6(GLIBCXX_3.4.4)(64bit)
libstdc++.so.6(GLIBCXX_3.4.5)(64bit)
libstdc++.so.6(GLIBCXX_3.4.6)(64bit)
libstdc++.so.6(GLIBCXX_3.4.7)(64bit)
libstdc++.so.6(GLIBCXX_3.4.8)(64bit)
libstdc++.so.6(GLIBCXX_3.4.9)(64bit)
libstdc++ = 4.4.7-4.el6
libstdc++(x86-64) = 4.4.7-4.el6
[root@ibxsv-asnis1 ~]# rpm -q libstdc++
libstdc++-4.4.7-4.el6.x86_64
答案3
当你用 yum 安装 g++ 时,它本身就解决了依赖问题。
所以尝试:
yum search g++
然后找出 pacjage g++
,当你想安装它时,它会安装它的依赖项。它的依赖项之一是libstdc++