arkq / cmusfm

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

Missing md5 headers while installing on OS X #6

Closed 0mp closed 8 years ago

0mp commented 8 years ago

I don't know if this is an issue however I've encountered some problems when I was installing cmusfm on OS X. I just thought that you would like to know that there is an issue like this.

When I run the ../configure --enable-libnotify command from the installation guide for cmusfm I get the following output:

... a lot of checking here ... checking openssl/md5.h usability... no checking openssl/md5.h presence... no checking for openssl/md5.h... no configure: error: md5.h header not found

The solution turned out to be quite simple - I just had to run a command like this:

export CFLAGS='-I/your/path/to/openssl/include'

Here is a thread at StackExchange: http://superuser.com/questions/1034164/missing-md5-h-header-as-i-install-cmusfm-scrobbler-for-cmus-on-os-x.

Cheers!

arkq commented 8 years ago

Many tanks for pointing this out! I'll try to figure something out. Unfortunately I do not have access to any OS X host at the moment...

To be honest, I've never thought, that this code is compatible with OS X at all :D

0mp commented 8 years ago

It certainly is! Works like a charm!

arkq commented 8 years ago

Could you please check, if you can build the code from the fix-build branch without any troubles? Like I said before, I've got no access to the OS X :|

0mp commented 8 years ago

Nope, it does not work yet. It crashes when I run make && make install from the installation guide.

This is what I get:

$ make && make install
/Applications/Xcode.app/Contents/Developer/usr/bin/make  all-recursive
Making all in src
gcc -DHAVE_CONFIG_H -I. -I../../src -I..    -D_REENTRANT -I/usr/local/Cellar/libnotify/0.7.6/include -I/usr/local/Cellar/gdk-pixbuf/2.32.3/include/gdk-pixbuf-2.0 -I/usr/local/Cellar/libpng/1.6.21/include/libpng16 -I/usr/local/Cellar/glib/2.46.2/include/glib-2.0 -I/usr/local/Cellar/glib/2.46.2/lib/glib-2.0/include -I/usr/local/opt/gettext/include -g -O2 -MT cmusfm-cache.o -MD -MP -MF .deps/cmusfm-cache.Tpo -c -o cmusfm-cache.o `test -f 'cache.c' || echo '../../src/'`cache.c
mv -f .deps/cmusfm-cache.Tpo .deps/cmusfm-cache.Po
gcc -DHAVE_CONFIG_H -I. -I../../src -I..    -D_REENTRANT -I/usr/local/Cellar/libnotify/0.7.6/include -I/usr/local/Cellar/gdk-pixbuf/2.32.3/include/gdk-pixbuf-2.0 -I/usr/local/Cellar/libpng/1.6.21/include/libpng16 -I/usr/local/Cellar/glib/2.46.2/include/glib-2.0 -I/usr/local/Cellar/glib/2.46.2/lib/glib-2.0/include -I/usr/local/opt/gettext/include -g -O2 -MT cmusfm-config.o -MD -MP -MF .deps/cmusfm-config.Tpo -c -o cmusfm-config.o `test -f 'config.c' || echo '../../src/'`config.c
mv -f .deps/cmusfm-config.Tpo .deps/cmusfm-config.Po
gcc -DHAVE_CONFIG_H -I. -I../../src -I..    -D_REENTRANT -I/usr/local/Cellar/libnotify/0.7.6/include -I/usr/local/Cellar/gdk-pixbuf/2.32.3/include/gdk-pixbuf-2.0 -I/usr/local/Cellar/libpng/1.6.21/include/libpng16 -I/usr/local/Cellar/glib/2.46.2/include/glib-2.0 -I/usr/local/Cellar/glib/2.46.2/lib/glib-2.0/include -I/usr/local/opt/gettext/include -g -O2 -MT cmusfm-libscrobbler2.o -MD -MP -MF .deps/cmusfm-libscrobbler2.Tpo -c -o cmusfm-libscrobbler2.o `test -f 'libscrobbler2.c' || echo '../../src/'`libscrobbler2.c
../../src/libscrobbler2.c:32:10: fatal error: 'openssl/md5.h' file not found
#include <openssl/md5.h>
         ^
1 error generated.
make[2]: *** [cmusfm-libscrobbler2.o] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
arkq commented 8 years ago

Hmm.... it's a rather strange outcome :|

Could you provide the output from following commands:

autoreconf --version
pkg-config --version
pkg-config --cflags --libs libcurl
pkg-config --cflags --libs openssl
pkg-config --cflags --libs libcrypto
curl -V

Please, also check if the output from the ../configure --enable-libnotify contains these lines:

checking for LIBCURL... yes
checking for LIBCRYPTO... yes
checking for LIBNOTIFY... yes

