Thanks @mnunberg! That was the issue.
I found it easier to change LDFLAGS
to LDLIBS
in the Couchbase example Makefile
. LDLIBS
tells make to put the libraries after the object files. See pull request #2
From the GNU Make documentation:
LDLIBS
Library flags or names given to compilers when they are supposed to invoke the linker, ‘ld’. Non-library linker flags, such as -L, should go in the LDFLAGS variable.
LDFLAGS
Extra flags to give to compilers when they are supposed to invoke the linker, ‘ld’, such as -L. Libraries (-lfoo) should be added to the LDLIBS variable instead.