Huelse
V2EX  ›  编程

请问使用了 NTL 后怎么编译动态库才能在 Python 中不出现 core dumped

  •  
  •   Huelse · Aug 31, 2019 · 5187 views
    This topic created in 2492 days ago, the information mentioned may be changed or developed.

    我有个需要对接到 Python 中的库,其中主要使用了 NTL 库的方法,例如 ZZ,RR。

    在编译 NTL 的静态库时我加入了-fPIC 参数(不加-fPIC 会在最后编译 Python 可用的库时出现 recompile with -fPIC),编译能通过,最后在 Python 中调用总会出现Segmentation fault (core dumped)

    最后发现,只要用了上面 NTL 中定义的大整数 RR 或任意精度浮点数 RR 就会出现core dumped,即使这个数并不用返回到 Python 中去。

    然后我看官方文档尝试编译 NTL 的动态库来调用,也是加了-fPIC,最后在 Python 中调用时结果和我说找不到 libntl.so , 这我就没办法了,难道要把 NTL 用到的 GMP 和 gf2x 也编译动态库?

    我是用的 pybind11 来编译 Python 可调用的动库,希望有经验的人看到能帮个忙,谢谢!

    1 replies    2019-09-01 14:39:31 +08:00
    Huelse
        1
    Huelse  
    OP
       Sep 1, 2019
    有人试过吗?是否可以用 pybind11 处理 NTL 中的 ZZ 这类自定义大整数类型?
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2950 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 07:19 · PVG 15:19 · LAX 00:19 · JFK 03:19
    ♥ Do have faith in what you're doing.