Bug #69920 Can't build ndb memcached engine against unbundled default memcached installatio
Submitted: 3 Aug 2013 23:17 Modified: 26 Sep 2014 21:44
Reporter: Hartmut Holzgraefe Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Cluster: Memcached Severity:S3 (Non-critical)
Version:MySQL Cluster 7.3.1, 7.3.2, 7.4.1 OS:Linux
Assigned to: CPU Architecture:Any

[3 Aug 2013 23:17] Hartmut Holzgraefe
Description:
Building Cluster 7.3.0 against a default install of memcached 1.6beta1 instead of the bundled source fails with:

 [ 80%] Built target ndbmemcache
 Linking CXX shared module ndb_engine.so
 /usr/bin/ld.gold.real: error: cannot find -lmemcached_utilities
 collect2: error: ld returned 1 exit status
 make[2]: *** [storage/ndb/memcache/ndb_engine.so] Error 1
 make[1]: *** [storage/ndb/memcache/CMakeFiles/ndb_engine.dir/all] Error 2
 make: *** [all] Error 2
 
CMake checks find the memcached_utilities library in the correct directory /usr/local/lib/memcached but this library path is not passed to the linker call for ndb_engine.so

How to repeat:
First build memcached 1.6beta1 using default configure settings (prefix=/usr/local, libraries go to /usr/local/lib/memcached)

Then build mysql cluster with "cmake -DWITH_BUNDLED_MEMCACHED=0"

Suggested fix:
--- mysql-cluster-gpl-7.3.0/storage/ndb/memcache/CMakeLists.txt	2012-09-25 12:20:48.000000000 +0200
+++ patched/storage/ndb/memcache/CMakeLists.txt	2013-08-03 20:48:22.871835002 +0200
@@ -179,7 +179,7 @@
 # Build the convenience library
 ADD_CONVENIENCE_LIBRARY(ndbmemcache ${NDB_MEMCACHE_SOURCE_FILES})
 
-target_link_libraries(ndbmemcache ndbclient_static ndbgeneral memcached_utilities)
+target_link_libraries(ndbmemcache ndbclient_static ndbgeneral ${MEMCACHED_UTILITIES_LIBRARY} ${CMAKE_DL_LIBS})
 
 # Build the module
 add_library(ndb_engine MODULE src/ndb_engine.c src/stub.cc)
[6 Aug 2013 11:45] Hartmut Holzgraefe
Also reproducible with 7.3.2
[7 Aug 2013 9:20] MySQL Verification Team
Hello Hartmut,

Thank you for the bug report. 
Verified as described on 7.3.2 version.

Thanks,
Umesh
[7 Aug 2013 9:24] MySQL Verification Team
How to repeat:

// Install memcached
cd /tmp/
wget http://code.google.com/p/memcached/downloads/detail?name=memcached-1.6.0_beta1.tar.gz&;

tar -zxvf memcached-1.6.0_beta1.tar.gz
cd memcached-1.6.0_beta1
./configure --prefix=/usr/local
make
make install

// 7.3.2 source

cmake -DCMAKE_INSTALL_PREFIX=/data/ushastry/cluster/mysql-cluster-7.3.2 -DWITH_BUNDLED_MEMCACHED=0
make
..
..

[ 86%] Building C object storage/ndb/memcache/CMakeFiles/ndb_engine.dir/src/ndb_engine.c.o
[ 86%] Building CXX object storage/ndb/memcache/CMakeFiles/ndb_engine.dir/src/stub.cc.o
Linking CXX shared module ndb_engine.so
/usr/bin/ld: cannot find -lmemcached_utilities
collect2: ld returned 1 exit status
make[2]: *** [storage/ndb/memcache/ndb_engine.so] Error 1
make[1]: *** [storage/ndb/memcache/CMakeFiles/ndb_engine.dir/all] Error 2
make: *** [all] Error 2
[ushastry@cluster-repo mysql-cluster-com-7.3.2]
[26 Sep 2014 21:44] Hartmut Holzgraefe
Apparently still unfixed in 7.4.1