致命错误:zlib.h:安装zlib时没有这样的文件或目录

时间:2019-01-23 23:30:48

标签: gcc makefile zlib hpc lib

使用CentOS 7。 安装了zlib-devel,但是在尝试安装软件时仍然出现以下错误。

> make
make -C lib/utils libutils.a
make[1]: Entering directory '/common/apps/biscuit/lib/utils'
gcc -c -Wall -O2 wzvcf.c -o wzvcf.o
In file included from wzvcf.h:29:0,
             from wzvcf.c:1:
wzio.h:4:10: fatal error: zlib.h: No such file or directory
 #include <zlib.h>
      ^~~~~~~~
compilation terminated.
make[1]: *** [Makefile:17: wzvcf.o] Error 1
make[1]: Leaving directory '/common/apps/biscuit/lib/utils'
make: *** [Makefile:60: lib/utils/libutils.a] Error 2

还将-I / hpc / apps / zlib / 1.2.11 / include -I / usr / include添加到Makefile中,如下所示:

CC = gcc
CFLAGS = -W -Wall -finline-functions -fPIC -std=gnu99 -Wno-unused-result -O3 -I/hpc/apps/zlib/1.2.11/include -I/usr/include
CLIB = -lncurses -lpthread -lz -lm
CF_OPTIMIZE = 1

1 个答案:

答案 0 :(得分:0)

makefile不会将$(CFLAGS)传递给编译器调用,或者CFLAGS目录的makefile中未设置lib/utils变量的设置,由此可见命令:

gcc -c -Wall -O2 wzvcf.c -o wzvcf.o

您要么需要添加$(CFLAGS),要么按预期运行构建系统(可能从顶级构建目录)。