即使完全遵循说明,在 Fedora14 下构建 zxing 的 cpp/lib 也会失败

发布于 2024-12-06 08:32:43 字数 584 浏览 0 评论 0原文

也就是说,按照 zxing/cpp/README 中的说明进行操作,其中显示“仅构建库: - 在此文件夹(cpp)中运行“scons lib”'

好吧,这正是我所做的。但我得到:

 scons lib
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
o build/core/src/zxing/BarcodeFormat.o -c -O0 -g3 -ggdb -Wall -Ibuild/core/src build/core/src/zxing/BarcodeFormat.cpp
sh: o: command not found

这个“O:命令未找到”重复了很多次。

我认为问题可能是找不到 gcc,所以我检查了它:它已安装。在我放弃尝试弄清楚为什么它正在寻找命令“o”之前,我只简单地浏览了 scons 的 python。当然没有。

顺便说一句:我三天前才使用 wget 获得了 zxing 1.7 的副本,今天又获得了 'scons' 的 yum 安装。所以它们是最新的。

That is, following the instructions in zxing/cpp/README, which say 'To build the library only:
- Run "scons lib" in this folder (cpp)'

Well, that is exactly what I did. But I get:

 scons lib
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
o build/core/src/zxing/BarcodeFormat.o -c -O0 -g3 -ggdb -Wall -Ibuild/core/src build/core/src/zxing/BarcodeFormat.cpp
sh: o: command not found

Withs this "O: command not found" repeated many times.

I thought the problem might be gcc not found, so I checked for that: it is installed. I took only a brief look at the python of scons before I gave up on trying to figure ouw why it is looking for a command 'o'. Of course there is none.

BTW: I got my copy of zxing 1.7 using wget only three days ago and the yum installation of 'scons' today. So they are up-to-date.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

北方。的韩爷 2024-12-13 08:32:43

您可能是正确的,并且 SCons 没有找到 GCC。最好的选择是添加一个调用来显示部分(或全部)环境的内容。如下所示,您可以提取特定变量,或者显示整个环境。最好的位置可能靠近对构建器的调用(SharedLibrary、StaticLibrary 或 Program)。对于名为“env”的环境:

print env.Dump()
print env['CC']
print env['CXX']

确保最初使用适当的默认环境(可能类似):

env = DefaultEnvironment( ... )

或者系统上的环境变量(包括路径)正在传播到 SCons。一种方法是:

import os
# ...
env = Environment( ENV = os.environ, ... )

在极端情况下,您可以通过向编译器提供显式路径来解决此问题:

env['CC'] = '/usr/bin/gcc'

编辑:

这些更改需要在适当的 SConstruct 或 SConscript 文件中进行。这取决于确切的项目以及您想要实现的目标 - 对于 google code 上当前版本的 zxing,在 SConscript 文件

It is likely that you are correct, and that SCons isn't finding GCC. Your best bet is to add a call to display the contents of some (or all) of the environment. As shown below, you can either pull out specific variable, or show the whole environment. The best place would probably near a call to the builder (SharedLibrary, StaticLibrary or Program). For an environment named 'env':

print env.Dump()
print env['CC']
print env['CXX']

Ensuring that an appropriate default environment is being used initially (probably something like):

env = DefaultEnvironment( ... )

Or that the environment variables on your system (including path) are being propagated through to SCons. One way to do this is by:

import os
# ...
env = Environment( ENV = os.environ, ... )

In extreme cases you can resolve this problem by providing an explicit path to the compiler:

env['CC'] = '/usr/bin/gcc'

Edit:

These changes need to be made in an appropriate SConstruct or SConscript file. Which depends on the exact project, and what you're trying to achieve - in the case of the current version of zxing on google code, it would be reasonable to make the changes on or near line 40 of the SConscript file

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文