Compiling

pyspotify 編譯 ld 錯誤

  • July 9, 2020

我正在嘗試在我的 freebox delta 上安裝 mopidy-spotify,它允許我安裝 vm 並且是基於 arm64 的

。在許多問題之後,我設法讓大部分依賴項工作並擺脫了大部分錯誤。

但是在嘗試編譯 pyspotify 時,我仍然在 libspotify 上苦苦掙扎。我已經使用該連結的原始碼在我的系統上成功編譯(我認為)libspotify, 但我總是得到

這是日誌輸出:

Obtaining file:///home/jc/pyspotify
 Installing build dependencies ... done
 Getting requirements to build wheel ... done
 Installing backend dependencies ... done
   Preparing wheel metadata ... done
Requirement already satisfied: setuptools in /usr/lib/python3/dist-packages (from pyspotify==2.1.3) (45.2.0)
Requirement already satisfied: cffi>=1.0.0 in /usr/local/lib/python3.8/dist-packages (from pyspotify==2.1.3) (1.14.0)
Requirement already satisfied: pycparser in /usr/local/lib/python3.8/dist-packages (from cffi>=1.0.0->pyspotify==2.1.3) (2.20)
Installing collected packages: pyspotify
 Running setup.py develop for pyspotify
   ERROR: Command errored out with exit status 1:
    command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/home/jc/pyspotify/setup.py'"'"'; __file__='"'"'/home/jc/pyspotify/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps
        cwd: /home/jc/pyspotify/
   Complete output (22 lines):
   running develop
   running egg_info
   writing pyspotify.egg-info/PKG-INFO
   writing dependency_links to pyspotify.egg-info/dependency_links.txt
   writing requirements to pyspotify.egg-info/requires.txt
   writing top-level names to pyspotify.egg-info/top_level.txt
   reading manifest file 'pyspotify.egg-info/SOURCES.txt'
   reading manifest template 'MANIFEST.in'
   no previously-included directories found matching 'docs/_build'
   no previously-included directories found matching 'examples/tmp'
   warning: no previously-included files matching '__pycache__/*' found anywhere in distribution
   writing manifest file 'pyspotify.egg-info/SOURCES.txt'
   running build_ext
   generating cffi module 'build/temp.linux-aarch64-3.8/spotify._spotify.c'
   already up-to-date
   building 'spotify._spotify' extension
   aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.8 -c build/temp.linux-aarch64-3.8/spotify._spotify.c -o build/temp.linux-aarch64-3.8/build/temp.linux-aarch64-3.8/spotify._spotify.o
   aarch64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fwrapv -O2 -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-aarch64-3.8/build/temp.linux-aarch64-3.8/spotify._spotify.o -lspotify -o build/lib.linux-aarch64-3.8/spotify/_spotify.abi3.so
   /usr/bin/ld: skipping incompatible /usr/local/lib/libspotify.so when searching for -lspotify
   /usr/bin/ld: cannot find -lspotify
   collect2: error: ld returned 1 exit status
   error: command 'aarch64-linux-gnu-gcc' failed with exit status 1

請隨時詢問更多資訊

有什麼線索嗎?

您最有可能嘗試混合使用 32 位和 64 位庫。32 位應用程序必須連結到 32 位庫,而 64 位應用程序必須連結到 64 位庫。

您可以執行file /usr/local/lib/libspotify.so以檢查您的庫是否已編譯為 32 位或 64 位。

您可以通過設置以下環境變數來指示在 64 位系統上執行的 GCC 編譯 32 位程式碼:

CFLAGS=-m32 CXXFLAGS=-m32 make

另請參閱/usr/bin/ld: 在搜尋 foo 時跳過不兼容的 foo.so

引用自:https://unix.stackexchange.com/questions/594678