Building Thirift on Ubuntu behind firewall

I was trying to build thrift on ubuntu and hit some issues, specially because my machine was behind the firewall. I am going to put down the steps to build thrift.
You need some more packages on your box and boost.

  • Dowload Boost
  • Building boost instruction are given on there site, but you can use following command to build the boost locally
  • ./bootstrap.sh
    ./bootstrap.sh --prefix=/usr/local/boost_1_46_1
    ./bjam install
    
  • External packages required to build thrift can be done using following command
  • sudo apt-get install libboost-dev libboost-test-dev libboost-program-options-dev libevent-dev automake libtool flex bison pkg-config g++ libssl-dev
    
  • Go to thrift directory where you have un-archived the source code
  • Build thrift using following command providing boost directory and JAVAC location
  • ./configure --with-boost=/usr/local/boost_1_46_1 JAVAC=/home/avinash/export/where/jdk/1.6.0_26/x86.linux/bin/javac
    
  • Upon completing successfull configuration, run make command
  • make
    

    If you are behind firewall you might hit error regarding downloading jars from maven repository.
    Maven tries to auto download the dependencies if they are not available within your local repository,
    since maven did not know of your proxy it was unable to download them and failed. Adding the
    proxy config to your maven settings.xml should resolve your problem when you box is behind firewall

  • Open your build.xml from your java directory
  • /home/avinash/work/thrift-0.9.0/lib/java/build.xml
    
  • Look for target mvn.ant.tasks.download
  • Add following proxy settings to your file
    <setproxy proxyhost="your proxy server name" proxyport="port number"/>
    
  • So new target looks like below
  •  <target name="mvn.ant.tasks.download" depends="setup.init,mvn.ant.tasks.check,proxy" unless="mvn.ant.tasks.found">
        <setproxy proxyhost="proxy.com" proxyport="1234"/>
        <get src="${mvn.ant.task.url}/${mvn.ant.task.jar}" dest="${build.tools.dir}/${mvn.ant.task.jar}" usetimestamp="true"/>
      </target>
    

    This will solve your initial download issue but mvn.init target still give you issue while downloading maven depencies

  • If you already do not have settings.xml
  • Create it in your home folder under .m2 directory
  • Add following lines in the settings.xml file
  • <settings>
      <proxies>
       <proxy>
          <active>true</active>
          <protocol>http</protocol>
          <host>PROXY-SERVER-NAME</host>
          <port>PROXY-SERVER-PORT</port>
          <username>proxyuser</username>
          <password>somepassword</password>
          <nonProxyHosts>www.google.com|*.somewhere.com</nonProxyHosts>
        </proxy>
      </proxies>
    </settings>
    
  • and run make again.
    Advertisements

One thought on “Building Thirift on Ubuntu behind firewall

  1. Hi, you can add these lines (below) into build.properties without modifying build.xml

    proxy.enabled=true
    proxy.host=
    proxy.port=

Leave a Reply

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

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 )

Google+ photo

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

Connecting to %s