Skip to content

Instantly share code, notes, and snippets.

@rduplain
Last active Nov 29, 2016
Embed
What would you like to do?
Setting up libRETS with SWIG

Setting up libRETS with SWIG

2016-11-29

Goal: Get a working SWIG build of the latest libRETS.

This setup will use Ubuntu with vagrant, a tool for creating development environments with virtual machines on Mac, GNU/Linux, and Windows.

Initial setup:

# See included Vagrantfile.
vagrant up
vagrant ssh
sudo apt-get update && sudo apt-get dist-upgrade
exit
vagrant halt
vagrant up
vagrant ssh
sudo apt-get install autoconf build-essential
sudo apt-get install git

Prepare build:

# vagrant ssh
sudo apt-get install libboost-all-dev libcurl4-openssl-dev openjdk-7-jdk
# Additional dependencies not caught by libRETS configure:
sudo apt-get install libdb-dev libbz2-dev
git clone https://github.com/NationalAssociationOfRealtors/libRETS.git

... and SWIG. First download SWIG 3.0.10 on the host machine (because sourceforge is easier to download in the web browser than curl, given its mirrors) into the same directory that has the Vagrantfile, then:

# vagrant ssh
cd /vagrant/
md5sum swig-3.0.10.tar.gz # bb4ab8047159469add7d00910e203124
tar -xf swig-3.0.10.tar.gz
cd swig-3.0.10
sudo apt-get build-dep swig
./configure --prefix=/usr --without-clisp --without-maximum-compile-warnings
make
sudo make install

Build:

# vagrant ssh
cd ~/libRETS/
git checkout 1.6.2
./autogen.sh
./configure --prefix=/usr # Reports language support, e.g.: With Python 3: yes
make
sudo make install

As a simple test, python3 -m librets will have empty output if it finds the librets import and will report an error if it cannot.

# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "ubuntu/trusty64" # Requires vagrant 1.5+ for vagrantcloud.
config.vm.define 'rets-box' do |machine|
machine.vm.hostname = 'rets-box'
end
config.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--memory", "2048"]
end
config.ssh.forward_agent = true
config.vm.network :forwarded_port, guest: 22, host: 2222, id: 'ssh', auto_correct: true
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment