Boost C++ Libraries: Ticket #11301: Boost 1.58 compile error with atomic when plain C++ is used https://svn.boost.org/trac10/ticket/11301 <p> The short program below ends in </p> <blockquote> <p> fatal error: boost/atomic/detail/caps_gcc-atomic.hpp: No such file or directory </p> </blockquote> <p> as BOOST_ATOMIC_EMULATED ends up not being defined. Found on Ubuntu 15.04, 32 and 64 bit, using g++ 4.9.2. I can overcome it by commenting out the #if !(defined(BOOST_ATOMIC_EMULATED)) in both </p> <pre class="wiki"> atomic/capabilities.hpp atomic/detail/operations_lockfree.hpp </pre><p> (This was in the context of headers-only Boost subset package I maintain for R; the actual commit earlier today is here: <a class="ext-link" href="https://github.com/eddelbuettel/bh/commit/5238ac85b1afc32544612e615adac3aa279f3807"><span class="icon">​</span>https://github.com/eddelbuettel/bh/commit/5238ac85b1afc32544612e615adac3aa279f3807</a> </p> <p> Dirk </p> <p> </p> <pre class="wiki">#include &lt;iostream&gt; #include &lt;boost/math/special_functions/gamma.hpp&gt; int main(int argc, char *argv[]) { std::cout &lt;&lt; "Value: " &lt;&lt; boost::math::lgamma(10.0) &lt;&lt; std::endl; } </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/11301 Trac 1.4.3 Andrey Semashev Thu, 14 May 2015 08:58:52 GMT status changed; cc, resolution set https://svn.boost.org/trac10/ticket/11301#comment:1 https://svn.boost.org/trac10/ticket/11301#comment:1 <ul> <li><strong>cc</strong> <span class="trac-author">Andrey.Semashev@…</span> added </li> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">worksforme</span> </li> </ul> <p> I cannot reproduce this, the code compiles without errors on my system (Kubuntu 15.04, x86_64, Boost 1.58). In fact it doesn't even include Boost.Atomic anywhere. </p> <p> <code>BOOST_ATOMIC_EMULATED</code> should only be defined when the target platform is not supported or doesn't have atomic ops, so it is expected not to be defined. </p> <p> There is nowhere in the code where caps_gcc-atomic.hpp is included, the correct file name in 1.58 is caps_gcc_atomic.hpp (note the underscore instead of minus) and this file is present. The gcc_atomic part comes from boost/atomic/detail/platform.hpp:38. My guess is that you have an incorrectly modified copy of Boost. </p> Ticket anonymous Thu, 14 May 2015 10:22:26 GMT <link>https://svn.boost.org/trac10/ticket/11301#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11301#comment:2</guid> <description> <p> Thanks for the quick follow-up. I am glad that it is not a general issue in Boost; it is definitely an issue on my side with this "BH" package I construct for R (via use of bcp). </p> <p> Note that the bug only manifests itself <em>without -std=c++11</em>. If you set that, all is good. </p> <p> Here is complete file: </p> <pre class="wiki">// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; compile-command: "g++ -I/usr/local/lib/R/site-library/BH/include boost_atomic_test.cpp -o boost_atomic_test; ./boost_atomic_test"; -*- #include &lt;iostream&gt; #include &lt;boost/math/special_functions/gamma.hpp&gt; int main(int argc, char *argv[]) { std::cout &lt;&lt; "Value: " &lt;&lt; boost::math::lgamma(10.0) &lt;&lt; std::endl; } </pre><p> and if I M-x compile that I get </p> <p> Compilation started at Thu May 14 05:12:04 </p> <pre class="wiki">g++ -I/usr/local/lib/R/site-library/BH/include boost_atomic_test.cpp -o boost_atomic_test; ./boost_atomic_test In file included from /usr/local/lib/R/site-library/BH/include/boost/atomic/atomic.hpp:19:0, from /usr/local/lib/R/site-library/BH/include/boost/atomic.hpp:12, from /usr/local/lib/R/site-library/BH/include/boost/math/special_functions/detail/bernoulli_details.hpp:42, from /usr/local/lib/R/site-library/BH/include/boost/math/special_functions/bernoulli.hpp:16, from /usr/local/lib/R/site-library/BH/include/boost/math/special_functions/gamma.hpp:35, from boost_atomic_test.cpp:4: /usr/local/lib/R/site-library/BH/include/boost/atomic/capabilities.hpp:22:63: fatal error: boost/atomic/detail/caps_gcc_atomic.hpp: No such file or directory #include BOOST_ATOMIC_DETAIL_HEADER(boost/atomic/detail/caps_) ^ </pre><p> Dirk </p> </description> <category>Ticket</category> </item> <item> <author>edd@…</author> <pubDate>Thu, 14 May 2015 10:23:01 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/11301#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11301#comment:2</guid> <description> <p> Thanks for the quick follow-up. I am glad that it is not a general issue in Boost; it is definitely an issue on my side with this "BH" package I construct for R (via use of bcp). </p> <p> Note that the bug only manifests itself <em>without -std=c++11</em>. If you set that, all is good. </p> <p> Here is complete file: </p> <pre class="wiki">// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; compile-command: "g++ -I/usr/local/lib/R/site-library/BH/include boost_atomic_test.cpp -o boost_atomic_test; ./boost_atomic_test"; -*- #include &lt;iostream&gt; #include &lt;boost/math/special_functions/gamma.hpp&gt; int main(int argc, char *argv[]) { std::cout &lt;&lt; "Value: " &lt;&lt; boost::math::lgamma(10.0) &lt;&lt; std::endl; } </pre><p> and if I M-x compile that I get </p> <p> Compilation started at Thu May 14 05:12:04 </p> <pre class="wiki">g++ -I/usr/local/lib/R/site-library/BH/include boost_atomic_test.cpp -o boost_atomic_test; ./boost_atomic_test In file included from /usr/local/lib/R/site-library/BH/include/boost/atomic/atomic.hpp:19:0, from /usr/local/lib/R/site-library/BH/include/boost/atomic.hpp:12, from /usr/local/lib/R/site-library/BH/include/boost/math/special_functions/detail/bernoulli_details.hpp:42, from /usr/local/lib/R/site-library/BH/include/boost/math/special_functions/bernoulli.hpp:16, from /usr/local/lib/R/site-library/BH/include/boost/math/special_functions/gamma.hpp:35, from boost_atomic_test.cpp:4: /usr/local/lib/R/site-library/BH/include/boost/atomic/capabilities.hpp:22:63: fatal error: boost/atomic/detail/caps_gcc_atomic.hpp: No such file or directory #include BOOST_ATOMIC_DETAIL_HEADER(boost/atomic/detail/caps_) ^ </pre><p> Dirk </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Andrey Semashev</dc:creator> <pubDate>Thu, 14 May 2015 11:05:26 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/11301#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11301#comment:3</guid> <description> <p> If you used bcp to create your package then quite a few headers won't be copied. This is because bcp does not support unfolding macros which are used to construct some header names in Boost.Atomic. You will have to copy these headers manually. Basically, you need to copy all files from boost/atomic/detail. </p> </description> <category>Ticket</category> </item> <item> <author>Dirk Eddelbuettel <edd@…></author> <pubDate>Thu, 14 May 2015 11:42:57 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/11301#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11301#comment:4</guid> <description> <p> Oh, I see. We have been doing this for some time now with bcp and have not yet been bitten, but I understand that bcp may indeed have issues. That creates a bit of a wrinkle for the process. </p> <p> Can you take a real quick glance at the constructor script here: </p> <blockquote> <p> <a class="ext-link" href="https://github.com/eddelbuettel/bh/blob/master/local/scripts/CreateBoost.sh"><span class="icon">​</span>https://github.com/eddelbuettel/bh/blob/master/local/scripts/CreateBoost.sh</a> </p> </blockquote> <p> Maybe other libraries need some post-processing too. That said, we had almost 40 other packages depend on BH, and so far without issues. </p> </description> <category>Ticket</category> </item> </channel> </rss>