Bug 1318062 - fedora 22 openbabel-devel rpm package uses tr1::shared_ptr
Summary: fedora 22 openbabel-devel rpm package uses tr1::shared_ptr
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: openbabel
Version: 22
Hardware: All
OS: Unspecified
unspecified
medium
Target Milestone: ---
Assignee: Dominik 'Rathann' Mierzejewski
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-03-15 22:33 UTC by igor.v.filippov
Modified: 2016-04-18 21:20 UTC (History)
4 users (show)

Fixed In Version: openbabel-2.3.2-12.fc22
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-04-18 21:20:09 UTC
Type: Bug


Attachments (Terms of Use)
sample cpp file to test compiling against openbabel (2.13 KB, text/x-csrc)
2016-03-15 22:33 UTC, igor.v.filippov
no flags Details

Description igor.v.filippov 2016-03-15 22:33:58 UTC
Created attachment 1136783 [details]
sample cpp file to test compiling against openbabel

Description of problem:
The most recent openbabel-devel rpm package for Fedora 22
openbabel-devel-2.3.2-11 still has in 
/usr/include/openbabel-2.0/openbabel/shared_ptr.h

#ifdef USE_BOOST
  #include <boost/shared_ptr.hpp>
  #define shared_ptr boost::shared_ptr
#else
  #include <memory>
  #if __GNUC__ == 4  //&& __GNUC_MINOR__ < 3  removed at the suggestion of Konst
antin Tokarev
    #include <tr1/memory>
  #endif
  using std::tr1::shared_ptr;
#endif

The current version of GCC on Fedora 22 is gcc-5.1.1-4.fc22 and it comes with
shared_ptr in std. This has most likely been fixed already in OB source,
but the rpm package is still in fedora repos and is unusable. The error message when trying to compile against openbabel-devel headers and library is:

In file included from /usr/include/openbabel-2.0/openbabel/alias.h:19:0,
                 from obtest.cpp:5:
/usr/include/openbabel-2.0/openbabel/shared_ptr.h:27:14: error: ‘std::tr1’ has not been declared
   using std::tr1::shared_ptr;


here is the trivial fix - put the following in

#ifdef USE_BOOST
  #include <boost/shared_ptr.hpp>
  #define shared_ptr boost::shared_ptr
#else
  #include <memory>
  #if __GNUC__ == 4 
    #include <tr1/memory>
  #endif
#if __GNUC__ < 5
  using std::tr1::shared_ptr;
#else
  using std::shared_ptr;
#endif 
#endif

The user code will probably need to be compiled with -std=c++11 option.

Version-Release number of selected component (if applicable):
openbabel-devel-2.3.2-11

How reproducible:
Always

Steps to Reproduce:
1. Try to compile user code against openbabel-devel provided headers
(see attached sample file).
2. g++ -o obtest -I/usr/include/openbabel-2.0/  obtest.cpp -lopenbabel
3. g++ -std=c++11 -o obtest -I/usr/include/openbabel-2.0/  obtest.cpp -lopenbabel

Actual results:
In file included from /usr/include/openbabel-2.0/openbabel/alias.h:19:0,
                 from obtest.cpp:5:
/usr/include/openbabel-2.0/openbabel/shared_ptr.h:27:14: error: ‘std::tr1’ has not been declared
   using std::tr1::shared_ptr;

Expected results:
compilation successful.

Additional info:
Attached a sample cpp file to test building against openbabel.

Comment 1 Dominik 'Rathann' Mierzejewski 2016-04-07 00:07:43 UTC
It does seem to work on F23+ with -std=c++11, so the bug affects F22 only. I'll try to apply your fix shortly.

Comment 2 Fedora Update System 2016-04-07 09:52:31 UTC
openbabel-2.3.2-12.fc22 has been submitted as an update to Fedora 22. https://bodhi.fedoraproject.org/updates/FEDORA-2016-9e7cb1c296

Comment 3 Fedora Update System 2016-04-08 20:54:12 UTC
openbabel-2.3.2-12.fc22 has been pushed to the Fedora 22 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-9e7cb1c296

Comment 4 Fedora Update System 2016-04-18 21:20:07 UTC
openbabel-2.3.2-12.fc22 has been pushed to the Fedora 22 stable repository. If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.