blob: 4edba1fedf61f1d01b424e4e87204c353931dca8 [file] [log] [blame]
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<meta content="en-us" http-equiv="Content-Language" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="/static/images/favicon.ico" rel="shortcut icon" />
<link href="/static/css/style.css" rel="stylesheet" type="text/css" />
<link href="/static/css/codehilite.css" rel="stylesheet" type="text/css" />
<link href="/static/css/bootstrap.css" media="screen, projection" rel="stylesheet" type="text/css" />
<link href="/static/css/thrift.css" media="screen, projection" rel="stylesheet" type="text/css" />
<script src="/static/js/jquery.min.js"></script>
<script src="/static/js/bootstrap-dropdown.js"></script>
<script src="/static/js/bootstrap-tab.js"></script>
<script src="/static/js/thrift.js"></script>
<title>Apache Thrift - Building From Source</title>
</head>
<body>
<div class="navbar">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="/">Apache Thrift &trade;</a>
<div class="nav-collapse">
<ul class="nav pull-right">
<li><a href="/download">Download</a></li>
<li><a href="/docs">Documentation</a></li>
<li><a href="/developers">Developers</a></li>
<li><a href="/lib">Libraries</a></li>
<li><a href="/tutorial">Tutorial</a></li>
<li><a href="/test">Test Suite</a></li>
<li><a href="/about">About</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Apache <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="http://www.apache.org/" target="_blank">Apache Home</a></li>
<li><a href="http://www.apache.org/licenses/" target="_blank">Apache License v2.0</a></li>
<li><a href="http://www.apache.org/foundation/sponsorship.html" target="_blank">Donate</a></li>
<li><a href="http://www.apache.org/foundation/thanks.html" target="_blank">Thanks</a></li>
<li><a href="http://www.apache.org/security/" target="_blank">Security</a></li>
</ul>
</li>
</ul>
</div>
</div>
</div>
</div>
<div class="container">
<h2 id="building-from-source">Building from source</h2>
<p>First make sure your system meets all necessary <a href="/docs/install">Apache Thrift Requirements</a></p>
<p>If you are building from the first time out of the source repository, you will need to generate the configure scripts. (This is not necessary if you downloaded a released tarball.) From the top directory, do:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>./bootstrap.sh
</code></pre></div></div>
<p>Once the configure scripts are generated, thrift can be configured.
From the top directory, do:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>./configure
</code></pre></div></div>
<p>Disable a language:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>./configure --without-java
</code></pre></div></div>
<p>You may need to specify the location of the boost files explicitly. If you installed boost in /usr/local, you would run configure as follows:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>./configure --with-boost=/usr/local
</code></pre></div></div>
<p>If you want to override the logic of the detection of the Java SDK, use the JAVAC environment variable:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>./configure JAVAC=/usb/bin/javac
</code></pre></div></div>
<p>Note that by default the thrift C++ library is typically built with debugging symbols included. If you want to customize these options you should use the CXXFLAGS option in configure, as such:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>./configure CXXFLAGS='-g -O2'
./configure CFLAGS='-g -O2'
./configure CPPFLAGS='-DDEBUG_MY_FEATURE'
</code></pre></div></div>
<p>To see other configuration options run</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>./configure --help
</code></pre></div></div>
<p>Once you have run configure you can build Thrift via make:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>make
</code></pre></div></div>
<p>and run the test suite:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>make check
</code></pre></div></div>
<p>and the cross language test suite:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>python3 test/test.py
</code></pre></div></div>
<h3 id="issues-while-compiling">Issues while compiling</h3>
<ul>
<li>“compiler/cpp/thriftl.cc:2190: undefined reference to `yywrap’”</li>
</ul>
<p>you need to install the <a href="https://github.com/westes/flex">Flex library</a> (See also <a href="/docs/install">Apache Thrift Requirements</a> ) and re-run the configuration script.</p>
<ul>
<li>mv: cannot stat “‘.deps/TBinaryProtocol.Tpo’: No such file or directory” while building the Thrift Runtime Library</li>
</ul>
<p>Re-reun configure with</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>--enable-libtool-lock
</code></pre></div></div>
<p>or by turning off parallel make by placing <strong>.NOTPARALLEL:</strong> in lib/cpp/Makefile or</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>make -j 1
</code></pre></div></div>
<p>Although the thrift compiler build appears to be compatible with parallel make without libtool lock, the thrift runtime build is not.</p>
<h2 id="installing">Installing</h2>
<p>From the top directory, become superuser and do:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>make install
</code></pre></div></div>
<p>Note that some language packages must be installed manually using build tools
better suited to those languages (this applies to Java, Ruby, PHP).</p>
<p>Look for the README file in the <code class="language-plaintext highlighter-rouge">lib/&lt;language&gt;/</code> folder for more details on the installation of each language library package.</p>
</div>
<div class="container">
<hr>
<footer class="footer">
<div class="row">
<div class="span3">
<h3>Links</h3>
<ul class="unstyled">
<li><a href="/download">Download</a></li>
<li><a href="/developers">Developers</a></li>
<li><a href="/tutorial">Tutorials</a></li>
</ul>
<ul class="unstyled">
<li><a href="/sitemap">Sitemap</a></li>
</ul>
</div>
<div class="span3">
<h3>Get Involved</h3>
<ul class="unstyled">
<li><a href="/mailing">Mailing Lists</a></li>
<li><a href="http://issues.apache.org/jira/browse/THRIFT">Issue Tracking</a></li>
<li><a href="/docs/HowToContribute">How To Contribute</a></li>
</ul>
</div>
<div class="span6">
<a href="http://www.apache.org/"><img src="/static/images/feather.svg" onerror="this.src='/static/images/feather.png';this.onerror=null;" /></a>
Copyright &copy; 2024 <a href="http://www.apache.org/">Apache Software Foundation</a>.
Licensed under the <a href="http://www.apache.org/licenses/">Apache License v2.0</a>.
Apache, Apache Thrift, and the Apache feather logo are trademarks of The Apache Software Foundation.
</div>
</div>
</footer>
</div>
</body>
</html>