gcc 在mac上安装qpsolvers时出现问题

gz5pxeao  于 2022-11-24  发布在  Mac
关注(0)|答案(1)|浏览(290)

我试图在我的mac(https://pypi.org/project/qpsolvers/)上安装qpsolvers,但似乎编译器有问题。我运行的是莫哈韦10.14.5,Xcode 11.1。我使用pip install qpsolvers
我到处找都找不到解决的办法,下面是完整的输出,看来我需要把库从libstdc改为libc,因为前者已经被弃用了,但我不知道怎么做,提前谢谢了。

Collecting quadprog (from qpsolvers)
  Using cached https://files.pythonhosted.org/packages/5a/f0/d4c8866f5d14dfa1a441439f5ce0d2680844651772129c431e78caadfe10/quadprog-0.1.7.tar.gz
Requirement already satisfied: Cython in /anaconda3/lib/python3.7/site-packages (from quadprog->qpsolvers) (0.29.12)
Building wheels for collected packages: quadprog
  Building wheel for quadprog (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: //anaconda3/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/ts/tcs582c520v84jj30bwzm5b40000gn/T/pip-install-tmubn361/quadprog/setup.py'"'"'; __file__='"'"'/private/var/folders/ts/tcs582c520v84jj30bwzm5b40000gn/T/pip-install-tmubn361/quadprog/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/ts/tcs582c520v84jj30bwzm5b40000gn/T/pip-wheel-9l6gxhyh --python-tag cp37
       cwd: /private/var/folders/ts/tcs582c520v84jj30bwzm5b40000gn/T/pip-install-tmubn361/quadprog/
  Complete output (36 lines):
  running bdist_wheel
  running build
  running build_ext
  cythoning quadprog/quadprog.pyx to quadprog/quadprog.cpp
  //anaconda3/lib/python3.7/site-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /private/var/folders/ts/tcs582c520v84jj30bwzm5b40000gn/T/pip-install-tmubn361/quadprog/quadprog/quadprog.pyx
    tree = Parsing.p_module(s, pxd, full_module_name)
  building 'quadprog' extension
  creating build
  creating build/temp.macosx-10.7-x86_64-3.7
  creating build/temp.macosx-10.7-x86_64-3.7/quadprog
  gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I//anaconda3/include -arch x86_64 -I//anaconda3/include -arch x86_64 -Iquadprog -I//anaconda3/include/python3.7m -c quadprog/quadprog.cpp -o build/temp.macosx-10.7-x86_64-3.7/quadprog/quadprog.o
  warning: include path for stdlibc++ headers not found; pass '-stdlib=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]
  quadprog/quadprog.cpp:2507:28: warning: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Wsign-compare]
    __pyx_t_3 = ((__pyx_t_11 != __pyx_v_n1) != 0);
                  ~~~~~~~~~~ ^  ~~~~~~~~~~
  quadprog/quadprog.cpp:2620:28: warning: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Wsign-compare]
    __pyx_t_3 = ((__pyx_t_11 != __pyx_v_m1) != 0);
                  ~~~~~~~~~~ ^  ~~~~~~~~~~
  quadprog/quadprog.cpp:19494:26: warning: code will never be executed [-Wunreachable-code]
                  module = PyImport_ImportModuleLevelObject(
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  4 warnings generated.
  gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I//anaconda3/include -arch x86_64 -I//anaconda3/include -arch x86_64 -Iquadprog -I//anaconda3/include/python3.7m -c quadprog/aind.c -o build/temp.macosx-10.7-x86_64-3.7/quadprog/aind.o
  gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I//anaconda3/include -arch x86_64 -I//anaconda3/include -arch x86_64 -Iquadprog -I//anaconda3/include/python3.7m -c quadprog/solve.QP.c -o build/temp.macosx-10.7-x86_64-3.7/quadprog/solve.QP.o
  gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I//anaconda3/include -arch x86_64 -I//anaconda3/include -arch x86_64 -Iquadprog -I//anaconda3/include/python3.7m -c quadprog/util.c -o build/temp.macosx-10.7-x86_64-3.7/quadprog/util.o
  gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I//anaconda3/include -arch x86_64 -I//anaconda3/include -arch x86_64 -Iquadprog -I//anaconda3/include/python3.7m -c quadprog/dpofa.c -o build/temp.macosx-10.7-x86_64-3.7/quadprog/dpofa.o
  gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I//anaconda3/include -arch x86_64 -I//anaconda3/include -arch x86_64 -Iquadprog -I//anaconda3/include/python3.7m -c quadprog/daxpy.c -o build/temp.macosx-10.7-x86_64-3.7/quadprog/daxpy.o
  gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I//anaconda3/include -arch x86_64 -I//anaconda3/include -arch x86_64 -Iquadprog -I//anaconda3/include/python3.7m -c quadprog/ddot.c -o build/temp.macosx-10.7-x86_64-3.7/quadprog/ddot.o
  gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I//anaconda3/include -arch x86_64 -I//anaconda3/include -arch x86_64 -Iquadprog -I//anaconda3/include/python3.7m -c quadprog/dscal.c -o build/temp.macosx-10.7-x86_64-3.7/quadprog/dscal.o
  gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I//anaconda3/include -arch x86_64 -I//anaconda3/include -arch x86_64 -Iquadprog -I//anaconda3/include/python3.7m -c quadprog/f2c_lite.c -o build/temp.macosx-10.7-x86_64-3.7/quadprog/f2c_lite.o
  creating build/lib.macosx-10.7-x86_64-3.7
  g++ -bundle -undefined dynamic_lookup -L//anaconda3/lib -arch x86_64 -L//anaconda3/lib -arch x86_64 -arch x86_64 build/temp.macosx-10.7-x86_64-3.7/quadprog/quadprog.o build/temp.macosx-10.7-x86_64-3.7/quadprog/aind.o build/temp.macosx-10.7-x86_64-3.7/quadprog/solve.QP.o build/temp.macosx-10.7-x86_64-3.7/quadprog/util.o build/temp.macosx-10.7-x86_64-3.7/quadprog/dpofa.o build/temp.macosx-10.7-x86_64-3.7/quadprog/daxpy.o build/temp.macosx-10.7-x86_64-3.7/quadprog/ddot.o build/temp.macosx-10.7-x86_64-3.7/quadprog/dscal.o build/temp.macosx-10.7-x86_64-3.7/quadprog/f2c_lite.o -o build/lib.macosx-10.7-x86_64-3.7/quadprog.cpython-37m-darwin.so
  clang: warning: libstdc++ is deprecated; move to libc++ with a minimum deployment target of OS X 10.9 [-Wdeprecated]
  ld: library not found for -lstdc++
  clang: error: linker command failed with exit code 1 (use -v to see invocation)
  error: command 'g++' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for quadprog
  Running setup.py clean for quadprog
Failed to build quadprog
Installing collected packages: quadprog, qpsolvers
  Running setup.py install for quadprog ... error
    ERROR: Command errored out with exit status 1:
     command: //anaconda3/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/ts/tcs582c520v84jj30bwzm5b40000gn/T/pip-install-tmubn361/quadprog/setup.py'"'"'; __file__='"'"'/private/var/folders/ts/tcs582c520v84jj30bwzm5b40000gn/T/pip-install-tmubn361/quadprog/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/ts/tcs582c520v84jj30bwzm5b40000gn/T/pip-record-f4urqd3x/install-record.txt --single-version-externally-managed --compile
         cwd: /private/var/folders/ts/tcs582c520v84jj30bwzm5b40000gn/T/pip-install-tmubn361/quadprog/
    Complete output (34 lines):
    running install
    running build
    running build_ext
    skipping 'quadprog/quadprog.cpp' Cython extension (up-to-date)
    building 'quadprog' extension
    creating build
    creating build/temp.macosx-10.7-x86_64-3.7
    creating build/temp.macosx-10.7-x86_64-3.7/quadprog
    gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I//anaconda3/include -arch x86_64 -I//anaconda3/include -arch x86_64 -Iquadprog -I//anaconda3/include/python3.7m -c quadprog/quadprog.cpp -o build/temp.macosx-10.7-x86_64-3.7/quadprog/quadprog.o
    warning: include path for stdlibc++ headers not found; pass '-stdlib=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]
    quadprog/quadprog.cpp:2507:28: warning: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Wsign-compare]
      __pyx_t_3 = ((__pyx_t_11 != __pyx_v_n1) != 0);
                    ~~~~~~~~~~ ^  ~~~~~~~~~~
    quadprog/quadprog.cpp:2620:28: warning: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Wsign-compare]
      __pyx_t_3 = ((__pyx_t_11 != __pyx_v_m1) != 0);
                    ~~~~~~~~~~ ^  ~~~~~~~~~~
    quadprog/quadprog.cpp:19494:26: warning: code will never be executed [-Wunreachable-code]
                    module = PyImport_ImportModuleLevelObject(
                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    4 warnings generated.
    gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I//anaconda3/include -arch x86_64 -I//anaconda3/include -arch x86_64 -Iquadprog -I//anaconda3/include/python3.7m -c quadprog/aind.c -o build/temp.macosx-10.7-x86_64-3.7/quadprog/aind.o
    gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I//anaconda3/include -arch x86_64 -I//anaconda3/include -arch x86_64 -Iquadprog -I//anaconda3/include/python3.7m -c quadprog/solve.QP.c -o build/temp.macosx-10.7-x86_64-3.7/quadprog/solve.QP.o
    gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I//anaconda3/include -arch x86_64 -I//anaconda3/include -arch x86_64 -Iquadprog -I//anaconda3/include/python3.7m -c quadprog/util.c -o build/temp.macosx-10.7-x86_64-3.7/quadprog/util.o
    gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I//anaconda3/include -arch x86_64 -I//anaconda3/include -arch x86_64 -Iquadprog -I//anaconda3/include/python3.7m -c quadprog/dpofa.c -o build/temp.macosx-10.7-x86_64-3.7/quadprog/dpofa.o
    gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I//anaconda3/include -arch x86_64 -I//anaconda3/include -arch x86_64 -Iquadprog -I//anaconda3/include/python3.7m -c quadprog/daxpy.c -o build/temp.macosx-10.7-x86_64-3.7/quadprog/daxpy.o
    gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I//anaconda3/include -arch x86_64 -I//anaconda3/include -arch x86_64 -Iquadprog -I//anaconda3/include/python3.7m -c quadprog/ddot.c -o build/temp.macosx-10.7-x86_64-3.7/quadprog/ddot.o
    gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I//anaconda3/include -arch x86_64 -I//anaconda3/include -arch x86_64 -Iquadprog -I//anaconda3/include/python3.7m -c quadprog/dscal.c -o build/temp.macosx-10.7-x86_64-3.7/quadprog/dscal.o
    gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I//anaconda3/include -arch x86_64 -I//anaconda3/include -arch x86_64 -Iquadprog -I//anaconda3/include/python3.7m -c quadprog/f2c_lite.c -o build/temp.macosx-10.7-x86_64-3.7/quadprog/f2c_lite.o
    creating build/lib.macosx-10.7-x86_64-3.7
    g++ -bundle -undefined dynamic_lookup -L//anaconda3/lib -arch x86_64 -L//anaconda3/lib -arch x86_64 -arch x86_64 build/temp.macosx-10.7-x86_64-3.7/quadprog/quadprog.o build/temp.macosx-10.7-x86_64-3.7/quadprog/aind.o build/temp.macosx-10.7-x86_64-3.7/quadprog/solve.QP.o build/temp.macosx-10.7-x86_64-3.7/quadprog/util.o build/temp.macosx-10.7-x86_64-3.7/quadprog/dpofa.o build/temp.macosx-10.7-x86_64-3.7/quadprog/daxpy.o build/temp.macosx-10.7-x86_64-3.7/quadprog/ddot.o build/temp.macosx-10.7-x86_64-3.7/quadprog/dscal.o build/temp.macosx-10.7-x86_64-3.7/quadprog/f2c_lite.o -o build/lib.macosx-10.7-x86_64-3.7/quadprog.cpython-37m-darwin.so
    clang: warning: libstdc++ is deprecated; move to libc++ with a minimum deployment target of OS X 10.9 [-Wdeprecated]
    ld: library not found for -lstdc++
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    error: command 'g++' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: //anaconda3/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/ts/tcs582c520v84jj30bwzm5b40000gn/T/pip-install-tmubn361/quadprog/setup.py'"'"'; __file__='"'"'/private/var/folders/ts/tcs582c520v84jj30bwzm5b40000gn/T/pip-install-tmubn361/quadprog/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/ts/tcs582c520v84jj30bwzm5b40000gn/T/pip-record-f4urqd3x/install-record.txt --single-version-externally-managed --compile Check the logs for full command output.```
vd8tlhqk

vd8tlhqk1#

很高兴听到Xcode更新工作。
这个问题应该不会再发生了,因为(1)quadprog已经成为qpsolvers的可选依赖项,(2)quadprog已经通过添加轮子修复了他们这方面的仅从源代码构建的问题。

相关问题