Cannot install on Ubuntu 16.04.2
Brought to you by:
igor_filippov
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
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
?
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
to the CMakeLists.txt file. However, I now have a new error when creating the sort.o object:
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
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
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
Hey Igor,
I am also getting the same error on shared_ptr.h on Ubuntu 16.04.2 and Openbabel 2.1
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.
Thank you Igor, its working now using patched version of openbabel