mnunberg / perl-Couchbase-Client

Perl Client for Couchbase
http://www.couchbase.com
16 stars 11 forks source link

Compatibility with libcouchbase 3.x #51

Open andypost opened 3 years ago

andypost commented 3 years ago

Trying to build with libcouchbase 3.0.7 I'm getting compilation report because api3.h is missing in 3.x

Is there a way to fix it?

>>> perl-couchbase: Unpacking /var/cache/distfiles/Couchbase-2.0.3.tar.gz...
WARNING: Older versions of ExtUtils::MakeMaker may errantly install README.pod as part of this distribution. It is recommended to avoid using this path in CPAN modules.
Checking if your kit is complete...
Looks good
Generating a Unix-style Makefile
Writing Makefile for Couchbase
Writing MYMETA.yml and MYMETA.json
Running Mkbootstrap for Couchbase ()
"/usr/bin/perl" "/usr/share/perl5/core_perl/ExtUtils/xsubpp"  -typemap '/usr/share/perl5/core_perl/ExtUtils/typemap'  xs/Couchbase.xs > xs/Couchbase.xsc
"/usr/bin/perl" "/usr/share/perl5/core_perl/ExtUtils/xsubpp"  -typemap '/usr/share/perl5/core_perl/ExtUtils/typemap'  xs/BucketConfig.xs > xs/BucketConfig.xsc
"/usr/bin/perl" "/usr/share/perl5/core_perl/ExtUtils/xsubpp"  -typemap '/usr/share/perl5/core_perl/ExtUtils/typemap'  xs/IO.xs > xs/IO.xsc
"/usr/bin/perl" "/usr/share/perl5/core_perl/ExtUtils/xsubpp"  -typemap '/usr/share/perl5/core_perl/ExtUtils/typemap'  xs/N1QLParams.xs > xs/N1QLParams.xsc
cc -c   -D_REENTRANT -D_GNU_SOURCE -D_GNU_SOURCE -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Os -fomit-frame-pointer   -DVERSION=\"2.0.3\" -DXS_VERSION=\"2.0.3\" -o xs/args.o -fPIC "-I/usr/lib/perl5/core_perl/CORE"   xs/args.c
cc -c   -D_REENTRANT -D_GNU_SOURCE -D_GNU_SOURCE -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Os -fomit-frame-pointer   -DVERSION=\"2.0.3\" -DXS_VERSION=\"2.0.3\" -o xs/async.o -fPIC "-I/usr/lib/perl5/core_perl/CORE"   xs/async.c
cc -c   -D_REENTRANT -D_GNU_SOURCE -D_GNU_SOURCE -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Os -fomit-frame-pointer   -DVERSION=\"2.0.3\" -DXS_VERSION=\"2.0.3\" -o xs/callbacks.o -fPIC "-I/usr/lib/perl5/core_perl/CORE"   xs/callbacks.c
cc -c   -D_REENTRANT -D_GNU_SOURCE -D_GNU_SOURCE -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Os -fomit-frame-pointer   -DVERSION=\"2.0.3\" -DXS_VERSION=\"2.0.3\" -o xs/constants.o -fPIC "-I/usr/lib/perl5/core_perl/CORE"   xs/constants.c
cc -c   -D_REENTRANT -D_GNU_SOURCE -D_GNU_SOURCE -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Os -fomit-frame-pointer   -DVERSION=\"2.0.3\" -DXS_VERSION=\"2.0.3\" -o xs/convert.o -fPIC "-I/usr/lib/perl5/core_perl/CORE"   xs/convert.c
cc -c   -D_REENTRANT -D_GNU_SOURCE -D_GNU_SOURCE -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Os -fomit-frame-pointer   -DVERSION=\"2.0.3\" -DXS_VERSION=\"2.0.3\" -o xs/operations.o -fPIC "-I/usr/lib/perl5/core_perl/CORE"   xs/operations.c
cc -c   -D_REENTRANT -D_GNU_SOURCE -D_GNU_SOURCE -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Os -fomit-frame-pointer   -DVERSION=\"2.0.3\" -DXS_VERSION=\"2.0.3\" -o xs/opcontext.o -fPIC "-I/usr/lib/perl5/core_perl/CORE"   xs/opcontext.c
cc -c   -D_REENTRANT -D_GNU_SOURCE -D_GNU_SOURCE -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Os -fomit-frame-pointer   -DVERSION=\"2.0.3\" -DXS_VERSION=\"2.0.3\" -o xs/query.o -fPIC "-I/usr/lib/perl5/core_perl/CORE"   xs/query.c
chmod 644 "Couchbase.bs"
"/usr/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- Couchbase.bs blib/arch/auto/Couchbase/Couchbase.bs 644
In file included from xs/constants.c:1:
xs/perl-couchbase.h:7:10: fatal error: libcouchbase/api3.h: No such file or directory
    7 | #include <libcouchbase/api3.h>
      |          ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
