h1

Building librets on Mac OSX

September 1, 2007

SpaghettiI’ve used librets with Ruby on WinXP for a while now, but now I need it on my new Mac to try out some new ideas with RETS. Clearly, I’m a Mac “noob”, but boy – was this freakin’ hard! I’ve documented it here for future reference. Hopefully it will help someone else out.

Download librets

  • Download librets-1.1.9.tar.gz from CRT.
  • According to /doc/build/mac-osx.txt and unix.txt, it looks like there’s a lot of dependencies to install and build, which I’m not too comfortable doing manually.
  • There’s a note that that the OpenDarwin package manager can install these for you, and I remembered reading about MacPorts earlier, so that seems worth installing.

Install MacPorts

  • Download and install MacPorts from http://www.macports.org/
  • Make sure path is correct according to installation instructions.
  • Update MacPorts using “sudo port selfupdate”.

Install dependencies

  • Install Boost using “sudo port install boost”. Takes a while – about 15 minutes for me.
  • Install Expat using “sudo port install expat”
  • Install ANTLR using “sudo port install antlr”
  • Install libcurl using “sudo port install curl”
  • Install swig using “sudo port install swig”. This was not documented as a dependency, so it took a while to figure this one out after the below steps kept failing.

Build librets

  • “./configure” kept returning errors finding Expat and Boost files.
  • Used “./configure –with-expat-prefix=/opt/local –with-boost-prefix=/opt/local –enable-shared_dependencies” instead.
  • “make”
  • “sudo make install”

Build librets ruby

  • In the project/swig folder, use “make ruby”

Test

  • In the project/swig/ruby folder, run “ruby login.rb” and “ruby search.rb”

You’ll know now if you’ve got everything dialed in. Note that when you are writing your own Ruby code in a different folder, make sure you include the path to librets.rb at the top like this:

# Prepend load path with path to librets.rb
$:.unshift(‘/usr/local/src/librets-1.1.9/project/swig/ruby’)
require ‘librets’
include Librets

Geez! That took a while. I guess if I’d had a lot of *nix experience, it would have been easier, but librets has a special Windows install that easier.

Special thanks to the CRT guys for making librets freely available.

Advertisement

6 comments

  1. Its not so much a “mac n00b” as a “unix n00b” as most of libRETS build is fairly non-Mac specific and more “typical open source unix.”

    Of course, there’s always the mailing list (and me) to ask for help. :)
    Although, the swig stuff needs to be integrated into the overall build. That’s never really been done, but there hasn’t been much demand either. I’ll toss that on the todo. I just wish I didn’t detest GNU autoconf so much, but sadly there isn’t much better out there.


  2. Hey – your instructions were *almost* enough for me to get this working on Mac OS X (10.5)… Everything works fine, up until the “make ruby”, at which point I get:

    %> make ruby
    swig -c++ -ruby -o ruby/librets_wrap.cpp -module librets_native -Ilib/ruby librets.i
    lib/ruby/std_string.i:71: Error: Syntax error in input(1).
    make: *** [ruby/librets_wrap.cpp] Error 1

    Any ideas? I am completely baffled by this, and I really don’t know what to look at next. Thanks in advance


  3. Byron,

    You should really be asking this question on the librets-users mailing list instead of on Dan’s blog. Lucky for you, I look at both.

    In any case, swig revved and now supplies their own std_string.i so you’re running into a problem with ours having a conflict with theirs. (The next release of libRETS is going to address this.)

    There’s a few things you can do. You can pull the latest libRETS from svn, which addresses this (and integrates the swig build into autoconf.) Or you can just rm librets/project/swig/lib/ruby/std_string.i and run the “make ruby” again, which should work.


    Keith T. Garner – Managing Director – Center for REALTOR® Technology


  4. great tutorial, just thought I’d add this. Using the latest macports ./configure on librets will balk at the dynamically linked binaries for boost. To get around this you might want to add –enable-shared_dependencies.

    Note this is building librets-1.2.1 on 10.5.3


  5. Fyi, Ports recently updated swig to 2.0. I could not get librets-1.5.1. to compile with swig 2.0.

    Manually installing swig 1.3 from the swig website fixed the problem.

    swig -c++ -java -package librets -o build/swig/java/librets_wrap.cpp \
    -outdir build/swig/java ./project/swig/librets.i
    :3: Error: Unable to find ‘java.swg’
    ./project/swig/librets.i:19: Error: Unable to find ‘java/boost_shared_ptr.i’
    ./project/swig/librets.i:20: Error: Unable to find ‘java/typemaps.i’
    ./project/swig/librets.i:82: Error: Unable to find ‘std_string.i’
    ./project/swig/librets.i:84: Error: Unable to find ‘std_vector.i’
    make[1]: *** [build/swig/java/librets_wrap.cpp] Error 1
    make: *** [all] Error 2


    • Just a note, that “:3: Error: Unable to find ‘java.swg’” can be resolved by installing swig-java…

      sudo port install swig-java



Leave a Reply

Fill in your details below or click an icon to log in:

Gravatar
WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.