Mac下make时报错malloc.h: No such file or directory的解决方法

在使用Linux环境下载的开源工具于Mac的gcc环境中编译时遇到'error:malloc.h:No such file or directory'的问题。通过修改#include <malloc.h>为#include <sys/malloc.h>,成功解决了该错误。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

下载了一个linux环境下的开源工具,结果在mac的gcc环境中编译的时候,报错 error: malloc.h: No such file or directory

解决方法:将报错文件中

#include <malloc.h>

修改为

#include <sys/malloc.h>
In file included from cryptlib.c:117:0: cryptlib.h:62:21: fatal error: stdlib.h: No such file or directory # include <stdlib.h> ^ compilation terminated. mem.c:59:19: fatal error: stdio.h: No such file or directory #include <stdio.h> ^ compilation terminated. mem_clr.c:60:20: fatal error: string.h: No such file or directory #include <string.h> ^ compilation terminated. mem_dbg.c:112:19: fatal error: stdio.h: No such file or directory #include <stdio.h> ^ compilation terminated. In file included from cversion.c:59:0: cryptlib.h:62:21: fatal error: stdlib.h: No such file or directory # include <stdlib.h> ^ compilation terminated. In file included from ex_data.c:141:0: cryptlib.h:62:21: fatal error: stdlib.h: No such file or directory # include <stdlib.h> ^ compilation terminated. cpt_err.c:62:19: fatal error: stdio.h: No such file or directory #include <stdio.h> ^ compilation terminated. In file included from uid.c:56:0: ../include/openssl/crypto.h:120:21: fatal error: stdlib.h: No such file or directory # include <stdlib.h> ^ compilation terminated. o_time.c:65:20: fatal error: string.h: No such file or directory #include <string.h> ^ compilation terminated. o_str.c:60:19: fatal error: ctype.h: No such file or directory #include <ctype.h> ^ compilation terminated. o_dir.c:60:19: fatal error: errno.h: No such file or directory #include <errno.h> ^ compilation terminated. In file included from o_fips.c:59:0: cryptlib.h:62:21: fatal error: stdlib.h: No such file or directory # include <stdlib.h> ^ compilation terminated. In file included from o_init.c:56:0: ../e_os.h:468:28: fatal error: unistd.h: No such file or directory # include OPENSSL_UNISTD ^ compilation terminated. getenv.c:14:20: fatal error: stdlib.h: No such file or directory #include <stdlib.h> ^ compilation terminated. Makefile:138: recipe for target 'local_depend' failed make[1]: *** [local_depend] Error 1 make[1]: Leaving directory '/home/holand/work/openssl-OpenSSL_1_0_2u/crypto' Makefile:483: recipe for target 'depend' failed make: *** [depend] Error 1
最新发布
06-13
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值