Help Building libcouchbase Mac OS X
I am a bit new to building applications and libraries from source, and I failed to find many resources on the site (besides the terminal commands) regarding building libcouchbase on Mac OS X.
The terminal commands in the wiki/documentation do not seem to work properly using the git repository source.
I'm attempting to follow these instructions:
http://www.couchbase.com/docs/couchbase-sdk-c-1.0/linux_and_mac.html
But configure.ac does not seem to execute, and I might be missing some resources necessary to build it. Can someone please advise?
config/autorun.sh
./configure
make install
SWIVEL-MAC:libcouchbase swivelgames$ config/autorun.sh config/autorun.sh: running `/opt/local/bin/glibtoolize --automake --copy --force' config/autorun.sh: running `/opt/local/bin/aclocal-1.11 -I m4' config/autorun.sh: running `/opt/local/bin/autoheader --warnings=error' config/autorun.sh: running `/opt/local/bin/automake-1.11 --add-missing --copy --force --foreign --warning=portability' configure.ac:25: installing `config/compile' configure.ac:28: installing `config/config.guess' configure.ac:28: installing `config/config.sub' configure.ac:22: installing `config/install-sh' configure.ac:22: installing `config/missing' Makefile.am: installing `config/depcomp' config/autorun.sh: running `/opt/local/bin/autoconf' --- Configured with the following tools: * libtoolize (GNU libtool) 2.4.2 * aclocal (GNU automake) 1.11.3 * autoheader (GNU Autoconf) 2.68 * automake (GNU automake) 1.11.3 * autoconf (GNU Autoconf) 2.68 --- SWIVEL-MAC:libcouchbase swivelgames$ ./configure bash: ./configure: Permission denied SWIVEL-MAC:libcouchbase swivelgames$ sudo ./configure Password: sudo: ./configure: command not found
SWIVEL-MAC:libcouchbase swivelgames$ ls -la total 1592 drwxr-xr-x 24 swivelgames staff 816 Mar 3 13:47 . drwxr-xr-x 3 swivelgames staff 102 Feb 25 15:42 .. drwxr-xr-x 15 swivelgames staff 510 Feb 27 14:04 .git -rw-r--r-- 1 swivelgames staff 927 Feb 25 15:42 .gitignore -rw-r--r-- 1 swivelgames staff 157 Feb 25 15:42 AUTHORS -rw-r--r-- 1 swivelgames staff 11358 Feb 25 15:42 LICENSE -rw-r--r-- 1 swivelgames staff 8693 Feb 25 15:42 Makefile.am -rw-r--r-- 1 swivelgames staff 111806 Mar 3 13:47 Makefile.in -rw-r--r-- 1 swivelgames staff 7442 Feb 25 15:42 NMakefile -rw-r--r-- 1 swivelgames staff 1760 Feb 25 15:42 README -rw-r--r-- 1 swivelgames staff 36787 Mar 3 13:47 aclocal.m4 drwxr-xr-x 7 swivelgames staff 238 Mar 3 13:47 autom4te.cache drwxr-xr-x 11 swivelgames staff 374 Mar 3 13:47 config -rw-r--r-- 1 swivelgames staff 599641 Mar 3 13:47 configure -rw-r--r-- 1 swivelgames staff 12886 Feb 25 15:42 configure.ac drwxr-xr-x 3 swivelgames staff 102 Feb 25 15:42 doc drwxr-xr-x 5 swivelgames staff 170 Feb 25 15:42 example drwxr-xr-x 3 swivelgames staff 102 Feb 25 15:42 include drwxr-xr-x 9 swivelgames staff 306 Mar 3 13:47 m4 drwxr-xr-x 5 swivelgames staff 170 Feb 25 15:42 packaging drwxr-xr-x 40 swivelgames staff 1360 Mar 3 13:47 src drwxr-xr-x 18 swivelgames staff 612 Feb 25 15:42 tests drwxr-xr-x 11 swivelgames staff 374 Feb 25 15:42 tools drwxr-xr-x 11 swivelgames staff 374 Feb 25 15:42 win32
I'm not sure why, but autotools didn't make your configure file executable.
chmod 777 configure
./configure
Thanks! I was able to run it, but now I'm having some other issues... :/
Configure is ending with
"configure: error: Failed to locate memcached/protocol_binary.h"
SWIVEL-MAC:libcouchbase-1.0.1 swivelgames$ ./configure CPPFLAGS="-I/opt/couchbase/include" --disable-couchbasemock 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 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 minix/config.h usability... no checking minix/config.h presence... no checking for minix/config.h... no checking whether it is safe to define __EXTENSIONS__... yes checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for a thread-safe mkdir -p... config/install-sh -c -d checking for gawk... gawk checking whether make sets $(MAKE)... yes checking for style of include used by make... GNU checking dependency style of gcc... gcc3 checking for g++... g++ checking whether we are using the GNU C++ compiler... yes checking whether g++ accepts -g... yes checking dependency style of g++... gcc3 checking for gcc... (cached) gcc checking whether we are using the GNU C compiler... (cached) yes checking whether gcc accepts -g... (cached) yes checking for gcc option to accept ISO C89... (cached) none needed checking whether gcc and cc understand -c and -o together... yes checking whether ln -s works... yes configure: WARNING: Libtool does not cope well with whitespace in `pwd` checking build system type... i386-apple-darwin10.8.0 checking host system type... i386-apple-darwin10.8.0 checking for a sed that does not truncate output... /usr/bin/sed checking for fgrep... /usr/bin/grep -F checking for ld used by gcc... /usr/libexec/gcc/i686-apple-darwin10/4.2.1/ld checking if the linker (/usr/libexec/gcc/i686-apple-darwin10/4.2.1/ld) is GNU ld... no checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm checking the name lister (/usr/bin/nm) interface... BSD nm checking the maximum length of command line arguments... 196608 checking whether the shell understands some XSI constructs... yes checking whether the shell understands "+="... yes checking for /usr/libexec/gcc/i686-apple-darwin10/4.2.1/ld option to reload object files... -r checking for objdump... no checking how to recognize dependent libraries... pass_all checking for ar... ar checking for strip... strip checking for ranlib... ranlib checking command to parse /usr/bin/nm output from gcc object... ok checking for dsymutil... dsymutil checking for nmedit... nmedit checking for lipo... lipo checking for otool... otool checking for otool64... no checking for -single_module linker flag... yes checking for -exported_symbols_list linker flag... yes checking for dlfcn.h... yes checking whether we are using the GNU C++ compiler... (cached) yes checking whether g++ accepts -g... (cached) yes checking dependency style of g++... (cached) gcc3 checking how to run the C++ preprocessor... g++ -E checking for objdir... .libs checking if gcc supports -fno-rtti -fno-exceptions... no checking for gcc option to produce PIC... -fno-common -DPIC checking if gcc PIC flag -fno-common -DPIC works... yes checking if gcc static flag -static works... no checking if gcc supports -c -o file.o... yes checking if gcc supports -c -o file.o... (cached) yes checking whether the gcc linker (/usr/libexec/gcc/i686-apple-darwin10/4.2.1/ld) supports shared libraries... yes checking dynamic linker characteristics... darwin10.8.0 dyld checking how to hardcode library paths into programs... immediate checking whether stripping libraries is possible... yes checking if libtool supports shared libraries... yes checking whether to build shared libraries... yes checking whether to build static libraries... no checking for ld used by g++... /usr/libexec/gcc/i686-apple-darwin10/4.2.1/ld checking if the linker (/usr/libexec/gcc/i686-apple-darwin10/4.2.1/ld) is GNU ld... no checking whether the g++ linker (/usr/libexec/gcc/i686-apple-darwin10/4.2.1/ld) supports shared libraries... yes checking for g++ option to produce PIC... -fno-common -DPIC checking if g++ PIC flag -fno-common -DPIC works... yes checking if g++ static flag -static works... no checking if g++ supports -c -o file.o... yes checking if g++ supports -c -o file.o... (cached) yes checking whether the g++ linker (/usr/libexec/gcc/i686-apple-darwin10/4.2.1/ld) supports shared libraries... yes checking dynamic linker characteristics... darwin10.8.0 dyld checking how to hardcode library paths into programs... immediate checking whether the C++ compiler works... yes checking whether __SUNPRO_C is declared... no checking whether __GNUC__ is declared... yes checking for library containing socket... none required checking for library containing gethostbyname... none required checking for library containing dlopen... none required checking for java... /usr/bin/java checking for wget... no checking for curl... /opt/local/bin/curl checking for mach/mach_time.h... yes checking for memcached/protocol_binary.h... no checking for memcached/vbucket.h... no checking for sys/socket.h... yes checking for sys/time.h... yes checking for netinet/in.h... yes checking for inttypes.h... (cached) yes checking for netdb.h... yes checking for unistd.h... (cached) yes checking for ws2tcpip.h... no checking for winsock2.h... no checking for libvbucket/vbucket.h... no checking for event.h... yes configure: error: Failed to locate memcached/protocol_binary.h
I added the memcached source as well, so memcached/protocol_binary.h does actually exist...
Do you have memcached installed? If not install it and try to build again. If libcouchbase still gives this error then you might need to tell the configure script where memcached is. Try typing './configure -h'. You should see a flag that looks something like --with-memcached. Add that flag to the configure script by doing something like this.
./configure --with-memcached=
Alright! A hair further. Now I'm getting an error saying "configure: error: Failed to locate memcached/vbucket.h" :/
I apologize for all of the back and forth. I haven't actually compiled libcouchbase myself so I'm just providing feedback as new issues arise. Anyways it looks like the issue here is that you don't have libvbucket installed. You can get it here:
http://packages.couchbase.com/clients/c/libvbucket-1.8.0.2.tar.gz
or here:
https://github.com/membase/libvbucket
This one you should just be able to do:
config/autorun.sh
./configure
make install
I have also filed a bug with our docs guys to make the instructions for the c sdk clearer.
Well, I originally tried making and installing vbucket from the source that's on the downloads page (libvbucket-1.7.2_1_gf84dad7) and then again with the membase repo you gave me. Both had distinctly different outputs when making, but neither did the trick.
I'm still being asked about a "vbucket.h", which is still not noticed even after being copied from libvbucket's includes.
As for the docs, I appreciate it! I was going to as well after I got it to work, so I could hopefully provide full instructions that could replace the current set.
And I thank you for helping me out so far! I was surprised to see their support forum practically lifeless.
EDIT Ironically, after building those a "checking for libvbucket/vbucket.h..." changes to yes...
Great. It looks like you got things going. Also, we try to check the forums on a regular basis, but sometimes we get a little bit behind. You should typically expect a response in one or two days.
Well, no not yet. It's just libvbucket/vbucket.h exists. memcached/vbucket.h still doesn't exist, so it won't build for me. I can see how my edit could be misunderstood, though. I apologize I wasn't more specific :P
checking for memcached/vbucket.h... no checking for sys/socket.h... yes checking for sys/time.h... yes checking for netinet/in.h... yes checking for inttypes.h... (cached) yes checking for netdb.h... yes checking for unistd.h... (cached) yes checking for ws2tcpip.h... no checking for winsock2.h... no checking for libvbucket/vbucket.h... yes
I'm really having trouble finding what the issue is... :/
EDIT
Also might be good to note that /opt/couchbase/include does not exist.
Thanks for your help, mikew. I have appreciated it. I'm surprised the docs were so incredibly vague when it comes to requirements, dependencies, and just general build instructions. I have spent a great deal of my work and spare time trying to get this to work, but I think I'll be pursuing a different database; maybe even go back to MySQL.
Again, thanks for your help, mikew.
Ok. Just to let you know though. It looks like you need to install the Couchbase version of memcached. You can get it here:
https://github.com/membase/memcached
Just do
config/autorun.sh
./configure
make install
I compiled everything last night on a brand new machine so this should be the last step.
Thanks, mikew. With the project that I'm on it looks like the best solution is to use CouchDB, so I'm stuck.
After making memcached it fixed that issue, but now I'm getting an error with one of the source files.
/bin/sh ./libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I./src -pthread -pipe -D_THREAD_SAFE -I./include -DHAVE_VISIBILITY=1 -fvisibility=hidden -I./src -DLIBCOUCHBASE_INTERNAL=1 -pthread -pipe -D_THREAD_SAFE -std=gnu99 -O3 -g -O2 -MT src/libcouchbase_la-arithmetic.lo -MD -MP -MF src/.deps/libcouchbase_la-arithmetic.Tpo -c -o src/libcouchbase_la-arithmetic.lo `test -f 'src/arithmetic.c' || echo './'`src/arithmetic.c libtool: compile: gcc -DHAVE_CONFIG_H -I. -I./src -pthread -pipe -D_THREAD_SAFE -I./include -DHAVE_VISIBILITY=1 -fvisibility=hidden -I./src -DLIBCOUCHBASE_INTERNAL=1 -pthread -pipe -D_THREAD_SAFE -std=gnu99 -O3 -g -O2 -MT src/libcouchbase_la-arithmetic.lo -MD -MP -MF src/.deps/libcouchbase_la-arithmetic.Tpo -c src/arithmetic.c -fno-common -DPIC -o src/.libs/libcouchbase_la-arithmetic.o src/arithmetic.c: In function ‘libcouchbase_arithmetic_by_key’: src/arithmetic.c:71: error: ‘struct <anonymous>’ has no member named ‘vbucket’ make: *** [src/libcouchbase_la-arithmetic.lo] Error 1
...hello? :/