001、编译报错:fatal error: zlib.h: No such file or directory
002、查找改文件
(base) [root@pc1 test]# find / -name "zlib.h" ## 查找改文件, 存在 /root/anaconda3/pkgs/zlib-1.2.13-h5eee18b_0/info/licenses/zlib.h /root/anaconda3/pkgs/zlib-1.2.13-h5eee18b_0/include/zlib.h /root/anaconda3/include/zlib.h /usr/src/kernels/3.10.0-957.el7.x86_64/include/config/crypto/zlib.h /usr/src/kernels/3.10.0-957.el7.x86_64/include/config/squashfs/zlib.h /usr/src/kernels/3.10.0-957.el7.x86_64/include/linux/zlib.h
003、复制一份到编译路径测试
(base) [root@pc1 test]# cp /root/anaconda3/include/zlib.h . ## 并不能解决问题 (base) [root@pc1 test]# ls kseq_fastq_base.c zlib.h (base) [root@pc1 test]# gcc -o kseq_fastq_base kseq_fastq_base.c -lz kseq_fastq_base.c:1:20: fatal error: zlib.h: No such file or directory #include <zlib.h> ^ compilation terminated.
004、正确的解决方法:
(base) [root@pc1 test]# yum list | grep "zlib" ## 查找yum库中zlib相关的安装包 zlib.x86_64 1.2.7-21.el7_9 @updates zlib-devel.x86_64 1.2.7-21.el7_9 @updates jzlib.noarch 1.1.1-6.el7 base jzlib-demo.noarch 1.1.1-6.el7 base jzlib-javadoc.noarch 1.1.1-6.el7 base zlib.i686 1.2.7-21.el7_9 updates zlib-devel.i686 1.2.7-21.el7_9 updates zlib-static.i686 1.2.7-21.el7_9 updates zlib-static.x86_64 1.2.7-21.el7_9 updates (base) [root@pc1 test]# yum install zlib-devel.x86_64 ## 安装该包
005、编译测试
(base) [root@pc1 test]# gcc -o kseq_fastq_base kseq_fastq_base.c -lz ## 缺少zlib.h的报错消失 kseq_fastq_base.c:3:20: fatal error: kseq.h: No such file or directory #include "kseq.h" ^ compilation terminated.
。
标签:1.2,No,zlib,kseq,base,file,root,el7 From: https://www.cnblogs.com/liujiaxin2018/p/17830803.html