Menu

#7 Cannot install on Ubuntu 16.04.2

v1.0 (example)
closed
nobody
None
5
2017-10-14
2017-08-29
Mark Lawson
No

Hi,

I am having issues installing OSRA on my system. I am running gcc version 5.4.0. I had already had a version of openbabel (version 2.4.1) installed and so I decided to just install with that one. After running make, I get the following output:

make -C src all
make[1]: Entering directory '/home/lawson/osra-2.1.0-1/src'
make osra
make[2]: Entering directory '/home/lawson/osra-2.1.0-1/src'
g++ -std=gnu++11 -fopenmp -g -O2 -I/usr/include/GraphicsMagick -I/usr/local/include/openbabel-2.0 -I/usr/local/include/gocr -I/usr/local/include   -c -o osra_reaction.o osra_reaction.cpp
osra_reaction.cpp:40:43: error: shared_ptr does not name a type
   template<typename T> using shared_ptr = shared_ptr<T>;
                                           ^
osra_reaction.cpp: In function std::__cxx11::string convert_page_to_reaction(const std::vector<std::__cxx11::basic_string<char> >&, const string&, const std::vector<int>&, const std::vector<int>&, std::__cxx11::string, bool)’:
osra_reaction.cpp:66:7: error: shared_ptr is not a member of OpenBabel
       OpenBabel::shared_ptr<OBMol> reactant(new OBMol);
       ^
osra_reaction.cpp:66:7: note: suggested alternatives:
In file included from /usr/include/c++/5/bits/shared_ptr.h:52:0,
                 from /usr/include/c++/5/memory:82,
                 from /usr/include/c++/5/tr1/memory:39,
                 from /usr/local/include/openbabel-2.0/openbabel/shared_ptr.h:20,
                 from /usr/local/include/openbabel-2.0/openbabel/reaction.h:23,
                 from osra_reaction.cpp:27:
/usr/include/c++/5/bits/shared_ptr_base.h:345:11: note:   std::shared_ptr
     class shared_ptr;
           ^
In file included from /usr/include/c++/5/tr1/memory:50:0,
                 from /usr/local/include/openbabel-2.0/openbabel/shared_ptr.h:20,
                 from /usr/local/include/openbabel-2.0/openbabel/reaction.h:23,
                 from osra_reaction.cpp:27:
/usr/include/c++/5/tr1/shared_ptr.h:503:11: note:   std::tr1::shared_ptr
     class shared_ptr;
           ^
osra_reaction.cpp:66:34: error: expected primary-expression before > token
       OpenBabel::shared_ptr<OBMol> reactant(new OBMol);
                                  ^
osra_reaction.cpp:66:54: error: reactant was not declared in this scope
       OpenBabel::shared_ptr<OBMol> reactant(new OBMol);
                                                      ^
osra_reaction.cpp:72:7: error: shared_ptr is not a member of OpenBabel
       OpenBabel::shared_ptr<OBMol> product(new OBMol);
       ^
osra_reaction.cpp:72:7: note: suggested alternatives:
In file included from /usr/include/c++/5/bits/shared_ptr.h:52:0,
                 from /usr/include/c++/5/memory:82,
                 from /usr/include/c++/5/tr1/memory:39,
                 from /usr/local/include/openbabel-2.0/openbabel/shared_ptr.h:20,
                 from /usr/local/include/openbabel-2.0/openbabel/reaction.h:23,
                 from osra_reaction.cpp:27:
/usr/include/c++/5/bits/shared_ptr_base.h:345:11: note:   std::shared_ptr
     class shared_ptr;
           ^
In file included from /usr/include/c++/5/tr1/memory:50:0,
                 from /usr/local/include/openbabel-2.0/openbabel/shared_ptr.h:20,
                 from /usr/local/include/openbabel-2.0/openbabel/reaction.h:23,
                 from osra_reaction.cpp:27:
/usr/include/c++/5/tr1/shared_ptr.h:503:11: note:   std::tr1::shared_ptr
     class shared_ptr;
           ^
osra_reaction.cpp:72:34: error: expected primary-expression before > token
       OpenBabel::shared_ptr<OBMol> product(new OBMol);
                                  ^
osra_reaction.cpp:72:53: error: product was not declared in this scope
       OpenBabel::shared_ptr<OBMol> product(new OBMol);
                                                     ^
<builtin>: recipe for target 'osra_reaction.o' failed
make[2]: *** [osra_reaction.o] Error 1
make[2]: Leaving directory '/home/lawson/osra-2.1.0-1/src'
Makefile:40: recipe for target 'all' failed
make[1]: *** [all] Error 2
make[1]: Leaving directory '/home/lawson/osra-2.1.0-1/src'
Makefile:17: recipe for target 'all.subdir' failed
make: *** [all.subdir] Error 2

After getting this error, I decided to try installing the patched version of openbabel that you provide. After running make, i get similar error:

