gpt4 book ai didi

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

转载 作者:太空宇宙 更新时间:2023-11-03 20:22:48 25 4
gpt4 key购买 nike

我正在使用 ubuntu 19.04 docker 的 docker 来安装 PyCarl。我有卡尔和卡尔解析器(master14版本)。但是,“python setup.pydevelop”命令在 setup.py 中失败,并出现调用进程异常,退出代码为 2。初始命令为:

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

归结为:

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

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

Please see the bottom of the screenshot for the described error

此外,看来上述错误是由于评论中建议的先前 Unresolved 错误造成的。

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

上面继续了很多变量,最后显示:

/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libgmp.a(randmt.o): relocation R_X86_64_PC32 against symbol `__gmp_free_func' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: nonrepresentable section on output
collect2: error: ld returned 1 exit status
make[3]: *** [CMakeFiles/core.dir/build.make:142: ../../lib/pycarl/core.cpython-37m-x86_64-linux-gnu.so] Error 1
make[2]: *** [CMakeFiles/Makefile2:295: CMakeFiles/core.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:307: CMakeFiles/core.dir/rule] Error 2
make: *** [Makefile:196: core] Error 2

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

补充2:谢谢你们的意见。但我可以看到 .a 和 .so 都存在于库中。那么为什么它不选择共享的呢?或者如何动态链接它?我尝试了 LD_LIBRARY_PATH 但没有解决问题。

最佳答案

感谢您铺路@Tsyparev@Darklighter 。我想我已经明白了。Carl 安装了 gmp 6.2.1,因为它发现默认的 gmp tp 是 6.0.0。我所要做的就是将路径(即 LD_RUN_PATHLD_LIBRARY_PATH,对于像我这样的菜鸟来说)链接到该文件夹​​(即 carl/build/对我来说是 resources/lib)。

关于python - PyCarl 的 cmake 构建过程失败,并要求使用 -fPIC 重新编译,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58047469/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com