首页 \ 问答 \ 在哪里把预制的二进制文件与automake?(Where to put pre-built binaries with automake?)

在哪里把预制的二进制文件与automake?(Where to put pre-built binaries with automake?)

我写的这个问题部分是基于一个关于辅助脚本相关问题

我有一个使用autotools构建的C ++软件系统。 对于它的一小部分功能,我的系统使用一个闭源预构建的二进制文件: AMPL 。 我是一个免费的学生版软件。 假设我在C ++代码中调用的AMPL二进制文件的名称是ampl-student 。 我使用system(...)调用从我的代码中运行它。

当“make install”运行时,我想将ampl-student移到/usr/bin以及我编译的C ++代码的二进制文件中。 在Makefile.am中 ,我应该添加ampl-student 。 我应该只是将它添加到bin_PROGRAMS变量?

一个相关的问题是,我甚至应该把ampl-student放在/usr/bin 。 有没有更适合“辅助二进制”的地方?

我认为这通常是一个坏主意,因为预先编译的二进制文件和代码一起发布并不能保证二进制文件可以在最终用户的计算机上运行。 但是在这种情况下,用户群非常小,我碰巧知道他们都使用相同的系统配置。 因此,我们实际上使用deb软件包来保持每个人都更新软件系统的新版本。

编辑1:我应该强调,问题首先是要求在autotools使用的Makefile.am文件中指定ampl-student的位置。


I am writing this question in part based on a related question on helper-scripts.

I have a C++ software system built with autotools. For a small part of its functionality, my system uses a closed-source pre-built binary: AMPL. I'm a freely-available student version of their software. Suppose the name of the AMPL binary file I call from within my C++ code is ampl-student. I run it from within my code using a system(...) call.

I would like ampl-student to be moved to /usr/bin along with the binary of my compiled C++ code when "make install" is run. Where in the Makefile.am should I add ampl-student. Should I just add it to the bin_PROGRAMS variable?

A related question is should I even put ampl-student in /usr/bin. Is there a more appropriate place for a "helper binary"?

I think this is, in general, a bad idea since distributing a pre-built binary along with the code doesn't guarantee that the binary will run on the end user's computer. But in this case, the user base is very small, and I happen to know that they are all using the same system configurations. So we are in fact using the deb package as a way to keep everyone updated of new releases of the software system.

Edit 1: I should emphasize that the question is first and foremost asking for where to specify ampl-student in the Makefile.am file used by autotools.


原文:https://stackoverflow.com/questions/5615469
更新时间:2023-06-20 22:06

最满意答案

确实。 在X3中,可变超载被丢弃。

我打赌这是自Spirit V2以来从设计中消除不必要的复杂情况的一般制度的一部分。

当然,您可以轻松地自己包装一个:

auto parse = [](auto& b, auto e, auto const& p, auto&... binds) {
    auto attr = std::tie(binds...);
    return x3::phrase_parse(b, e, p, x3::space, attr);
};

演示

住在科利鲁

#include <boost/fusion/adapted/std_tuple.hpp>
#include <boost/spirit/home/x3.hpp>
#include <iostream>

namespace x3 = boost::spirit::x3;

int main() {
    auto parse = [](auto& b, auto e, auto const& p, auto&... binds) {
        auto attr = std::tie(binds...);
        return x3::phrase_parse(b, e, p, x3::space, attr);
    };

    std::string const s = "3.2 4.5";

    double d1, d2;
    auto begin = s.begin(), end = s.end();

    if (parse(begin, end, x3::double_ >> x3::double_, d1, d2)) {
        std::cout << "Parsed: " << d1 << ", " << d2 << "\n";
    } else {
        std::cout << "Parse failed\n";
    }

    if (begin != end)
        std::cout << "Remaining unparsed input: '" << std::string(begin, end) << "'\n";
}

打印

Parsed: 3.2, 4.5

Indeed. In X3 the variadic overload was dropped.

I wager this was part of a general regime of removing unnecessary complications from the design since Spirit V2.

Of course you can easily wrap one up yourself:

auto parse = [](auto& b, auto e, auto const& p, auto&... binds) {
    auto attr = std::tie(binds...);
    return x3::phrase_parse(b, e, p, x3::space, attr);
};

Demo

Live On Coliru

#include <boost/fusion/adapted/std_tuple.hpp>
#include <boost/spirit/home/x3.hpp>
#include <iostream>

namespace x3 = boost::spirit::x3;

int main() {
    auto parse = [](auto& b, auto e, auto const& p, auto&... binds) {
        auto attr = std::tie(binds...);
        return x3::phrase_parse(b, e, p, x3::space, attr);
    };

    std::string const s = "3.2 4.5";

    double d1, d2;
    auto begin = s.begin(), end = s.end();

    if (parse(begin, end, x3::double_ >> x3::double_, d1, d2)) {
        std::cout << "Parsed: " << d1 << ", " << d2 << "\n";
    } else {
        std::cout << "Parse failed\n";
    }

    if (begin != end)
        std::cout << "Remaining unparsed input: '" << std::string(begin, end) << "'\n";
}

