graalvm打包最后一步(第七步)报错
【主要错误简述】
It appears as though libstdc++.a is missing. Please install it.
cannot find -lstdc++
【几个要点】
1、-l是link的意思,-lXXX,即缺少哪个库,本例中 缺少库stdc++
2、库对应的包一般都是lib开头,本例中 stdc++对应的就是libstdc++,和报错保持一致
从cannot find 入手解决
locate stdc++ | grep libstdc++.a
# 第一种情况,能查询出结果,例如:
/opt/rh/devtoolset-7/root/usr/lib/gcc/x86_64-redhat-linux/7/libstdc++.a
/opt/rh/devtoolset-7/root/usr/lib/gcc/x86_64-redhat-linux/7/32/libstdc++.a
// 复制到/usr/lib下
cp /opt/rh/devtoolset-7/root/usr/lib/gcc/x86_64-redhat-linux/7/libstdc++.a /usr/lib
// 创建软链接(快捷方式)
cd /usr/lib
ln -s libstdc++.a stdc++
// 查看软链接有没有创建成功
ls -l | grep stdc
// 结果:
lrwxrwxrwx. 1 root root 11 Jun 16 15:04 stdc++ -> libstdc++.a
# 第二种情况,返回为空,则如下处理:
yum search libstdc
// 结果:
compat-libstdc++-33.i686 : Compatibility standard C++ libraries
compat-libstdc++-33.x86_64 : Compatibility standard C++ libraries
libstdc++.i686 : GNU Standard C++ Library
libstdc++.x86_64 : GNU Standard C++ Library
libstdc++-devel.i686 : Header files and libraries for C++ development
libstdc++-devel.x86_64 : Header files and libraries for C++ development
libstdc++-docs.x86_64 : Documentation for the GNU standard C++ library
libstdc++-static.i686 : Static libraries for the GNU standard C++ library
libstdc++-static.x86_64 : Static libraries for the GNU standard C++ library
// 查看版本
cat /etc/redhat-release
// 查看位数(结果是32/64)
getconf LONG_BIT
## 如果是32位,安装i686;如果是64位,安装x86_64
// 安装
yum install XXX
特殊情况
Based on the linker command output, possible reasons for this include:
1. It appears as though libz.a is missing. Please install it.
cannot find -lz
// 执行
yum install zlib-devel
执行过程中出现问题解决方案:
1、-bash: locate: command not found
yum -y install mlocate
2、locate: can not stat () `/var/lib/mlocate/mlocate.db': No such file or directory
updatedb