Scanning dependencies of target openbabel
[  0%] Building CXX object src/CMakeFiles/openbabel.dir/alias.o
In file included from /home/lawson/openbabel-2.3.2-patched/include/openbabel/alias.h:19:0,
                 from /home/lawson/openbabel-2.3.2-patched/src/alias.cpp:17:
/home/lawson/openbabel-2.3.2-patched/include/openbabel/shared_ptr.h:27:14: error: std::tr1 has not been declared
   using std::tr1::shared_ptr;
              ^
In file included from /home/lawson/openbabel-2.3.2-patched/src/alias.cpp:17:0:
/home/lawson/openbabel-2.3.2-patched/include/openbabel/alias.h:118:47: error: shared_ptr was not declared in this scope
   typedef std::vector< std::pair<std::string, shared_ptr<OBSmartsPattern> > > SmartsTable;
                                               ^
/home/lawson/openbabel-2.3.2-patched/include/openbabel/alias.h:118:73: error: template argument 2 is invalid
   typedef std::vector< std::pair<std::string, shared_ptr<OBSmartsPattern> > > SmartsTable;
                                                                         ^
/home/lawson/openbabel-2.3.2-patched/include/openbabel/alias.h:118:75: error: template argument 1 is invalid
   typedef std::vector< std::pair<std::string, shared_ptr<OBSmartsPattern> > > SmartsTable;
                                                                           ^
/home/lawson/openbabel-2.3.2-patched/include/openbabel/alias.h:118:75: error: template argument 2 is invalid
/home/lawson/openbabel-2.3.2-patched/include/openbabel/alias.h:118:77: error: expected unqualified-id before > token
   typedef std::vector< std::pair<std::string, shared_ptr<OBSmartsPattern> > > SmartsTable;
                                                                             ^
/home/lawson/openbabel-2.3.2-patched/include/openbabel/alias.h:119:24: error: SmartsTable has not been declared
   static bool LoadFile(SmartsTable& smtable);
                        ^
/home/lawson/openbabel-2.3.2-patched/src/alias.cpp:239:26: error: bool OpenBabel::AliasData::LoadFile is not a static data member of class OpenBabel::AliasData
 bool AliasData::LoadFile(SmartsTable& smtable)
                          ^
/home/lawson/openbabel-2.3.2-patched/src/alias.cpp:239:26: error: SmartsTable was not declared in this scope
/home/lawson/openbabel-2.3.2-patched/src/alias.cpp:239:39: error: smtable was not declared in this scope
 bool AliasData::LoadFile(SmartsTable& smtable)
                                       ^
/home/lawson/openbabel-2.3.2-patched/src/alias.cpp:240:1: error: expected , or ; before ‘{’ token
 {
 ^
/home/lawson/openbabel-2.3.2-patched/src/alias.cpp:396:1: error: expected ‘}’ at end of input
 }//namespace
 ^
src/CMakeFiles/openbabel.dir/build.make:62: recipe for target 'src/CMakeFiles/openbabel.dir/alias.o' failed
make[2]: *** [src/CMakeFiles/openbabel.dir/alias.o] Error 1
CMakeFiles/Makefile2:1232: recipe for target 'src/CMakeFiles/openbabel.dir/all' failed
make[1]: *** [src/CMakeFiles/openbabel.dir/all] Error 2
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2

I have tried altering the shared_ptr.h file according to the bugfix you alluded to in a previous support request https://bugzilla.redhat.com/show_bug.cgi?id=1318062 but this does not change anything. Is there some compilation flag I need to set?

Greatly appreciate any help on this.

~ Markj

