CentOS 7: How To Compile libRETs From Source

July 15, 2017 by Phu Ha <pha@atlassoftwaregroup.com>

What is libRETs?

libRETS is RETS client library written in C++ that allows rapid development of RETS client applications. By saving the developer from dealing with the RETS protocol details, the application writer can concentrate on their application, saving them time and money in the process.

Issue:

The current version of libRETs (1.6.2) requires swig 3.x and CentOS 7 currently ships with swig 2.x.

Solution:

We will need to compile swig 3.x from source.

Installation

Compile libRETs with Python 2.7 Support

Create a file call rets.sh in your home directory.

yum update -y &&                            \
yum install -y epel-release &&              \
yum install -y python2-pip &&               \
yum groupinstall -y "development tools" &&  \
yum install --assumeyes antlr-tool autoconf boost-devel expat-devel libcurl-devel gcc-c++ python-devel pcre-devel && \
curl -o /tmp/swig-3.0.12.tar.gz -L http://downloads.sourceforge.net/swig/swig-3.0.12.tar.gz && tar -zxvf /tmp/swig-3.0.12.tar.gz -C /tmp && \
cd /tmp/swig-3.0.12 && ./configure --prefix=/usr \
--without-clisp                                   \
--without-maximum-compile-warnings &&             \
make &&                                           \
make install &&                                   \
curl -o /tmp/librets-x64-1.6.2.zip -L https://github.com/NationalAssociationOfRealtors/libRETS/archive/1.6.2.zip && \
unzip /tmp/librets-x64-1.6.2.zip -d /tmp && \
cd /tmp/libRETS-1.6.2 && \
./autogen.sh && \
CPPFLAGS="-L/usr/local/lib -I/usr/local/include"  \
    ./configure                                       \
    --enable-shared_dependencies &&                   \
make install && \
rm -rf /tmp/libRETS-1.6.2 /tmp/librets-x64-1.6.2.zip /tmp/swig-3.0.12.tar.gz /tmp/swig-3.0.12

Make rets.sh executable

(shell): chmod +x ./rets.sh

Run rets.sh

(shell): sudo ./rets.sh

Test if Python has libRETs module

(shell): python
(python): import librets

If there isn’t any error importing the libRETs module, then libRETs has successfully compile with Python 2.7 support.

Note: libRETs has support for php, ruby, java, etc. Documentation can be found here.

Example Dockerfile

FROM centos:7
RUN yum update -y &&                            \
    yum install -y epel-release &&              \
    yum install -y python2-pip &&               \
    yum groupinstall -y "development tools" &&  \
    yum install --assumeyes antlr-tool autoconf boost-devel expat-devel libcurl-devel gcc-c++ python-devel pcre-devel

RUN curl -o /tmp/swig-3.0.12.tar.gz -L http://downloads.sourceforge.net/swig/swig-3.0.12.tar.gz && tar -zxvf /tmp/swig-3.0.12.tar.gz -C /tmp
RUN cd /tmp/swig-3.0.12 && ./configure --prefix=/usr \
    --without-clisp                                   \
    --without-maximum-compile-warnings &&             \
    make &&                                           \
    make install

RUN curl -o /tmp/librets-x64-1.6.2.zip -L https://github.com/NationalAssociationOfRealtors/libRETS/archive/1.6.2.zip
RUN unzip /tmp/librets-x64-1.6.2.zip -d /tmp

WORKDIR /tmp/libRETS-1.6.2

RUN ./autogen.sh
RUN CPPFLAGS="-L/usr/local/lib -I/usr/local/include"  \
    ./configure                                       \
    --enable-shared_dependencies &&                   \
    make install

RUN rm -rf /tmp/libRETS-1.6.2 /tmp/librets-x64-1.6.2.zip /tmp/swig-3.0.12.tar.gz /tmp/swig-3.0.12 && yum clean all

© 2017 | Atlas Software Group | Hucore theme & Hugo