PyCarl 的 cmake 构建过程失败,并要求使用 -fPIC 重新编译

我正在使用 ubuntu 19.04 docker 的 docker 来安装 PyCarl。我有 carl 和 carl-parser(master14 版本)。但是,“python setup.py develop”命令在 setup.py 中失败,并带有退出代码为 2 的 calledProcessException。初始命令为:

subprocess.check_output(['cmake', '--build', '.', '--target', ext.name] + build_args, cwd=self.build_temp)

归结为:

cmake --build . --target core --config Release -- -j4

但是,我最终得到了一个退出代码为 2 的 CalledProcessError。任何帮助建议我可能出现错误的地方都会有很大帮助。

http://img.mukewang.com/629884e2000139a725600991.jpg

此外,上述错误似乎是由于评论中建议的先前未解决的错误。


root@196abd768845:/pycarl# python setup.py develop

running develop

running egg_info

writing lib/pycarl.egg-info/PKG-INFO

writing dependency_links to lib/pycarl.egg-info/dependency_links.txt

writing top-level names to lib/pycarl.egg-info/top_level.txt

reading manifest file 'lib/pycarl.egg-info/SOURCES.txt'

reading manifest template 'MANIFEST.in'

writing manifest file 'lib/pycarl.egg-info/SOURCES.txt'

running build_ext

Pycarl - Using carl with master14 branch.

Pycarl - Using carl 14.18.10 from /carl/build

Pycarl - carl parser extension from  included.

Pycarl - Support for CLN found and included.

Pycarl - CMake args=['-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/pycarl/lib/pycarl/', '-DPYTHON_EXECUTABLE=/usr/bin/python3', '-DCMAKE_BUILD_TYPE=Release', '-Dcarl_DIR=/carl/build']

/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libgmpxx.a(osdoprnti.o): relocation R_X86_64_PC32 against symbol `__gmp_allocate_func' can not be used when making ashared object; recompile with -fPIC

/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libgmpxx.a(osfuns.o): relocation R_X86_64_PC32 against symbol `_ZNKSt5ctypeIcE8do_widenEc' can not be used when making a shared object; recompile with -fPIC

/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libgmp.a(memory.o): relocation R_X86_64_PC32 against symbol `stderr@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC


我确实尝试export CXXFLAGS="$CXXFLAGS -fPIC"过,但这并没有解决错误。


补充2:感谢您的投入。但我可以看到 .a 和 .so 都存在于库中。那么为什么不选择共享的呢?或者我怎样才能动态链接它?我试过 LD_LIBRARY_PATH 但它没有解决它。


宝慕林4294392
浏览 182回答 1
1回答

浮云间

我想我想通了。Carl 安装了 gmp 6.2.1,因为它发现默认的 gmp tp 是 6.0.0。我所要做的就是将路径(即,LD_RUN_PATH和LD_LIBRARY_PATH,对于像我这样的菜鸟)链接到那个文件夹(这是carl/build/resources/lib给我的)。
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Python