Menu

#8 Compilation error in openbabel-2.3.2-patched

v1.0 (example)
closed
nobody
None
5
2019-01-08
2018-12-13
Vlad
No

Package openbabel-2.3.2-patched was downloded from OSRA.

$ make > produced this error:

openbabel-2.3.2-patched/include/openbabel/shared_ptr.h:27:14: error: ‘std::tr1’ has not been declared
using std::tr1::shared_ptr;

$ gcc --version
gcc (GCC) 7.2.1 20170915 (Red Hat 7.2.1-2)

$ cat /etc/os-release
NAME="Amazon Linux AMI"
VERSION="2018.03"
ID="amzn"
ID_LIKE="rhel fedora"
VERSION_ID="2018.03"
PRETTY_NAME="Amazon Linux AMI 2018.03"
ANSI_COLOR="0;33"
CPE_NAME="cpe:/o:amazon:linux:2018.03:ga"
HOME_URL="http://aws.amazon.com/amazon-linux-ami/"

Googling around did not help much. Please advice.

Thanks for your help!

Discussion

  • Igor

    Igor - 2018-12-13
     
    • Vlad

      Vlad - 2018-12-13

      This one fails with another error:

      /openbabel-2.3.2-tr1-memory/src/alias.cpp: In static member function ‘static bool OpenBabel::AliasData::LoadFile(OpenBabel::AliasData::SmartsTable&)’:
      /home/ec2-user/openbabel-2.3.2-tr1-memory/src/alias.cpp:273:9: error: reference to ‘shared_ptr’ is ambiguous
      shared_ptr<obsmartspattern> psp(new OBSmartsPattern);
      ^~~~~~~~~~</obsmartspattern>

      Could this be because of the compiler I am using? I tried setting it to different standards 11, 14, and 98. Makes no change.

      I can install latest offical openbabel-2.4 but will the unpatched version work with OSRA?

       
    • Vlad

      Vlad - 2018-12-13

      UPD on ambiguous shared_ptr.

      Solved by updating code:

      shared_ptr<...>

      to

      std::tr1::shared_ptr<...>

      The only remaining issue is this:

      /home/ec2-user/openbabel-2.3.2-tr1-memory/src/ops/sort.cpp: In member function ‘virtual bool OpenBabel::OpSort::ProcessVec(std::vector<openbabel::obbase*>&)’:
      /home/ec2-user/openbabel-2.3.2-tr1-memory/src/ops/sort.cpp:117:99: error: no matching function for call to ‘make_pair<openbabel::obbase*, double="">(OpenBabel::OBBase&, double)’
      valvec.push_back(std::make_pair<obbase*,double>(</obbase*,double>
      iter, _pDesc->Predict(*iter, &_pDescOption)));
      ^
      In file included from /usr/include/c++/7/bits/stl_algobase.h:64:0,
      from /usr/include/c++/7/bits/char_traits.h:39,
      from /usr/include/c++/7/string:40,
      from /home/ec2-user/openbabel-2.3.2-tr1-memory/include/openbabel/op.h:23,
      from /home/ec2-user/openbabel-2.3.2-tr1-memory/src/ops/sort.cpp:19:
      /usr/include/c++/7/bits/stl_pair.h:519:5: note: candidate: template<class _t2="" class="" _t1,=""> constexpr std::pair<typename std::__decay_and_strip<_tp="">::type, typename std::decay_and_strip<_T2>::type> std::make_pair(_T1&&, _T2&&)
      make_pair(_T1&&
      x, _T2&& __y)</typename></class></openbabel::obbase*,></openbabel::obbase*>

      Any recommendation would be appreciated.

       
  • Igor

    Igor - 2018-12-13

    why don't you try replacing it with std::make_pair as the error message suggest?

     
    • Vlad

      Vlad - 2018-12-13

      It is already so:

      valvec.push_back(std::make_pair<obbase*,double>(iter, _pDesc->Predict(iter, &_pDescOption)));</obbase*,double>

       
  • Igor

    Igor - 2018-12-14

    it builds for me but looking at that line it seems that make_pair is redundant and could be just a call to std::pair the way it's written.

     
    • Vlad

      Vlad - 2018-12-14

      Thanks Igor.

      I am past this problem now. All I needed to do is remove <type, type=""> from the call to make_pair and compiler was happy with it. </type,>

      But now I am facing this problem with /formats/chemkinformat.cpp:
      /home/ec2-user/openbabel-2.3.2-tr1-memory/src/formats/chemkinformat.cpp: In member function ‘bool OpenBabel::ChemKinFormat::ReadReactionQualifierLines(std::istream&, OpenBabel::OBReaction*)’:
      /home/ec2-user/openbabel-2.3.2-tr1-memory/src/formats/chemkinformat.cpp:642:13: error: no match for ‘operator!=’ (operand types are ‘std::istream {aka std::basic_istream<char>}’ and ‘long int’)
      return ifs!=NULL;
      ^</char>

      Which looks like a bug described here:
      https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216036

      I am afraid my knowledge may be not enough to address this problem.

      Just in case, could you share the version of gcc and stdlib that you have and which allow you to build it as is, without modifications I made?

       
  • Igor

    Igor - 2018-12-14

    I have it built on ubuntu 16.04 with g++ 5.4

     
  • Vlad

    Vlad - 2018-12-14

    Problem solved! I successfully compiled patched tr1 version. In the nutshell, I needed to change:

    1. shared_ptr to std::tr1::shared_ptr accross the project.
    2. Replace construct like stream != NULL or a pointer version with more appropriate for C++11:

    if(stream) ...

    Thanks!

     
  • Igor

    Igor - 2018-12-15

    Great - glad to hear this!

     
  • Igor

    Igor - 2019-01-08
    • status: open --> closed
     

Log in to post a comment.