In file included from xs/operations.c:1:
xs/perl-couchbase.h:7:10: fatal error: libcouchbase/api3.h: No such file or directory
    7 | #include <libcouchbase/api3.h>
      |          ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:377: xs/constants.o] Error 1
make: *** Waiting for unfinished jobs....
make: *** [Makefile:377: xs/operations.o] Error 1
In file included from xs/opcontext.c:1:
xs/perl-couchbase.h:7:10: fatal error: libcouchbase/api3.h: No such file or directory
    7 | #include <libcouchbase/api3.h>
      |          ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:377: xs/opcontext.o] Error 1
In file included from xs/args.c:6:
xs/perl-couchbase.h:7:10: fatal error: libcouchbase/api3.h: No such file or directory
    7 | #include <libcouchbase/api3.h>
      |          ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
In file included from xs/convert.c:1:
xs/perl-couchbase.h:7:10: fatal error: libcouchbase/api3.h: No such file or directory
    7 | #include <libcouchbase/api3.h>
      |          ^~~~~~~~~~~~~~~~~~~~~
In file included from xs/async.c:4:
xs/perl-couchbase.h:7:10: fatal error: libcouchbase/api3.h: No such file or directory
    7 | #include <libcouchbase/api3.h>
      |          ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
compilation terminated.
In file included from xs/query.c:1:
xs/perl-couchbase.h:7:10: fatal error: libcouchbase/api3.h: No such file or directory
    7 | #include <libcouchbase/api3.h>
      |          ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:377: xs/args.o] Error 1
make: *** [Makefile:377: xs/async.o] Error 1
make: *** [Makefile:377: xs/convert.o] Error 1
make: *** [Makefile:377: xs/query.o] Error 1
cp lib/Couchbase/Test/ClientSync.pm blib/lib/Couchbase/Test/ClientSync.pm
cp lib/Couchbase/_GlueConstants.pm blib/lib/Couchbase/_GlueConstants.pm
cp lib/Couchbase/Constants.pm blib/lib/Couchbase/Constants.pm
cp lib/Couchbase/N1QL/Params.pm blib/lib/Couchbase/N1QL/Params.pm
cp lib/Couchbase/Test/Common.pm blib/lib/Couchbase/Test/Common.pm
cp lib/Couchbase/Settings.pm blib/lib/Couchbase/Settings.pm
cp lib/Couchbase/MockServer.pm blib/lib/Couchbase/MockServer.pm
cp lib/Couchbase/Document.pm blib/lib/Couchbase/Document.pm
cp lib/Couchbase/N1QL/Handle.pm blib/lib/Couchbase/N1QL/Handle.pm
cp lib/Couchbase/View/Handle.pm blib/lib/Couchbase/View/Handle.pm
cp lib/Couchbase.pm blib/lib/Couchbase.pm
cp lib/Couchbase/BucketConfig.pm blib/lib/Couchbase/BucketConfig.pm
cp lib/Couchbase/OpContext.pm blib/lib/Couchbase/OpContext.pm
cp lib/Couchbase/Test/Views.pm blib/lib/Couchbase/Test/Views.pm
cp lib/Couchbase/HTTPDocument.pm blib/lib/Couchbase/HTTPDocument.pm
cp lib/Couchbase/Bucket.pm blib/lib/Couchbase/Bucket.pm
cp lib/Couchbase/Test/Settings.pm blib/lib/Couchbase/Test/Settings.pm
cp lib/Couchbase/Core.pm blib/lib/Couchbase/Core.pm
mv xs/IO.xsc xs/IO.c
mv xs/N1QLParams.xsc xs/N1QLParams.c
mv xs/BucketConfig.xsc xs/BucketConfig.c
mv xs/Couchbase.xsc xs/Couchbase.c
In file included from xs/callbacks.c:4:
xs/perl-couchbase.h:7:10: fatal error: libcouchbase/api3.h: No such file or directory
    7 | #include <libcouchbase/api3.h>
      |          ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:377: xs/callbacks.o] Error 1
