QwenLM / qwen.cpp

C++ implementation of Qwen-LM
Other
506 stars 40 forks source link

Python Binding 报错 #33

Open xinbingzhe opened 8 months ago

xinbingzhe commented 8 months ago

报错:

[ 98%] Linking CXX static library ../../../../lib/libabsl_flags_usage.a
[ 98%] Built target flags_usage
[ 99%] Building CXX object third_party/abseil-cpp/absl/flags/CMakeFiles/flags_parse.dir/parse.cc.o
/usr/bin/ld: lib/libre2.a(re2.cc.o): relocation R_X86_64_TPOFF32 against symbol `_ZN3re25hooks7contextE' can not be used when making a shared object; recompile with -fPIC
      /usr/bin/ld: lib/libabsl_raw_hash_set.a(raw_hash_set.cc.o): relocation R_X86_64_TPOFF32 against `_ZZN4absl18container_internal12_GLOBAL__N_110RandomSeedEvE7counter' can not be used when making a shared object; recompile with -fPIC
      /usr/bin/ld: lib/libabsl_base.a(sysinfo.cc.o): relocation R_X86_64_TPOFF32 against `_ZGVZN4absl13base_internal12GetCachedTIDEvE9thread_id' can not be used when making a shared object; recompile with -fPIC
      /usr/bin/ld: lib/libabsl_raw_logging_internal.a(raw_logging.cc.o): warning: relocation against `_ZN4absl16raw_log_internal21internal_log_functionB5cxx11E' in read-only section `.text'
      collect2: error: ld returned 1 exit status
      gmake[2]: *** [CMakeFiles/_C.dir/build.make:150: /qwen.cpp/build/lib.linux-x86_64-cpython-39/qwen_cpp/_C.cpython-39-x86_64-linux-gnu.so] Error 1
      gmake[1]: *** [CMakeFiles/Makefile2:932: CMakeFiles/_C.dir/all] Error 2
      gmake[1]: *** Waiting for unfinished jobs....
      [ 99%] Linking CXX static library ../../../../lib/libabsl_flags_parse.a
      [ 99%] Built target flags_parse
      [100%] Linking CXX static library ../../../../lib/libabsl_status.a
      [100%] Built target status
      gmake: *** [Makefile:136: all] Error 2
      cmake args

执行命令

CMAKE_ARGS="-DGGML_CUBLAS=ON -DCMAKE_CUDA_COMPILER=/usr/local/cuda/bin/nvcc" pip install .

环境

cuda-version: 11.8 python: 3.9.2 cmake: 3.27.7

yuebo commented 8 months ago

re2需要加参数才能在x64上编译成功,你可以试试 CMAKE_ARGS="-DGGML_CUBLAS=ON -DBUILD_SHARED_LIBS=ON -DCMAKE_CUDA_COMPILER=/usr/local/cuda/bin/nvcc" pip install .

xinbingzhe commented 8 months ago

re2需要加参数才能在x64上编译成功,你可以试试 CMAKE_ARGS="-DGGML_CUBLAS=ON -DBUILD_SHARED_LIBS=ON -DCMAKE_CUDA_COMPILER=/usr/local/cuda/bin/nvcc" pip install .

确实啊, CMakelist 加了 set(CMAKE_POSITION_INDEPENDENT_CODE ON) 解决了

zzzcccxx commented 5 months ago

re2需要加参数才能在x64上编译成功,你可以试试 CMAKE_ARGS="-DGGML_CUBLAS=ON -DBUILD_SHARED_LIBS=ON -DCMAKE_CUDA_COMPILER=/usr/local/cuda/bin/nvcc" pip install .

感谢,成功安装