Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

alpine编译报错 #26

Closed
orannnnnnge opened this issue Dec 20, 2019 · 8 comments
Closed

alpine编译报错 #26

orannnnnnge opened this issue Dec 20, 2019 · 8 comments

Comments

@orannnnnnge
Copy link

你好,我在使用alpine编译时报错,错误信息如下:

alpine:~/chinadns-ng# make
gcc -std=c99 -Wall -Wextra -O3 -c chinadns.c -o chinadns.o
In file included from chinadns.h:6,
                 from chinadns.c:2:
netutils.h:5:10: fatal error: time.h: No such file or directory
 #include <time.h>
          ^~~~~~~~
compilation terminated.
make: *** [Makefile:23: chinadns.o] Error 1
alpine:~/chinadns-ng# uname -a
Linux alpine 5.4.5-0-lts

希望可以解决一下。

@cattyhouse
Copy link

cattyhouse commented Dec 20, 2019

git pull 一下 代码, 你是用的最新的么? 要么重新克隆一遍源代码, 参见: #1

@orannnnnnge
Copy link
Author

alpine:~/chinadns-ng# git pull
Already up to date.
alpine:~/chinadns-ng# make
gcc -std=c99 -Wall -Wextra -O3 -c chinadns.c -o chinadns.o
In file included from chinadns.h:6,
                 from chinadns.c:2:
netutils.h:5:10: fatal error: time.h: No such file or directory
 #include <time.h>
          ^~~~~~~~
compilation terminated.
make: *** [Makefile:23: chinadns.o] Error 1

肯定是最新的啊。。。怎么会特地去pull旧的代码

@cattyhouse
Copy link

https://pkgs.alpinelinux.org/contents?repo=main&page=3&arch=x86&branch=edge&name=musl-dev

安装 musl-dev, 这个package包含time.h文件

@orannnnnnge
Copy link
Author

alpine:~/chinadns-ng# make
gcc -std=c99 -Wall -Wextra -O3 -c chinadns.c -o chinadns.o
chinadns.c:23:10: fatal error: linux/limits.h: No such file or directory
 #include <linux/limits.h>
          ^~~~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:23: chinadns.o] Error 1

还是缺头文件,应该是alpine太精简了
还是换Debian吧

@zfl9
Copy link
Owner

zfl9 commented Dec 20, 2019

啥头文件都没有,这系统我也是醉了。

@cattyhouse
Copy link

cattyhouse commented Dec 20, 2019

安装 linux-headers

你可以在上面那个链接里面搜索所需要的文件, 看看在哪个包里面

alpine:~/chinadns-ng# make
gcc -std=c99 -Wall -Wextra -O3 -c chinadns.c -o chinadns.o
chinadns.c:23:10: fatal error: linux/limits.h: No such file or directory
 #include <linux/limits.h>
          ^~~~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:23: chinadns.o] Error 1

还是缺头文件,应该是alpine太精简了

还是换Debian吧

@cattyhouse
Copy link

啥头文件都没有,这系统我也是醉了。

不是啥都没有, 而是他没有正确的使用 alpine linux, 编译所需的包都安装不完整.

@cattyhouse
Copy link

建议你一步到位
apk add --update alpine-sdk

参考

@zfl9 zfl9 closed this as completed Dec 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants