Giter Club home page Giter Club logo

ucc162.3's Issues

centos 6.9 x64报错

make -C driver
make[1]: Entering directory /root/ucc/driver' gcc -m32 -o ucc -g ucc.c linux.c 在包含自 /usr/include/features.h:385 的文件中, 从 /usr/include/stdio.h:28, 从 ucc.c:1: /usr/include/gnu/stubs.h:7:27: 错误:gnu/stubs-32.h:没有那个文件或目录 在包含自 /usr/include/features.h:385 的文件中, 从 /usr/include/unistd.h:26, 从 linux.c:1: /usr/include/gnu/stubs.h:7:27: 错误:gnu/stubs-32.h:没有那个文件或目录 make[1]: *** [all] 错误 1 make[1]: Leaving directory /root/ucc/driver'
make: *** [all] 错误 2
网上稍微查了一下需要安装 yum install glibc-devel
可是还是没有用,能不能告诉我啥原因啊

对gcc还要linux内核版本有要求吗

在Windows虚拟机下折腾了半天,都是按要求设置的,最后跑hello的时候显示memory exhausted;
在Linux下运行 make test 的时候报了一堆的错
我的gcc版本
gcc version 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC)

linux 编译问题

我用win10的内置子系统 wsl 编译, make之后会有一些warning
image

然后走到make test这一步报错了,不知为何
image
文件没有改过

第一次执行make -s test报错及其解决办法,mv: cannot stat '/ucl': No such file or directory

第一次执行make -s test报错及其解决办法,mv: cannot stat '/ucl': No such file or directory

在书(C 编译器剖析,邹昌伟)的第 23 页中第一次执行make -s test时,报错内容如下:

[oxygen@****** ucc]$ make -s test
(exprchk.c,314):(output.c,70):warning:Too many arguments
(exprchk.c,314):(output.c,86):warning:Too many arguments
mv: cannot stat '/ucl': No such file or directory
make[1]: *** [Makefile:21: test] Error 1
make: *** [Makefile:25: test] Error 2

问题原因:多级 makefile 及参数传递问题,ucc/Makefile 文件中的变量 $(UCCDIR) 没有传递到 ucc/ucl/Makefile 中,导致报错。
解决办法:将 ucc/Makefile 文件的UCCDIR定义前加 export

正确的 ucc/Makefile 文件如下:

#UCCDIR = /home/iron/bin
cur_mkfile := $(abspath $(lastword $(MAKEFILE_LIST)))
export UCCDIR = $(patsubst %/, %, $(dir $(cur_mkfile)))/bin

修改后重新执行,结果如下

[oxygen@****** ucc]$ make -s test
(exprchk.c,314):(output.c,70):warning:Too many arguments
(exprchk.c,314):(output.c,86):warning:Too many arguments
(exprchk.c,314):(output.c,70):warning:Too many arguments
(exprchk.c,314):(output.c,86):warning:Too many arguments

可能对你有帮助的 makefile 相关代码:

1.打印当前Makefile的路径:

$(warning Makefile path: $(CURDIR)/$(lastword $(MAKEFILE_LIST)))

2.在控制台输出变量 $(UCCDIR)/ucl 的值

$(info $(UCCDIR)/ucl)

希望能帮助到有需要的人!

Advice

2年以前,我有一段时间研究了一下UCC这个编译器,当时是在SourceForge上面下载的源代码,发现项目没有再维护了。
这个编译器作为教学工具,可能具有一定意义。但是对于VS的依赖很重,比如汇编器用的是MASM(这个在VC++ 6.0中都不存在),链接器是用的VS的。在这个上面可能需要相应的修改,可以考虑JWASM的链接器。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.