- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想从 GnuCOBOL 调用 Rust。我已经从 Can GnuCOBOL interface with Rust? 中的第一个示例中复制了代码来自 Brian Tiffin 的 GNUCobol FAQ 作为测试,但在运行时出现错误。
预期:
$ make -B
rustc --crate-type=dylib called.rs
LD_RUN_PATH=. cobc -xj caller.cob -L. -lcalled
:Hello, world:
实际:
$ make -B
rustc --crate-type=dylib called.rs
LD_RUN_PATH=. cobc -xj caller.cob -L. -lcalled
libcob: error: module 'hello_rust' not found
make: *** [makefile:5: caller] Error 1
从命令行编译这两个文件后,我得到了同样的错误,然后使用 $ ./caller
。
根据 cobc
手册页和 GnuCOBOL manual 的链接部分,语法似乎是正确的和 Rust reference .我已经按照 GnuCOBOL 手册中的说明尝试了 $ ./caller COB_LIBRARY_PATH=.
,但没有任何区别。 Rust 源代码按预期编译为库,但 COBOL 找不到它。
使用 $ cobcrun caller
显示 libcob: error: module 'caller' not found
。
This关于类似错误的问题是关于静态链接多个 COBOL 源文件,它工作正常,并且 this关于类似错误的问题似乎是 X"AF"
的问题,此处未使用。将 C 源代码与 Jay Moseley 的 C Wrapper for Calling Library Function 静态链接示例按预期工作。不支持静态链接 Rust 源。
软件版本:
最佳答案
问题似乎是 COBOL caller
可执行文件正在尝试动态加载名为 hello_rust.so
而不是 libcalled.so
的库在运行时。
不修改任何东西的简单解决方法是只创建一个符号链接(symbolic link):
$ ln -s libcalled.so hello_rust.so
或者,将 -fstatic
添加到 cobc
命令应该在编译时静态链接 Rust 库,消除动态库运行时调用。
示例 Makefile
可以更新为如下所示:
# GnuCOBOL and Rust
.RECIPEPREFIX = >
caller: caller.cob libcalled.so
> LD_RUN_PATH=. cobc -fstatic -xj caller.cob -L. -lcalled
libcalled.so: called.rs
> rustc --crate-type=dylib called.rs
作为引用,我们可以通过 strace 调查可执行文件正在做什么,以查看 COBOL 运行时正在进行哪些系统调用——在我们的例子中——它找不到哪些文件。
$ strace ./caller 2>&1 | grep hello_rust
access("./hello_rust.so", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/lib64/gnucobol/hello_rust.so", R_OK) = -1 ENOENT (No such file or directory)
write(2, "module 'hello_rust' not found", 29module 'hello_rust' not found) = 29
关于rust - GnuCOBOL 调用 Rust : libcob: error: module not found,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/74071691/
我知道我的问题很笼统(看起来像是“请为我做所有的工作”),所以让我说得更清楚一点:我 - 或多或少 - 是一个 COBOL 初学者,唯一的事情到目前为止,我已经完成了一个用于单一服务页面的小型 Fas
我已经在我的 Ubuntu 17.04 系统上安装了 GnuCOBOL 2.2。我编写了一个基本的 hello world 程序来测试编译器。 1 IDENTIFICATION DIVIS
我正在尝试从 Oracle 迁移到 GnuCOBOL 上的 PostgreSQL。我有一段使用游标的代码,需要多次打开游标。但是,当再次尝试打开游标时,出现错误 ERROR: cursor "fetc
在 Ubuntu 18.10 上使用 GnuCOBOL 2.2.0。 完成 Michael Coughlan 的“面向程序员的 COBOL 入门”。 GnuCOBOL 一直在编译本书的例子,直到第 9
在 Ubuntu 中安装了 GnuCobol cobc 编译器为 SQL 预处理安装了 esqlOC,Cob-DB2 运行良好。对于带有 postgres 的 Cobol,源程序类型应该是什么(例如
我认为最近发生了一些变化。 GnuCOBOL 依赖于动态链接,在运行时使用 dlsym 查找符号。这个 CALL 运行时支持代码已经在 OpenCOBOL 中使用了大约 7 年。它不再适用于 Ubun
不幸的是我的 earlier question 有第 2 部分. 该链接显示了一个简单的 COBOL 程序,将一个值移动到一张编辑过的图片,该图片应该在该值之前加上“£”。 根据对前面问题的回答,必须
我想从 GnuCOBOL 调用 Rust。我已经从 Can GnuCOBOL interface with Rust? 中的第一个示例中复制了代码来自 Brian Tiffin 的 GNUCobol
我正在尝试从手册 gnucobol 中练习调用 cobol 程序 (say.cob) 的 C 程序 (hello.c)。 ---- say.cob ------ IDENTIFICAT
我正在寻找使用 Cobol 的示例,无论是 mf cobol 还是 gnucobol。我想要 VB 或 C 的替代品。自 Cobol 61 以来的旧时代 Coboller。我看过 Java 和 Pyt
我是一名优秀的程序员,十分优秀!