Discussion

  • Igor

    Igor - 2017-08-30

    Mark,

    I am not sure why it's still searching for shared_ptr in tr1.
    If you have applied the modification it should only look for std::shared_ptr.
    Are you sure you've modified
    /home/lawson/openbabel-2.3.2-patched/include/openbabel/shared_ptr.h
    ?

     
  • Mark Lawson

    Mark Lawson - 2017-08-30

    Hi Igor

    Thank you for getting back to me. I think I figured out what the issue was, I was not compiling it using the C++ 11 standard after altering the shared_ptr.h file. So I added the line

    set (CMAKE_CXX_STANDARD 11)
    

    to the CMakeLists.txt file. However, I now have a new error when creating the sort.o object:

    [ 17%] Building CXX object src/CMakeFiles/plugin_ops.dir/ops/sort.o
    /home/lawson/openbabel-2.3.2-patched/src/ops/sort.cpp: In member function virtual bool OpenBabel::OpSort::ProcessVec(std::vector<OpenBabel::OBBase*>&)’:
    /home/lawson/openbabel-2.3.2-patched/src/ops/sort.cpp:117:99: error: no matching function for call to make_pair(OpenBabel::OBBase*&, double)
           valvec.push_back(std::make_pair<OBBase*,double>(*iter, _pDesc->Predict(*iter, &_pDescOption)));
                                                                                                       ^
    In file included from /usr/include/c++/5/bits/stl_algobase.h:64:0,
                     from /usr/include/c++/5/bits/char_traits.h:39,
                     from /usr/include/c++/5/string:40,
                     from /home/lawson/openbabel-2.3.2-patched/include/openbabel/op.h:23,
                     from /home/lawson/openbabel-2.3.2-patched/src/ops/sort.cpp:19:
    /usr/include/c++/5/bits/stl_pair.h:276:5: note: candidate: template<class _T1, class _T2> 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)
         ^
    /usr/include/c++/5/bits/stl_pair.h:276:5: note:   template argument deduction/substitution failed:
    /home/lawson/openbabel-2.3.2-patched/src/ops/sort.cpp:117:99: note:   cannot convert iter.__gnu_cxx::__normal_iterator<_Iterator, _Container>::operator*<OpenBabel::OBBase**, std::vector<OpenBabel::OBBase*> >() (type OpenBabel::OBBase*) to type OpenBabel::OBBase*&&
           valvec.push_back(std::make_pair<OBBase*,double>(*iter, _pDesc->Predict(*iter, &_pDescOption)));
                                                                                                       ^
    /home/lawson/openbabel-2.3.2-patched/src/ops/sort.cpp:147:68: error: no matching function for call to make_pair(OpenBabel::OBBase*&, std::__cxx11::string&)
           valvec.push_back(std::make_pair<OBBase*,std::string>(*iter, s));
                                                                        ^
    In file included from /usr/include/c++/5/bits/stl_algobase.h:64:0,
                     from /usr/include/c++/5/bits/char_traits.h:39,
                     from /usr/include/c++/5/string:40,
                     from /home/lawson/openbabel-2.3.2-patched/include/openbabel/op.h:23,
                     from /home/lawson/openbabel-2.3.2-patched/src/ops/sort.cpp:19:
    /usr/include/c++/5/bits/stl_pair.h:276:5: note: candidate: template<class _T1, class _T2> 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)
         ^
    /usr/include/c++/5/bits/stl_pair.h:276:5: note:   template argument deduction/substitution failed:
    /home/lawson/openbabel-2.3.2-patched/src/ops/sort.cpp:147:68: note:   cannot convert iter.__gnu_cxx::__normal_iterator<_Iterator, _Container>::operator*<OpenBabel::OBBase**, std::vector<OpenBabel::OBBase*> >() (type OpenBabel::OBBase*) to type OpenBabel::OBBase*&&
           valvec.push_back(std::make_pair<OBBase*,std::string>(*iter, s));
                                                                        ^
    src/CMakeFiles/plugin_ops.dir/build.make:374: recipe for target 'src/CMakeFiles/plugin_ops.dir/ops/sort.o' failed
    make[2]: *** [src/CMakeFiles/plugin_ops.dir/ops/sort.o] Error 1
    CMakeFiles/Makefile2:1195: recipe for target 'src/CMakeFiles/plugin_ops.dir/all' failed
    make[1]: *** [src/CMakeFiles/plugin_ops.dir/all] Error 2
    Makefile:138: recipe for target 'all' failed
    make: *** [all] Error 2
    

    Is this due to my changing the g++ std? Is there a way to only use it for alias.o and not for this (my Cmake knowledge is very limited)? Or is there something else going on here?

    Really appreciate the help on this

     
  • Igor

    Igor - 2017-08-31

    Mark,

    I have not modified CMakeLists.txt or enabled c++-11 for OpenBabel build so I cannot advice what went wrong. It builds fine on Centos 6, CentOs 7 and various Fedora versions just out of the box. I haven't looked at Ubuntu builds, perhaps I should put it on my todo list.

    Igor

     
  • Mark Lawson

    Mark Lawson - 2017-09-01

    Hey Igor,

    Thanks again for your help on this. Need to take some time off from solving this problem, maybe a new solution will come to me.

    I agree, an Ubuntu build would be awesome to try.

    Mark

     
  • Zaryab Iftekhar

    Zaryab Iftekhar - 2017-09-20

    Hey Igor,

    I am also getting the same error on shared_ptr.h on Ubuntu 16.04.2 and Openbabel 2.1

     
  • Igor

    Igor - 2017-10-11

    I have uploaded a different version of openbabel-patched -
    openbabel-2.3.2-tr1-memory.tgz
    This fixes the problem with shared_ptr on Ubuntu 16.04 for me, please try downloading and building.

     
    • Zaryab Iftekhar

      Zaryab Iftekhar - 2017-10-12

      Thank you Igor, its working now using patched version of openbabel

       
  • Igor

    Igor - 2017-10-14
    • status: open --> closed
     

Log in to post a comment.

MongoDB Logo MongoDB