Open passionate11 opened 7 months ago
根据 Copilot的回答:
这个错误是由于在尝试链接一个不是以-fPIC
(Position Independent Code)选项编译的静态库(在这里是libre2.a
)时产生的。在创建共享库或者动态库时,需要所有的对象代码都是位置无关的,也就是说,它们可以在内存中的任何位置执行。
解决这个问题的方法是在编译re2
库时添加-fPIC
选项。你需要找到编译re2
库的CMakeLists.txt
文件,然后在其中添加-fPIC
编译选项。这通常可以通过在add_library
或target_compile_options
命令中添加-fPIC
来实现。
亲测在 setup.py 102行添加
cmake_args += ["-DCMAKE_CXX_FLAGS=-fPIC"]
再执行
pip install -e .
可行
根据 Copilot的回答: 这个错误是由于在尝试链接一个不是以
-fPIC
(Position Independent Code)选项编译的静态库(在这里是libre2.a
)时产生的。在创建共享库或者动态库时,需要所有的对象代码都是位置无关的,也就是说,它们可以在内存中的任何位置执行。解决这个问题的方法是在编译
re2
库时添加-fPIC
选项。你需要找到编译re2
库的CMakeLists.txt
文件,然后在其中添加-fPIC
编译选项。这通常可以通过在add_library
或target_compile_options
命令中添加-fPIC
来实现。亲测在 setup.py 102行添加
cmake_args += ["-DCMAKE_CXX_FLAGS=-fPIC"]
再执行
pip install -e .
可行
感谢大佬
运行命令:pip install -U qwen-cpp,请问这个是什么问题? 报错如下: Collecting qwen-cpp Using cached https://pypi.tuna.tsinghua.edu.cn/packages/a4/76/61e947717636072018ce25a5929af05b0e47538a564cc0c3298935b38a49/qwen-cpp-0.1.3.tar.gz (2.9 MB) Installing build dependencies ... done Getting requirements to build wheel ... done Installing backend dependencies ... done Preparing metadata (pyproject.toml) ... done Building wheels for collected packages: qwen-cpp Building wheel for qwen-cpp (pyproject.toml) ... error error: subprocess-exited-with-error
× Building wheel for qwen-cpp (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [522 lines of output] running bdist_wheel running build running build_py creating build creating build/lib.linux-x86_64-cpython-38 creating build/lib.linux-x86_64-cpython-38/qwen_cpp copying qwen_cpp/init.py -> build/lib.linux-x86_64-cpython-38/qwen_cpp copying qwen_cpp/convert.py -> build/lib.linux-x86_64-cpython-38/qwen_cpp creating build/lib.linux-x86_64-cpython-38/tiktoken_cpp copying tiktoken_cpp/registry.py -> build/lib.linux-x86_64-cpython-38/tiktoken_cpp copying tiktoken_cpp/core.py -> build/lib.linux-x86_64-cpython-38/tiktoken_cpp copying tiktoken_cpp/model.py -> build/lib.linux-x86_64-cpython-38/tiktoken_cpp copying tiktoken_cpp/init.py -> build/lib.linux-x86_64-cpython-38/tiktoken_cpp copying tiktoken_cpp/load.py -> build/lib.linux-x86_64-cpython-38/tiktoken_cpp running egg_info writing qwen_cpp.egg-info/PKG-INFO writing dependency_links to qwen_cpp.egg-info/dependency_links.txt writing top-level names to qwen_cpp.egg-info/top_level.txt reading manifest file 'qwen_cpp.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' adding license file 'LICENSE' adding license file 'NOTICE' writing manifest file 'qwen_cpp.egg-info/SOURCES.txt' running build_ext -- The CXX compiler identification is GNU 9.5.0 -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /usr/bin/c++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Performing Test ABSL_INTERNAL_AT_LEAST_CXX17 -- Performing Test ABSL_INTERNAL_AT_LEAST_CXX17 - Success -- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success -- Found Threads: TRUE CMake Warning at third_party/abseil-cpp/CMakeLists.txt:193 (message): The default and system-level install directories are unsupported except in LTS releases of Abseil. Please set CMAKE_INSTALL_PREFIX to install Abseil in your source or build tree directly.
note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for qwen-cpp Failed to build qwen-cpp ERROR: Could not build wheels for qwen-cpp, which is required to install pyproject.toml-based projects