arkq / cmusfm

Last.fm standalone scrobbler for the cmus music player
GNU General Public License v3.0
232 stars 5 forks source link

Building on macOS #8

Closed PhilipTrauner closed 7 years ago

PhilipTrauner commented 7 years ago

I don't have the slightest idea how the build system works but I managed to get cmusfm to build on macOS by manually adding the generated Makefile in build/src/Makefile (Line 277).

Before:

cmusfm_CFLAGS =  $(am__append_2)

After:

cmusfm_CFLAGS = -L/usr/local/opt/openssl/lib -I/usr/local/opt/openssl/include $(am__append_2)

openssl has to be installed with homebrew.

I'd really appreciate a "fix" and would gladly help testing!

arkq commented 7 years ago

Hi,

I'm not a OSX user, so it is hard for me to debug it. However, have you seen the #6 issue. The installation process on OSX has been explained there, I think. If the instructions provided there will not help, I will remove the openssl dependency (at least for OSX).

PhilipTrauner commented 7 years ago

Should have looked at closed issues before opening a new one. Still, the problem seems to be a different one now.

Running make with unmodified CFLAGS results in a linker error.

gcc -D_REENTRANT -I/usr/local/Cellar/libnotify/0.7.7/include -I/usr/local/Cellar/gdk-pixbuf/2.36.2/include/gdk-pixbuf-2.0 -I/usr/local/Cellar/libpng/1.6.27/include/libpng16 -I/usr/local/Cellar/glib/2.50.2/include/glib-2.0 -I/usr/local/Cellar/glib/2.50.2/lib/glib-2.0/include -I/usr/local/opt/gettext/include -I/usr/local/Cellar/pcre/8.39/include    -o cmusfm cmusfm-cache.o cmusfm-config.o cmusfm-libscrobbler2.o cmusfm-server.o cmusfm-utils.o cmusfm-main.o cmusfm-notify.o -lcurl -lcrypto -lz -L/usr/local/Cellar/libnotify/0.7.7/lib -L/usr/local/Cellar/gdk-pixbuf/2.36.2/lib -L/usr/local/Cellar/glib/2.50.2/lib -L/usr/local/opt/gettext/lib -lnotify -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lintl
ld: library not found for -lcrypto
clang: error: linker command failed with exit code 1 (use -v to see invocation)

After running export CFLAGS='-L/usr/local/opt/openssl/lib -I/usr/local/opt/openssl/include' and ../configure --enable-libnotify the make command succeeds but throws warnings that '-L/usr/local/opt/openssl/lib'was unused during compilation. So I removed it from my CFLAGS (export CFLAGS='-I/usr/local/opt/openssl/include') and suddenly the linker error is back.

The md5 header issue seems to be fixed tough, I never ran into it.

This is the output of the commands mentioned in #6.

$ autoreconf --version
autoreconf (GNU Autoconf) 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+/Autoconf: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>, <http://gnu.org/licenses/exceptions.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by David J. MacKenzie and Akim Demaille.
$ pkg-config --version
0.29.1
$ pkg-config --cflags --libs libcurl
-lcurl
$ pkg-config --cflags --libs openssl
-lssl -lcrypto -lz
$ pkg-config --cflags --libs libcrypto
-lcrypto -lz
$ curl -V
curl 7.51.0 (x86_64-apple-darwin16.0) libcurl/7.51.0 SecureTransport zlib/1.2.8
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz UnixSockets

checking for LIBCURL... yes, checking for LIBCRYPTO... yes, checking for LIBNOTIFY... yes are all included in the ../configure output.

arkq commented 7 years ago

Please, try the code from the md5 branch. I've removed the mandatory dependency for OpenSSL. If the MD5 functionality is not usable, then the bundled version is used. This should fix the compilation issue on OS X once and for all.

If anyone could confirm, that this solutions works, I'd be much obliged. I will try to test it by myself after this weekend.

PhilipTrauner commented 7 years ago

I just updated my MacBook to 10.12.3 and the master as well as the md5 branch build without errors. Either there was a change in 10.12.3 that made it work (which I can't imagine) or there is something seriously wrong with my 10.12.2 machine. Thank you very much, consider it fixed! 😃