But before that, try to make a fresh clone of the repo, checkout to the fix-build branch and then compile according to the instruction.

0mp commented 8 years ago

Sorry, for being so late. This is the output:

$ pkg-config --version
0.29

$ 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.43.0 (x86_64-apple-darwin15.0) libcurl/7.43.0 SecureTransport zlib/1.2.5
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 
$ ../configure --enable-libnotify
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... ../install-sh -c -d
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking poll.h usability... yes
checking poll.h presence... yes
checking for poll.h... yes
checking sys/inotify.h usability... no
checking sys/inotify.h presence... no
checking for sys/inotify.h... no
checking for pkg-config... /usr/local/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for LIBCURL... yes
checking for LIBCRYPTO... yes
checking for LIBNOTIFY... yes
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/Makefile
config.status: creating test/Makefile
config.status: creating config.h
config.status: executing depfiles commands
arkq commented 8 years ago

Thanks for the outputs! I'll try to figure something out. It has to be something trivial (or at least not impossible), because the ./configure part seems to be OK, but you never know... :)

In the meantime, I've merged the fix-build branch into the master, since the previous setup was incorrect anyway.

arkq commented 8 years ago

Please check if fix available in the apple-fix branch resolves this issue? I've checked this code on the El Capitan and it seems to work. However, I would like to get a positive feedback from you, before pushing it into the master and closing this issue.

0mp commented 8 years ago

I've installed cmusfm from the apple-fix branch. Everything went as expected. The scrobbler is working as well. The issue has been fixed. :+1:

rozhok commented 8 years ago

@0mp how you installed cmusfm? $ autoreconf --install?

0mp commented 8 years ago

@rozhok Yeah, I basically followed the installation steps. I can't remember if I installed any additional libraries using brew.

rozhok commented 8 years ago

@0mp Thanks! Actually (for those OS X users who dig in) I've had to run

brew install autoconf
brew install automake
brew install libnotify

Then follow installation steps and everything works fine.

deseven commented 6 years ago

I wasn't able to compile it as it is since there is a problem with openssl paths. So looks like this is what you should do for High Sierra:

brew install openssl automake libnotify
autoreconf --install
mkdir build && cd build
export CFLAGS='-L/usr/local/opt/openssl/lib -I/usr/local/opt/openssl/include'
export PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig
../configure --enable-libnotify
make && make install

Not sure if CFLAGS are needed, but PKG_CONFIG_PATH is obligatory.

arkq commented 6 years ago

I've thought that since commit 6334d95 this issue was finally over. So it seems, that I was wrong....

It should be possible to compile and run cmusfm without openssl. I've tested in on Linux, though.

@deseven if you've got some tinkering skills (and judging by your comment, you have :D), please check which "if" branch is compiled in this file. If you lack openssl, then build-in MD5 code should be included and compilation should work without any fuss. However, if HAVE_OPENSSL_MD5_H is defined, even though system-wide MD5 is not functional, it might be required to add some test program to the configure.ac in order to check MD5 usability.

First of all you should use "standard" way of compilation (just ../configure and make). Make sure that openssl is not installed (via brew) if you are not using it. Check if HAVE_OPENSSL_MD5_H is defined after configuration step (in the build/config.h file). If it is defined, try to compile, then if compilation fails due to missing symbol let me know about this. The crucial part is this line.

deseven commented 6 years ago

Wait a sec, guess i've confused you a little.
It's not about md5 now, pkg-config isn't able to find libcrypto :)

But now i can't reproduce that. I just tried to do everything from scratch (cloned repo again and reset CFLAGS and PKG_CONFIG_PATH vars) - it worked fine (with checking for openssl/md5.h... no)! Probably it was an old shell session or some other magic... Sorry for bothering you, no real problem here.

arkq commented 6 years ago

It's not about md5 now, pkg-config isn't able to find libcrypto :)

OK, so after all it is MD5 related :D When I was checking configure.ac file few minutes ago I've spotted this bug, that one might not be able to configure cmusfm due to missing libcrypto if openssl/md5.h is present but not functional. I'll try to fix that.

Anyway, I'm glad that everything works for you.

deseven commented 6 years ago

It has something to do with the fact that apple dropped openssl support a while ago and homebrew tries to do something with that. You can install openssl freely, but it won't link it (that's probably why pkg-config weren't able to find libcrypto):

Linking keg-only openssl means you may end up linking against the insecure, deprecated system OpenSSL while using the headers from Homebrew's openssl. Instead, pass the full include/library paths to your compiler

I still have no real explanation why your fix didn't work for me for the first time and why it works now.

JamesTheZ commented 5 years ago

Thank you for your solution. Add '-I/your/path/to/openssl/include' to CPATH, C_INCLUDE_PATH and CPLUS_INCLUDE_PATH also helps for me.