notandy / ympd

Standalone MPD Web GUI written in C, utilizing Websockets and Bootstrap/JS
http://www.ympd.org
GNU General Public License v2.0
517 stars 144 forks source link

How to specify libmpdclient location? #51

Closed rafi closed 9 years ago

rafi commented 9 years ago

I'm using OSX with Macports, where my installed libs are in /opt/local/lib and /opt/local/include. I tryied:

$ cmake .. -DCMAKE_INSTALL_PREFIX:PATH=/opt/local -DCMAKE_INCLUDE_PATH:PATH=/opt/local/include -DCMAKE_PREFIX_PATH:PATH=/opt/local

Also tried prepending this to cmake_install.cmake:

INCLUDE_DIRECTORIES(/opt/local/include)
LINK_DIRECTORIES(/opt/local/lib)

But still getting error on make

$ make
[ 12%] Built target mkdata
[ 25%] Building C object CMakeFiles/ympd.dir/src/mpd_client.c.o
/Users/rafi/code/c/ympd/src/mpd_client.c:24:10: fatal error: 'mpd/client.h' file not found
#include <mpd/client.h>
         ^
1 error generated.
make[2]: *** [CMakeFiles/ympd.dir/src/mpd_client.c.o] Error 1
make[1]: *** [CMakeFiles/ympd.dir/all] Error 2
make: *** [all] Error 2
hamishcunningham commented 9 years ago

I seem to have a similar problem at the cmake stage (building on Ubuntu 14.10). It complains libmpdclient isn't present; I duly installed it, but cmake still fails to find it. I tried deleting the cmake cache and so on, but no luck :-(

cmake .. -DCMAKE_INSTALL_PREFIX:PATH=/usr
-- The C compiler identification is GNU 4.9.1
-- The CXX compiler identification is GNU 4.9.1
-- 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
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.28")
CMake Error at
/usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:108
(message):
  Could NOT find LibMPDClient (missing: LIBMPDCLIENT_LIBRARY
  LIBMPDCLIENT_INCLUDE_DIR)
Call Stack (most recent call first):
  /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:315
(_FPHSA_FAILURE_MESSAGE)
  cmake/FindLibMPDClient.cmake:27 (find_package_handle_standard_args)
  CMakeLists.txt:18 (find_package)

The libmpdclient package is now called libmpdclient2, but it installs as:

ls -lh /usr/lib/libmpdclient*
lrwxrwxrwx 1 root root  21 Dec 30  2013 /usr/lib/libmpdclient.so.2 -> libmpdclient.so.2.0.9
-rw-r--r-- 1 root root 92K Dec 30  2013 /usr/lib/libmpdclient.so.2.0.9

Any ideas? Tnx, Hamish

rafi commented 9 years ago

I solved this by adding INCLUDE_DIRECTORIES(/opt/local/include) in CMakeLists.txt.

hamishcunningham commented 9 years ago

Or, thinking about it, what I actually needed to do was install libmpdclient-dev as well as the library itself... It would be good to add this in the dependencies list. H

Thanks rafi; I hadn't installed the libmpdclient source; having done this and added these it worked:

set(LIBMPDCLIENT_LIBRARY /usr/lib/libmpdclient.so.2)
include_directories(/home/hamish/libmpdclient-2.9/include)

Best, H