Clang kann das von Homebrew installierte libportaudio nicht finden

2036
GolDDranks

Ich habe libportaudio mit Homebrew unter OS X installiert. Die Installation war erfolgreich und ich verifizierte, dass in /usr/local/includeund symbolische Links zu den eigentlichen Headern und Bibliotheken vorhanden waren /usr/local/lib.

Ich versuche jedoch jetzt makeeine Rustlang-Bindung ( https://github.com/JeremyLetang/rust-portaudio ), die die Bibliotheken verwendet. Es schlägt mit dem folgenden Fehler fehl:

error: linking with `cc` failed: exit code: 1 note: cc '-m64' '-L' '/usr/local/lib/rustlib/x86_64-apple-darwin/lib' '-o' 'target/libportaudio.dylib' 'target/portaudio.o' '-Wl,-force_load,/usr/local/lib/rustlib/x86_64-apple-darwin/lib/libmorestack.a' 'target/portaudio.metadata.o' '-nodefaultlibs' '-fno-lto' '-Wl,-dead_strip' '-L' '/usr/local/lib/rustlib/x86_64-apple-darwin/lib' '-lstd-4e7c5e5c' '-L' '/usr/local/lib/rustlib/x86_64-apple-darwin/lib' '-lsync-4e7c5e5c' '-L' '/usr/local/lib/rustlib/x86_64-apple-darwin/lib' '-lrustrt-4e7c5e5c' '-L' 'target/deps' '-L' '/Users/drasa/repo/rust-portaudio/.rust' '-L' '/Users/drasa/repo/rust-portaudio' '-lportaudio' '-lSystem' '-lpthread' '-lc' '-lm' '-dynamiclib' '-Wl,-dylib' '-lcompiler-rt' note: ld: warning: directory not found for option '-L/Users/drasa/repo/rust-portaudio/.rust' ld: library not found for -lportaudio clang: error: linker command failed with exit code 1 (use -v to see invocation)  error: aborting due to previous error 

Es scheint also, dass ccBibliotheken nicht nach dem Präfix / usr / local durchsucht werden. Soll das so sein? Wie kann ich das ändern? Sollen von Homebrew installierte Bibliotheken sofort funktionieren?

2

2 Antworten auf die Frage

1
Peter Eisentraut

Offenbar rustcruft das System die ccVerknüpfung auf, und es ist nicht dafür eingerichtet, nach /usr/local/lib/Bibliotheken zu suchen . Dies ist wohl die Schuld des Homebrew- rustPakets. (Es scheint, nach Header-Dateien unter zu suchen /usr/local/.)

Alternativ rust-portaudiokönnte das Paket pkg-configzur Lokalisierung verwendet werden portaudio.

Ich konnte es durch Laufen weiter bauen lassen

make COMPILER='rustc -L/usr/local/lib' 

Aber dann läuft es auf andere Fehler, die ich nicht verstehe.

1
GolDDranks

Ich habe das durch Einstellung gelöst

export LIBRARY_PATH="/usr/local/lib" 

Nachdem LIBRARY_PATH gesetzt ist, baut Cargo auch Rost-Portaudio ohne Probleme.