andypost commented 3 years ago

I'm not much familiar with perl so not clear how to move forward with packaging for Alpinelinux

ivulfson commented 11 months ago

@mnunberg is there any hope of reviving this project and getting it working with libcouchbase3?

annibale-x commented 11 months ago

@mnunberg is there any hope of reviving this project and getting it working with libcouchbase3?

I wrote a new Couchbase perl XS module (actually developed in C++ converted to XS) for libcouchbase3 with support for K/V operations, batch operations, collections, N1QL queries, transactions and async operations. I also developed an ORM to compose N1QL statements in an object-oriented manner. We have been using these modules in production for about 6 months now, they are not perfect and there is still a lot of work to be done especially on error handling, but they are stable. All this material was developed for our company's internal needs, but with a little effort I can publish our Couchbase perl framework on CPAN. I am currently a bit busy with a release of one of our products, but I believe that in two or three weeks I will be able to publish a general purpose version on CPAN. Of course, I would also be happy to have active cooperation from other Perl/XS developers in the maintenance and development of the Couchbase 3 framework that I will publish.

ivulfson commented 11 months ago

@annibale-x In the eternal words of Homer Simpson, "Your ideas are intriguing to me and I wish to subscribe to your newsletter."

Meanwhile, I am using libcouchbase2 (with compat-openssl10 - openssl compatibility library, ancient), and build perl-Couchbase on Alma 9. Quick how-to:

You need cpan2rpm:

git clone https://github.com/ekkis/cpan2rpm
cd cpan2rpm
git log > Changes
./cpan2rpm --mk-rpm-dirs=~/rpm
perl Makefile.PL
make
make dist
./cpan2rpm --no-sign --no-prfx --source cpan2rpm-2.032.tar.gz .

yum install -y ~/rpm/RPMS/noarch/cpan2rpm-2.032-1.noarch.rpm
wget https://rpmfind.net/linux/centos/8-stream/AppStream/x86_64/os/Packages/compat-openssl10-1.0.2o-4.el8.x86_64.rpm
yum install -u ./compat-openssl10-1.0.2o-4.el8.x86_64.rpm
wget -O /etc/yum.repos.d/couchbase.repo http://packages.couchbase.com/rpm/couchbase-centos62-x86_64.repo
yum install -y libcouchbase-devel libcouchbase2-core
yum install -y perl-JSON-MaybeXS
cpan2rpm --mk-rpm-dirs=~/rpm

Dependency:

wget https://cpan.metacpan.org/authors/id/M/MN/MNUNBERG/Constant-Generate-0.17.tar.gz
cpan2rpm --no-sign --make-no-test --provides 'perl(Constant::Generate)' \
  --source Constant-Generate-0.17.tar.gz Constant-Generate-0.17.tar.gz
yum install -y ~/rpm/RPMS/noarch/perl-Constant-Generate-0.17-1.noarch.rpm

Build it:

wget https://cpan.metacpan.org/authors/id/M/MN/MNUNBERG/Couchbase-2.0.3.tar.gz
tar zxvf Couchbase-2.0.3.tar.gz
cd Couchbase-2.0.3
cpan2rpm --no-sign --make-no-test --no-requires 'perl(Log::Fu)' --no-requires 'perl(Dir::Self)' \
  --no-requires 'perl(Test::Class)' --requires 'perl(JSON::MaybeXS)' \
  --release 1.el9 \
  --source ~/Couchbase-2.0.3.tar.gz .
yum install -y ~/rpm/RPMS/x86_64/perl-Couchbase-2.0.3-1.el9.x86_64.rpm