如何构建二进制文件并在 Unix 中的多台机器上使用它?
我有一个编译器的源代码,我正在这样构建:
/path/to/srcdir/configure --prefix=/path/to/installdir
make
make install
我想将生成的“installdir”分发到其他机器,目的是任何人都可以使用编译器二进制文件,而无需经过三阶段构建过程(我只是包括我的发行版 tarball 中的 installdir)。
为了进行测试,我将 installdir 复制到不同用户下的另一台计算机,然后尝试使用我刚刚复制的二进制文件编译测试程序,如下所示:
installdir/bin/ucc -mp -o test load_bl.c
然后,我收到如下错误:
cc1: error: /home/sghosh/normalbuild/installdir/open64-gcc-4.2.0/include: Permission denied
cc1: error: /home/sghosh/normalbuild/installdir/open64-gcc-4.2.0/lib/gcc/x86_64-redhat-linux/4.2.0/include: Permission denied
cc1: error: /home/sghosh/normalbuild/installdir/open64-gcc-4.2.0/x86_64-redhat-linux/include: Permission denied
/ home/sghosh/normalbuild/install
是在我的构建计算机上的 configure
期间指定为 --prefix
的内容。 installdir/bin/ucc
二进制文件需要 installdir 下 open64-gcc-4.2.0
目录中的一些文件,但由于这是 中提到的路径--前缀
,所以它仍然在那里寻找它,我希望它在当前机器中查找相同的目录。仅供参考,我没有 sudo/root 权限。
我如何提出一个可以在任何机器上工作的二进制发行版(构建一次,在任何地方使用),并且在这种情况下不查看初始 --prefix
路径?
我在超级用户中也有类似的问题,但由于发生了大量编辑,并且我没有得到对新问题的答复,所以我在这里写下来。
I have source code of a compiler which I am building like this:
/path/to/srcdir/configure --prefix=/path/to/installdir
make
make install
I want to distribute the resulting 'installdir' to other machines, with the intent that anybody could use the compiler binaries without going through the 3-stage build process (I am just including the installdir in my distribution tarball).
For testing, I am copying the installdir to another machine under a different user, and then just trying to compile a test program using the binaries I just copied over, like this:
installdir/bin/ucc -mp -o test load_bl.c
Then, I get an error as follows:
cc1: error: /home/sghosh/normalbuild/installdir/open64-gcc-4.2.0/include: Permission denied
cc1: error: /home/sghosh/normalbuild/installdir/open64-gcc-4.2.0/lib/gcc/x86_64-redhat-linux/4.2.0/include: Permission denied
cc1: error: /home/sghosh/normalbuild/installdir/open64-gcc-4.2.0/x86_64-redhat-linux/include: Permission denied
The /home/sghosh/normalbuild/install
is what is specified as --prefix
during configure
on my build machine. The installdir/bin/ucc
binary require some files in the open64-gcc-4.2.0
dir under installdir, but since that is the path mentioned in --prefix
, so it's still looking for it there, and I want it to look into the same dir in the current machine. FYI, I do not have sudo/root privileges.
How do I come up with a binary distribution that would work in any machine (build once, use anywhere sorts), and not look into the initial --prefix
path in this case?
I have had a similar question in superuser, but since lots of edit happened and I got no response to the new question, so I am writing it here.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
检查这个工具:https://github.com/pgbovine/CDE
CDE是一个自动打包的工具运行任何 Linux 命令集所涉及的代码、数据和环境,以便它们可以在另一台计算机上以相同的方式执行,而无需任何安装或配置。
Check this tool: https://github.com/pgbovine/CDE
CDE is a tool that automatically packages up the Code, Data, and Environment involved in running any set of Linux commands so that they can execute identically on another computer without any installation or configuration.