OS X 10.10: Undefined symbols for architecture x86_64
kevinmook opened this issue · 15 comments
I'm trying to build spop on OS X 10.10 but I'm having trouble getting it to compile.
When I run './build_and_run' I get the following output:
kevin@Kevins-MBP:~/programming/kevin/music/third_party/spop (master)$ ./build_and_run
-- The C compiler identification is AppleClang 6.0.0.6000057
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Found PkgConfig: /usr/local/bin/pkg-config (found version "0.28")
-- checking for module 'libspotify>=12.1.45'
-- found libspotify, version 12.1.51
-- checking for module 'glib-2.0>=2.26'
-- found glib-2.0, version 2.42.2
-- checking for module 'gmodule-2.0'
-- found gmodule-2.0, version 2.42.2
-- checking for module 'gthread-2.0'
-- found gthread-2.0, version 2.42.2
-- checking for module 'json-glib-1.0>=0.12'
-- found json-glib-1.0, version 1.0.2
-- Looking for include file sys/soundcard.h
-- Looking for include file sys/soundcard.h - not found
-- checking for module 'ao'
-- found ao, version 1.2.0
-- checking for module 'dbus-glib-1'
-- found dbus-glib-1, version 0.102
-- checking for module 'gio-unix-2.0'
-- found gio-unix-2.0, version 2.42.2
-- checking for module 'libnotify'
-- package 'libnotify' not found
-- checking for module 'libsoup-2.4'
-- found libsoup-2.4, version 2.48.1
-- checking for module 'sox'
-- found sox, version 14.4.2
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/kevin/programming/kevin/music/third_party/spop/build
Scanning dependencies of target spop_audio_ao
[ 4%] Building C object CMakeFiles/spop_audio_ao.dir/plugins/ao.c.o
Linking C shared module libspop_audio_ao.so
[ 4%] Built target spop_audio_ao
Scanning dependencies of target spop_audio_sox
[ 8%] Building C object CMakeFiles/spop_audio_sox.dir/plugins/sox.c.o
Linking C shared module libspop_audio_sox.so
Undefined symbols for architecture x86_64:
"_config_get_string_list_group", referenced from:
_audio_delivery in sox.c.o
"_config_get_string_opt_group", referenced from:
_audio_delivery in sox.c.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [libspop_audio_sox.so] Error 1
make[1]: *** [CMakeFiles/spop_audio_sox.dir/all] Error 2
make: *** [all] Error 2
I saw in another issue you asked someone to try running make directly in the build folder with VERBOSE=1. In case that's helpful here, here's the output from that:
kevin@Kevins-MBP:~/programming/kevin/music/third_party/spop/build (master)$ make VERBOSE=1
/usr/local/Cellar/cmake/3.1.3/bin/cmake -H/Users/kevin/programming/kevin/music/third_party/spop -B/Users/kevin/programming/kevin/music/third_party/spop/build --check-build-system CMakeFiles/Makefile.cmake 0
/usr/local/Cellar/cmake/3.1.3/bin/cmake -E cmake_progress_start /Users/kevin/programming/kevin/music/third_party/spop/build/CMakeFiles /Users/kevin/programming/kevin/music/third_party/spop/build/CMakeFiles/progress.marks
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/Makefile2 all
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/spop_audio_ao.dir/build.make CMakeFiles/spop_audio_ao.dir/depend
cd /Users/kevin/programming/kevin/music/third_party/spop/build && /usr/local/Cellar/cmake/3.1.3/bin/cmake -E cmake_depends "Unix Makefiles" /Users/kevin/programming/kevin/music/third_party/spop /Users/kevin/programming/kevin/music/third_party/spop /Users/kevin/programming/kevin/music/third_party/spop/build /Users/kevin/programming/kevin/music/third_party/spop/build /Users/kevin/programming/kevin/music/third_party/spop/build/CMakeFiles/spop_audio_ao.dir/DependInfo.cmake --color=
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/spop_audio_ao.dir/build.make CMakeFiles/spop_audio_ao.dir/build
make[2]: Nothing to be done for `CMakeFiles/spop_audio_ao.dir/build'.
/usr/local/Cellar/cmake/3.1.3/bin/cmake -E cmake_progress_report /Users/kevin/programming/kevin/music/third_party/spop/build/CMakeFiles 1
[ 4%] Built target spop_audio_ao
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/spop_audio_sox.dir/build.make CMakeFiles/spop_audio_sox.dir/depend
cd /Users/kevin/programming/kevin/music/third_party/spop/build && /usr/local/Cellar/cmake/3.1.3/bin/cmake -E cmake_depends "Unix Makefiles" /Users/kevin/programming/kevin/music/third_party/spop /Users/kevin/programming/kevin/music/third_party/spop /Users/kevin/programming/kevin/music/third_party/spop/build /Users/kevin/programming/kevin/music/third_party/spop/build /Users/kevin/programming/kevin/music/third_party/spop/build/CMakeFiles/spop_audio_sox.dir/DependInfo.cmake --color=
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/spop_audio_sox.dir/build.make CMakeFiles/spop_audio_sox.dir/build
Linking C shared module libspop_audio_sox.so
/usr/local/Cellar/cmake/3.1.3/bin/cmake -E cmake_link_script CMakeFiles/spop_audio_sox.dir/link.txt --verbose=1
/usr/bin/cc -g -bundle -Wl,-headerpad_max_install_names -o libspop_audio_sox.so CMakeFiles/spop_audio_sox.dir/plugins/sox.c.o -lsox -lgthread-2.0 -lglib-2.0 -lintl
Undefined symbols for architecture x86_64:
"_config_get_string_list_group", referenced from:
_audio_delivery in sox.c.o
"_config_get_string_opt_group", referenced from:
_audio_delivery in sox.c.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [libspop_audio_sox.so] Error 1
make[1]: *** [CMakeFiles/spop_audio_sox.dir/all] Error 2
make: *** [all] Error 2
I realize this may not be much to go on so please let me know if there's anything else you may need. Thank you!
I don't have a Mac so I'm afraid it will be quite hard to help you with that one :( Could you please mail me a tarball of the whole build
directory?
Other ideas that could work:
-
in
CMakeLists.txt
, add the following before# Audio plugin: OSS
:if(APPLE) set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS} -undefined dynamic_lookup") endif(APPLE)
Then
rm -rf build
and re-run./build_and_run -d
-
if it still doesn't work, add
-flat_namespace
before-undefined dynamic_lookup
in the line below, remove thebuild
folder, and rebuild everything -
if it still doesn't work, add
src/config.c
afterplugins/sox.c
, remove thebuild
folder, and rebuild everything -
finally if it still doesn't work, then please send me a tarball of the
build
folder and I'll have a look
Thanks! :)
Hi,
As I have same issue, I've also followed your recommendations but with no success. Here is the build directory http://inft.ly/3fTrAMU and the output of the build http://inft.ly/jqDxibw
Thanks
Could you please try again with this CMakeLists.txt file: http://ix.io/h6S
Thanks!
Thanks for the response!
The new CMakeLists.txt file still errors, but it gets further: https://gist.github.com/kevinmook/abc3d83c0b2bc71b1bc3
If I change line 81 in CMakeLists.txt, removing "rt", it compiles and runs, though I'm sure that'll break something important :) We're close, though!
On my side, I get same error and if I remove "rt", I get:
./build_and_run -d
Running CMake to regenerate build system...
-- checking for module 'dbus-glib-1'
-- package 'dbus-glib-1' not found
-- checking for module 'libnotify'
-- package 'libnotify' not found
-- checking for module 'libsoup-2.4'
-- package 'libsoup-2.4' not found
-- checking for module 'sox'
-- package 'sox' not found
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/vdesabou/Downloads/spop/build
[ 5%] Built target spop_audio_ao
[ 45%] Built target spop_plugin_mpris2
[ 50%] Built target spop_plugin_savestate
Linking C executable spopd
[100%] Built target spopd
dyld: Library not loaded: /usr/local/opt/libspotify/lib/libspotify
Referenced from: /Users/vdesabou/Downloads/spop/build/spopd
Reason: image not found
Trace/BPT trap: 5
Thanks
Apparently not requiring rt
is Apple-specific, so yes it should work without it. Thanks @kevinmook, I'll commit that soon! :)
@vdesabou, what's in your /usr/local/opt/libspotify/lib
folder, and what's the output of otool -L /Users/vdesabou/Downloads/spop/build/spopd
?
@vdesabou, what's in your /usr/local/opt/libspotify/lib folder
ls -l /usr/local/opt/libspotify/lib
total 8048
-r--r--r-- 1 vdesabou wheel 4109560 Mar 24 17:01 libspotify.12.1.51.dylib
lrwxr-xr-x 1 vdesabou admin 24 Mar 24 17:01 libspotify.12.dylib@ -> libspotify.12.1.51.dylib
lrwxr-xr-x 1 vdesabou admin 24 Mar 24 17:01 libspotify.dylib@ -> libspotify.12.1.51.dylib
drwxr-xr-x 3 vdesabou admin 102 Mar 24 17:01 pkgconfig/
and what's the output of otool -L /Users/vdesabou/Downloads/spop/build/spopd?
otool -L /Users/vdesabou/Downloads/spop/build/spopd
/Users/vdesabou/Downloads/spop/build/spopd:
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)
/usr/local/opt/libspotify/lib/libspotify (compatibility version 12.1.51, current version 12.1.51)
/usr/local/lib/libglib-2.0.0.dylib (compatibility version 4201.0.0, current version 4201.2.0)
/usr/local/opt/gettext/lib/libintl.8.dylib (compatibility version 10.0.0, current version 10.3.0)
/usr/local/lib/libgmodule-2.0.0.dylib (compatibility version 4201.0.0, current version 4201.2.0)
/usr/local/lib/libgthread-2.0.0.dylib (compatibility version 4201.0.0, current version 4201.2.0)
/usr/local/lib/libjson-glib-1.0.0.dylib (compatibility version 1.0.0, current version 1.2.0)
/usr/local/lib/libgio-2.0.0.dylib (compatibility version 4201.0.0, current version 4201.2.0)
/usr/local/lib/libgobject-2.0.0.dylib (compatibility version 4201.0.0, current version 4201.2.0)
Thanks!
Ok, so it looks for a file named "libspotify" instead of "libspotify.dylib"... Could you please try to add the following line inside the if(APPLE)
block:
set(CMAKE_SHARED_LIBRARY_SUFFIX ".dylib")
And rebuild?
(A quicker hack if you just want it to "work" would be to symlink libspotify.dylib to libspotify 😉)
I did it, at the end I get:
Linking C executable spopd
[100%] Built target spopd
dyld: Library not loaded: /usr/local/opt/libspotify/lib/libspotify
Referenced from: /Users/vdesabou/Downloads/spop/build/spopd
Reason: image not found
Trace/BPT trap: 5
This is the zip file http://inft.ly/m9twQet
:(
After some googling, it looks like it's really an issue from libspotify. And as I don't have a Mac, I can't really fix that...
So in the end you should probably symlink libspotify.dylib
to libspotify
(ln -s /usr/local/opt/libspotify/lib/libspotify/libspotify.dylib /usr/local/opt/libspotify/lib/libspotify/libspotify.dylib
).
An alternative is to install libspotify with Homebrew using the formula from Mopidy: brew install https://raw.github.com/mopidy/homebrew-mopidy/master/libspotify.rb
(which actually creates this symlink because they have the exact same issue).
@kevinmook, could you please tell me how you installed libspotify, and what's the output of otool -L build/spopd
for you?
Thanks!
That's strange I thought I installed it via Homebrew..
Anyway, I did :
ln -s /usr/local/opt/libspotify/lib/libspotify.dylib /usr/local/opt/libspotify/lib/libspotify
And now the error is gone, thanks!
I get now:
./build_and_run -fv
Running CMake to regenerate build system...
-- checking for module 'dbus-glib-1'
-- package 'dbus-glib-1' not found
-- checking for module 'libnotify'
-- package 'libnotify' not found
-- checking for module 'libsoup-2.4'
-- package 'libsoup-2.4' not found
-- checking for module 'sox'
-- package 'sox' not found
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/vdesabou/Downloads/spop/build
[ 5%] Built target spop_audio_ao
[ 45%] Built target spop_plugin_mpris2
[ 50%] Built target spop_plugin_savestate
[100%] Built target spopd
spop Copyright (C) 2010, 2011, 2012, 2013, 2014 Thomas Jost
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it under certain conditions.
See the COPYING file bundled with this program for details.
Powered by SPOTIFY(R) CORE
2015-03-26 12:53:57 [ERR ] Can't open log file (/var/log/spopd.log): Permission denied
Trace/BPT trap: 5
So I tried to run with sudo:
sudo ./build_and_run -fv
Password:
Running CMake to regenerate build system...
-- checking for module 'dbus-glib-1'
-- package 'dbus-glib-1' not found
-- checking for module 'libnotify'
-- package 'libnotify' not found
-- checking for module 'libsoup-2.4'
-- package 'libsoup-2.4' not found
-- checking for module 'sox'
-- package 'sox' not found
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/vdesabou/Downloads/spop/build
[ 5%] Built target spop_audio_ao
[ 45%] Built target spop_plugin_mpris2
[ 50%] Built target spop_plugin_savestate
[100%] Built target spopd
spop Copyright (C) 2010, 2011, 2012, 2013, 2014 Thomas Jost
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it under certain conditions.
See the COPYING file bundled with this program for details.
Powered by SPOTIFY(R) CORE
2015-03-26 12:54:28 [ERR ] Can't load oss audio plugin: dlopen(libspop_audio_oss.so, 9): image not found
You probably did't conifgure spop :) In the config file, you can set audio_output
to ao
(oss won't work on OSX anyway...), and set log_file
to an empty string (log_file =
) to completely avoid logging. This way you won't have to use sudo either.
You probably did't conifgure spop :)
That's right, I applied your recommendations and now it works fine. Thanks for your precious help
Glad it works! Thanks for your help resolving this :)
I'll push a few commits soon that add the correct linker flags and don't add -lrt
on OSX, change the default audio output to ao
, and document the libspotify installation with Homebrew in the README.