【问题标题】:fatal error: zlib.h: No such file or directory when zlib is installed致命错误:zlib.h:安装 zlib 时没有这样的文件或目录
【发布时间】:2019-01-23 23:30:47
【问题描述】:

使用 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

【问题讨论】:

    标签: gcc makefile zlib hpc lib


    【解决方案1】:

    makefile没有将$(CFLAGS)传递给编译器调用,或者lib/utils目录下的makefile中没有设置CFLAGS变量的设置,从这条命令可以看出:

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

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

    【讨论】:

      猜你喜欢
      • 2014-06-04
      • 2016-07-22
      • 2021-08-09
      • 2013-11-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多