-
Notifications
You must be signed in to change notification settings - Fork 59
Building on Debian Linux
Information provided by David Riggs:
Building librets on Debian (Ubuntu Breezy):
sudo apt-get install libexpat1-dev libcurl3-dev libboost-dev libboost-filesystem-dev cantlr libantlr-dev autoconf
sudo ln -s `which cantlr` /usr/bin/antlr
./autogen.sh && ./configure && make
sudo make install
From Eli Ribble:
If you would like SWIG support (such as Python bindings), you'll also want to add the swig package before configuring. This would mean you would do the following
sudo apt-get install libexpat1-dev libcurl3-dev libboost-dev \
libboost-filesystem-dev cantlr libantlr-dev swig python2.5-dev
sudo ln -s `which cantlr` /usr/bin/antlr
./autogen.sh
./configure
make
sudo make install
Now, when I did this, it enabled java and PERL for me. I had to disable them as neither one was set up correctly, and I only really wanted python. You can do so with the following change
./configure --disable-java --disable-perl
Even then, it refused to build properly because of some peculiarities of the 64-bit platform I work on. For the sake of record-keeping, my error looked like this:
/usr/bin/ld: /home/eli/Consulting/RETS/librets-1.2.1/build/librets/lib/librets.a(CapabilityUrls.o):
relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
/home/eli/Consulting/RETS/librets-1.2.1/build/librets/lib/librets.a:
could not read symbols: Bad value
collect2: ld returned 1 exit status
error: command 'g++' failed with exit status 1
make[1]: *** [build/swig/python/_librets.so] Error 1
make[1]: Leaving directory `/home/eli/Consulting/RETS/librets-1.2.1'
make: *** [all] Error 2
The solution, from Keith Garner, turned out to enable fPIC (which is disabled by default on 64-bit) and enable shared dependencies. That can be done with
./configure --disable-java --disable-perl --enable-fPIC --enable-shared_dependencies
And with that, it built just fine for me on 64-bit Ubuntu Hardy Heron. However, this will install the files in /usr/local/bin, which is non-standard for Ubuntu. You may want to add '--prefix=/usr/bin' to get a more Ubuntu-standard way of doing things.
./configure --disable-java --disable-perl --enable-fPIC --enable-shared_dependencies --prefix=/usr/bin
If you're like me and you've had a lot of problems getting things to work in RETS, you may want to include the example code when you compile, as well as the debugging code. You can do that via '--enable-examples' and '--enable-debug'. My configure now looks like this:
./configure --disable-java --disable-perl --enable-fPIC --enable-shared_dependencies --prefix=/usr/bin --enable-examples
I didn't include the --enable-debug because I want to use librets without adding a bunch of debugging overhead. That may change in the future, should my problems continue, but if it does I can always go back and re-build with --enable-debug.
Unfortunately, for me, this didn't work. My compilation error looks like this:
make[1]: Entering directory `/home/eli/Consulting/RETS/librets-1.2.1'
g++ -g -O2 -fPIC -DHAVE_CONFIG_H -DTARGET_UNIX -DLIBRETS_VERSION='"1.2.1"' -I/usr/include -I./project/librets/include -c project/examples/src/login.cpp -o build/examples/objects/login.o
In file included from project/examples/src/login.cpp:19:
project/examples/src/Options.h:21:37: error: boost/program_options.hpp: No such file or directory
In file included from project/examples/src/login.cpp:19:
project/examples/src/Options.h:29: error: ‘boost::program_options’ has not been declared
project/examples/src/Options.h:29: error: ISO C++ forbids declaration of ‘options_description’ with no type
project/examples/src/Options.h:29: error: expected ‘;’ before ‘descriptions’
project/examples/src/Options.h:30: error: ‘boost::program_options’ has not been declared
project/examples/src/Options.h:30: error: ISO C++ forbids declaration of ‘variables_map’ with no type
project/examples/src/Options.h:30: error: expected ‘;’ before ‘options’
make[1]: *** [build/examples/objects/login.o] Error 1
make[1]: Leaving directory `/home/eli/Consulting/RETS/librets-1.2.1'
make: *** [all] Error 2
Not to be one to give up, I look to see if the file exists. Well, looking in my standard header directory (/usr/include) I see a boost directory. But, it has nothing like 'program_options'. Well, a quick search reveals that there IS a program_options for Boost for Ubuntu, you just have to install the proper package
sudo apt-get install libboost-program-options-dev
This installs the proper program_options files. Now let's try compiling those examples. The compilation will work whether your have built/install librets first or not. Me, I built librets without the examples and installed it, then re-ran configure exactly the way I had run/installed it before, but added --enable-examples to the options. Now, running 'make' just builds the examples. And it worked just great
As a final note, when you install you'll want to use checkinstall to install the files so that you can easily remove them, should you choose to later.
sudo checkinstall make install
This will create a package called 'librets' that you can uninstall later.