据说用-O3gcc 优化选项编译 GNU 工具和 Linux 内核会产生奇怪和时髦的错误。这是真的吗?有没有人尝试过,还是只是一个骗局?
新来vim和我希望能够从内部编译代码,vim而无需运行新终端和调用编译器。
我该怎么做?请注意,此要求不仅限于gcc,有时我还需要调用python我正在处理的当前脚本,因此您明白了...
经过一番谷歌搜索,我找到了一种将 BASH 脚本编译为二进制可执行文件的方法(使用shc)。
我知道 shell 是一种解释性语言,但是这个编译器有什么作用呢?它会以任何方式提高我的脚本的性能吗?
我已经按照本指南在我的 Ubuntu 12.04 上禁用鼠标中键粘贴。
奇迹般有效。
现在我试图在我的 Linux Mint 17 上实现同样的目标。当我尝试
sudo apt-get build-dep libgtk2.0-0
Run Code Online (Sandbox Code Playgroud)
它给了我以下输出:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Picking 'gtk+2.0' as source package instead of 'libgtk2.0-0'
E: Unable to find a source package for gtk+2.0
Run Code Online (Sandbox Code Playgroud)
对我来说,看起来 apt-get 以某种方式“解析”'libgtk2.0-0'到'gtk+2.0',但是没有找到任何这样命名的包。
编辑:虽然我现在能够编译程序(见我的答案),但我仍然不知道Picking 'gtk+2.0' as source package instead of 'libgtk2.0-0'应该是什么 意思。对此的任何见解将不胜感激,谢谢!
昨天我试图从源代码编译ROOT包。由于我是在 6 核怪物机器上编译它,因此我决定继续使用make -j 6. 一开始编译很顺利,速度也很快,但在某个时候make,只在一个内核上使用了 100% 的 CPU。
我做了一些谷歌搜索,并在 ROOT 留言板上找到了这篇文章。自从我自己组装了这台电脑,我担心我没有正确应用散热器和CPU过热什么的。不幸的是,我在工作时没有可以把它塞进去的冰箱。;-)
我安装了lm-sensors软件包并make -j 6再次运行,这次是监控 CPU 温度。尽管它变得很高(接近 60 C),但它从未超过高温或临界温度。
我尝试运行make -j 4但make在编译过程中的某个时候再次挂起,这次是在不同的位置。
最后,我编译运行make并运行良好。我的问题是:它为什么挂了?由于它停在两个不同的位置,我猜这是由于某种竞争条件,但我认为make应该足够聪明,以正确的顺序排列所有东西,因为它提供了-j选项。
假设我有一个mymod包含源文件的模块,如下所示:
src/mod/mymod.c
src/inc/mymod.h
我尝试包含 mymod.h 如下
#include <mymod.h>
Run Code Online (Sandbox Code Playgroud)
我的 makefile 包含EXTRA_CFLAGS= -I$(shell pwd)/../inc/但在制作内核时,我收到一条错误消息:
未找到 mymod.h
原因似乎是在制作内核模块时,此命令从 makefile 运行:(使用makeV1):
make -C <path/to/linux/src> M=<path/to/mymod> modules
Run Code Online (Sandbox Code Playgroud)
在其他作品中,我$(shell pwd)扩展到<path/to/linux>. 这不是我想要的。如何指定-I要指向src/inc我的mymod源树的参数?
按照本教程编写我的第一个驱动程序。
生成文件是:
# Makefile – makefile of our first driver
# if KERNELRELEASE is defined, we've been invoked from the
# kernel build system and can use its language.
ifneq (${KERNELRELEASE},)
obj-m := ofd.o
# Otherwise we were called directly from the command line.
# Invoke the kernel build system.
else
KERNEL_SOURCE := /usr/src/linux 3.8
PWD := $(shell pwd)
default:
${MAKE} -C ${KERNEL_SOURCE} SUBDIRS=${PWD} modules
clean:
${MAKE} -C ${KERNEL_SOURCE} SUBDIRS=${PWD} clean
endif
Run Code Online (Sandbox Code Playgroud)
驱动程序代码是:
* ofd.c – Our First …Run Code Online (Sandbox Code Playgroud) 从失败的构建中检查构建日志,以下错误是什么意思,
fatal error: ac_nonexistent.h: No such file or directory #include <ac_nonexistent.h>
Run Code Online (Sandbox Code Playgroud)
这是一些上下文。
configure:6614: $? = 0
configure:6627: result: none needed
configure:6648: checking how to run the C preprocessor
configure:6679: gcc -E -Wdate-time -D_FORTIFY_SOURCE=2 conftest.c
configure:6679: $? = 0
configure:6693: gcc -E -Wdate-time -D_FORTIFY_SOURCE=2 conftest.c
conftest.c:11:28: fatal error: ac_nonexistent.h: No such file or directory
#include <ac_nonexistent.h>
^
compilation terminated.
configure:6693: $? = 1
configure: failed program was:
| /* confdefs.h */
Run Code Online (Sandbox Code Playgroud)
什么是ac_nonexistent.h?遇到这个错误该怎么办?
我在 Linux mint 上使用 vim 编辑器。我想知道是否有任何方法可以在不离开编辑器的情况下编译c程序。
我有一个应用程序foobar,有人为其编写了补丁来添加我喜欢的功能。如何使用补丁?