我想在没有 root 访问权限的机器上安装 tmux。我已经编译了 libevent 并安装了它$HOME/.bin-libevent,现在我想编译 tmux,但 configure 总是以 结尾configure: error: "libevent not found",即使我试图Makefile.am通过修改LDFLAGS和指向 libevent 目录CPPFLAGS,但似乎没有任何效果。
如何告诉系统在我的主目录中查找 libevent?
我想尽可能快地编译。去搞清楚。并想自动选择-j选项后面的数字。如何以编程方式选择该值,例如在 shell 脚本中?
输出是否nproc等于我可用于编译的线程数?
make -j1
make -j16
我见过install很多 Makefile 中使用的命令,它的存在和用法有点令人困惑。从联机帮助页来看,它似乎是一个cp功能较少的仿制品,但我认为除非它比cp. 这是怎么回事?
我正在尝试将一些环境变量包含到 Makefile 中。env 文件如下所示:
FOO=bar
BAZ=quux
Run Code Online (Sandbox Code Playgroud)
请注意,没有通向export每个 env var。如果我在 Makefile 中添加前导文件export和includeenv 文件,则一切正常。但我需要保持 env vars sans 领先export。这使我无法仅include envfile在 Makefile 中使用。
我也试过做这样的事情:
sed '/^#/!s/^/export /' envfile > $(BUILDDIR)/env
include $(BUILDDIR)/env
Run Code Online (Sandbox Code Playgroud)
但是这样做会导致 make 抛出错误,因为 env 文件不存在。
我正在尝试编译一个程序,根据文档,该程序需要“OpenSSL 库”。我已经安装了 OpenSSL,但它仍然给我错误openssl/sha.h: No such file or directory。是否有其他一些必须安装的库?
我正在使用 redis 建立一个新的、专用的 centos 6.4 系统。我已经安装过很多次 redis,但是从来没有遇到过这个问题(之前也从来没有在 centos 6.4 上)。
cd redis-2.6.16
sudo make install
Run Code Online (Sandbox Code Playgroud)
错误:
MAKE jemalloc
cd jemalloc && ./configure --with-lg-quantum=3 --with-jemalloc-prefix=je_ --enable-cc-silence CFLAGS="-std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops " LDFLAGS=""
/bin/sh: ./configure: Permission denied
make[2]: *** [jemalloc] Error 126
make[2]: Leaving directory `/tmp/redis32/redis-3.2.6/deps'
make[1]: [persist-settings] Error 2 (ignored)
sh: ./mkreleasehdr.sh: Permission denied
and later:
zmalloc.h:50:31: error: jemalloc/jemalloc.h: No such file or directory
zmalloc.h:55:2: error: #error "Newer version of jemalloc required"
Run Code Online (Sandbox Code Playgroud)
当我尝试直接构建 jemalloc 时(从 redis tarball 的 /src …
我使用的是“ Advanced Linux Programming (2001)” [code]一书中的 Makefile 。我很奇怪看到GNU make确实正确编译了代码,甚至没有在 Makefile 中指定编译器。这就像没有任何食谱烘焙!
这是代码的最小版本:
测试.c
int main(){}
Run Code Online (Sandbox Code Playgroud)
生成文件
all: test
Run Code Online (Sandbox Code Playgroud)
并真正起作用!这是它执行的命令:
cc test.c -o test
Run Code Online (Sandbox Code Playgroud)
我在文档中找不到任何有用的东西。这怎么可能?
PS 额外说明:连语言都没有指定;因为test.c可用,GNUmake使用cc. 如果存在test.cpp或test.cc(当没有时test.c),它使用g++(而不是c++)。
有时在项目源中我会看到“*.in”文件。例如,一堆“Makefile.in”。它们是什么和/或“.in”部分是什么意思?我认为这与autoconf或make或类似的事情有关,但我不确定。
我试过搜索“.in 文件扩展名”、“autoconf .in 文件扩展名”、“autoconf .in”、“autoconf dot in”和其他变体,但没有成功。
但他们给出的指令是
cd downloaded_program
./configure
make install
Run Code Online (Sandbox Code Playgroud)
这将创建所需的 ELF,可能还有一些 .so 文件。
为什么不把它们放在一个 zip 文件中进行下载,就像 Windows 应用程序一样?有什么理由需要用户编译它们吗?
假设您有一个包含大量 Makefile 的项目结构,并且有一个包含所有其他 Makefile 的顶级 Makefile。
你怎么能列出所有可能的目标?
我知道写作
make
Run Code Online (Sandbox Code Playgroud)
然后点击获取建议通常可以解决问题,但在我的情况下有 10000 个目标。这样做会传递更多结果,并且由于某种原因滚动列表会导致冻结。还有其他方法吗?