Prints

Parsed: 3.2, 4.5

相关问答

更多
  • 我有同样的发现! “locals”的诀窍是使用with<>指令。 因为你没有给出使用场景,我认为不值得提供示例,尽管你可以搜索我的答案* Boost Spirit X3无法使用变量因子编译repeat指令 使用单独的规则定义和实例化时,Boost Spirit X3 AST无法使用语义操作 将boost spirit用于基于堆栈的语言 第二种方法是使用语义操作(可以是lambda)并赋予_pass : Boost Spirit X3无法编译带有变量因子的repeat指令也显示: auto zerosum = ...
  • 确实。 在X3中,可变超载被丢弃。 我打赌这是自Spirit V2以来从设计中消除不必要的复杂情况的一般制度的一部分。 当然,您可以轻松地自己包装一个: auto parse = [](auto& b, auto e, auto const& p, auto&... binds) { auto attr = std::tie(binds...); return x3::phrase_parse(b, e, p, x3::space, attr); }; 演示 住在科利鲁 #include ...
  • 这里的问题是“3”是(x3::uint32 % '|')解析器的有效输入,因此备选方案的第一个分支通过,仅消耗3。 解决这个问题的最简单方法是使用备选列表而不是列表替代。 即: (x3::uint32 | x3::uint64) % '|' 但是,这意味着您必须在不同的结构中进行解析。 vector> vecs; 编辑 : 或者,如果您不打算将此解析器用作子解析器,则可以强制在每个分支中输入结束。 (x3::uint32 % '|' >> x ...
  • 两点: 您将上下文定义为 typedef x3::phrase_parse_context::type context_type; 但是,您尝试使用x3::space而不是x3::ascii::space来调用它。 提示出现在您不包括的错误消息中: /home/sehe/custom/boost/boost/spirit/home/x3/nonterminal/rule.hpp:116: undefined reference to 'bool kyle::parser:: ...
  • 通过重载/特化move_to你基本上告诉X3如何从boost::iterator_range (实际上只是一对迭代器)转换为boost::string_view 。 不幸的是,它不知道两者都是“等价的”(一个是另一个的substitute ,似乎是Spirit中使用的命名法)。 因此,您的原始示例有效,因为您明确请求从迭代器到string_view的转换,但是这个失败,因为X3缺少推断适当属性类型所需的信息。 特别是问题似乎在这里 ,测试解析器的属性(在本例中为raw_attribute_type )是否与 ...
  • 你发布的代码充斥着潦草的错误。 真的,没有理由期望有任何东西可以编译。 无论如何,我把它清理干净了。 当然你应该包括在内 #include 可悲的是,它根本不起作用。 我大致得出了同样的结论(在尝试了你提到的相同的事情之后,在阅读它之前:))。 这是Spirit X3的一个可用性问题 - 它仍处于试验阶段。 你可以在[spirit-general]邮件列表中报告。 回应通常非常迅速。 ¹如果您想查看我与http://paste.ubuntu ...
  • 似乎使用继承的特殊成员存在问题。 两个解决方法: using var = x3::variant; 或者: struct var : x3::variant { var ( ) = default; var (var const&) = default; var& operator= (var const&) = default; using base_type:: ...
  • 正如我在 ¹ 之前一直在警告人们的那样,你会在经常打破精神齿轮的事物的交叉点上施加限制: 单元件融合序列 ADT适应性一般 在开发中固定ADT的持久性错误(1.67.0发布后) 1.单元素难题 我不会花太多时间在这上面,因为它是一个相当古老,乏味,记录良好的²,对你的问题不是必不可少的。 让我们通过添加一个虚拟字段来支持它: struct rexpr { rexpr_map i_entries; const rexpr_map& entries() const { return i_ent ...
  • 自动属性传播已经处理好了: 住在科利鲁 #include #include #include #include using namespace std::string_literals; namespace x3 = boost::spirit::x3; namespace test { struct any_char: x3::char_parser { ...
  • 您将x3::space作为最后一个参数传递给x3::parse ,因此它将它绑定到解析器的属性。 当然你不想那样。 如果要传递队长,请使用x3::phrase_parse 。 PS正如编写的解析器还有一个问题:它在类型/ lambdaType中有左递归。 我认为这是因为你删除了标识符解析( x3::string("foo") )所以如果你修改输入为(foo, foo) => foo : 住在科利鲁 #define BOOST_SPIRIT_X3_DEBUG #include #incl ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)