How to compile AutoDock Vina from source code? - c++

I am trying to compile a program called AutoDock Vina from this web site: http://vina.scripps.edu/manual.html#build. I can't use prebuilt binaries files directly because I have to change some parameters in the source code.
I installed build-essential, g++ and boost. I downloaded autodock_vina_1_1_2.tgz and unpacked.
I tried to follow instructions in the site but I failed. I changed Makefile in the autodock_vina_1_1_2/build/linux/debug/Makefile:
BASE=/usr/lib/python2.7/dist-packages/
BOOST_VERSION=1.67.0
BOOST_INCLUDE = $(BASE)/include
C_PLATFORM=-static -pthread
GPP=/usr/bin/g++
C_OPTIONS= -g
BOOST_LIB_VERSION=
include ../../makefile_common
Note: I also tested BASE=/usr or /usr/libexec or any logic combination according to the installation information above
And then when make I encounter this error message:
(base) root#kali:~/Desktop/share/autodock_vina_1_1_2/build/linux/debug# make
/usr/bin/g++ -static -pthread -ansi -Wno-long-long -g -I /usr/lib/python2.7/dist-packages//include -I ../../../src/lib -o main.o -c ../../../src/main/main.cpp
In file included from /usr/include/boost/assert.hpp:58,
from /usr/include/boost/random/uniform_smallint.hpp:22,
from /usr/include/boost/random.hpp:86,
from ../../../src/lib/random.h:26,
from ../../../src/lib/quaternion.h:30,
from ../../../src/lib/conf.h:28,
from ../../../src/lib/tree.h:26,
from ../../../src/lib/model.h:29,
from ../../../src/lib/parse_pdbqt.h:26,
from ../../../src/main/main.cpp:33:
../../../src/lib/quaternion.h: In function ‘void quaternion_normalize(qt&)’:
../../../src/lib/quaternion.h:79:9: error: ‘quaternion_is_normalized’ was not declared in this scope; did you mean ‘quaternion_normalize’?
79 | assert(quaternion_is_normalized(q));
| ^~~~~~~~~~~~~~~~~~~~~~~~
../../../src/lib/quaternion.h: In function ‘void quaternion_normalize_approx(qt&, fl)’:
../../../src/lib/quaternion.h:91:16: error: ‘quaternion_is_normalized’ was not declared in this scope; did you mean ‘quaternion_normalize’?
91 | assert(quaternion_is_normalized(q));
| ^~~~~~~~~~~~~~~~~~~~~~~~
../../../src/main/main.cpp: In function ‘path make_path(const string&)’:
../../../src/main/main.cpp:50:44: error: no matching function for call to ‘boost::filesystem::path::path(const string&, bool (&)(const string&))’
So, how can I compile AutoDock Vina from source code?

You don't need to "make". Just move files into bin folder apply these instructions:
$ cd Downloads/
$ wget http://mgltools.scripps.edu/downloads/tars/releases/REL1.5.6/mgltools_x86_64Linux2_1.5.6.tar.gz
$ wget http://vina.scripps.edu/download/autodock_vina_1_1_2_linux_x86.tgz
#install python PIL:
#install libjpeg62
$ sudo apt-get install libjpeg62:i386
#download Autodock4 and AutoGrid4
$ sudo wget http://autodock.scripps.edu/downloads/autodock-registration/tars/dist426/autodocksuite-4.2.6-x86_64Linux2.tar
Installation:
Now that we have the tar files in the Downloads folder, we will extract and install them one by one. Let’s install AutoDock suite first, then later the MGL tools, and AutoDock Vina. To install them, open the terminal and go to the Downloads folder again.
$ cd Downloads
$ tar xvf autodocksuite-4.2.6-x86_64Linux2.tar
$ cd x86_64Linux2
$ sudo mv autodock4 /usr/local/bin
$ sudo mv autogrid4 /usr/local/bin
#install mgltools:
$ cd Downloads
$ tar xvzf mgltools_x86_64Linux2_1.5.6.tar.gz
$ cd mgltools_x86_64Linux2_1.5.6
$ ./install.sh

Related

CentOS7: rpmbuild - Unable to recognise the format of the input file

I'm trying to build an extremely simple rpm over centos7.
I just copy some pre-compiled executables from the tar.gz to /usr/bin/my_rpms/rpm1.
Here is my install section:
%install
mkdir -p %{buildroot}/usr/bin/my_rpms/rpm1/
install -D prog prog.o -t %{buildroot}/usr/bin/my_rpms/rpm1/
it used to work find for the most part.
but today when after i made some changes to the prog and re-compiled it keeps gettings these errors:
+ mkdir -p /root/rpmbuild/BUILDROOT/rpm1.x86_64/usr/bin/my_rpms/rpm1/
+ install -D prog prog.o -t /root/rpmbuild/BUILDROOT/rpm1.x86_64/usr/bin/my_rpms/rpm1/
+ /usr/lib/rpm/check-buildroot
+ /usr/lib/rpm/redhat/brp-compress
+ /usr/lib/rpm/redhat/brp-strip /usr/bin/strip
/usr/bin/strip: Unable to recognise the format of the input file `/root/rpmbuild/BUILDROOT/rpm1.x86_64/usr/bin/drivertest_rpms/rpm1/prog.o'
As you can see in error log, problem is with binary file striping which is default behavior of install command. I think your build environment is maybe different then rpm environment. cross-compiling? as suggested by #aaron-d-marasco
So I recommend to build rpm from project source. i.e move your build commands into %build section of .spec file.
Or strip your files in the same place where you have build them, and then in rpm use cp command in %install section instead of install command to move your files to target directory.

replace a part of a string with REGEXP in sqlite3

I installed REGEX support with
apt-get install sqlite3 sqlite3-pcre
now I can use REGEX in my queries on the bash console like
DB="somedb.db"
REGEX_EXTENSION="SELECT load_extension('/usr/lib/sqlite3/pcre.so');"
sqlite3 $DB "$REGEX_EXTENSION select * from sometable where name REGEXP '^[a-z]+$'"
But how can I update a string with an sqlite query using regex?
Sqlite by default does not provide regex_replace function. You need to load it as an extension. Here is how i managed to do it.
Download this C code for the extension (icu_replace)
Compile it using
gcc --shared -fPIC -I sqlite-autoconf-3071100 icu_replace.c -o icu_replace.so
And in sqlite3 runn following command post above mentioned command has run and create a file icu_replace.so
SELECT load_extension(' path to icu_replace.so', 'sqlite3_extension_init') from dual;
After this you will be able to use such a function as :-
select regex_replace('\bThe\b',x,'M') from dual;
The following builds latest sqlite with dynamic library support, and compiles ICU extension and regex_replace extension. It also assumes debian-based linux distributive:
sudo apt build-dep sqlite3 # fetches dependencies to compile sqlite3
mkdir sqlite-compilation
cd sqlite-compilation
wget -O sqlite.tar.gz https://www.sqlite.org/src/tarball/sqlite.tar.gz?r=release
tar xzf sqlite.tar.gz
mkdir build
cd build
../sqlite/configure
make OPTS='-DSQLITE_ENABLE_LOAD_EXTENSION'
./sqlite3 -cmd 'pragma compile_options;' <<< .exit
cd -
# https://sqlite.org/src/dir?name=ext/icu
cd sqlite/ext/icu
sed -i 's/int sqlite3_icu_init(/int sqlite3_extension_init(/' icu.c
sed -i 's/int sqlite3IcuInit(/int sqlite3_extension_init(/' sqliteicu.h
gcc -g -O2 -shared icu.c -fPIC -I ../../../build `pkg-config --libs icu-i18n` -o libSqlite3Icu.so
cp libSqlite3Icu.so ../../../build/
cd -
# https://github.com/gwenn/sqlite-regex-replace-ext
cd sqlite/ext
wget -O sqlite-regex-replace-ext-master.zip https://github.com/gwenn/sqlite-regex-replace-ext/archive/master.zip
unzip sqlite-regex-replace-ext-master.zip
cd sqlite-regex-replace-ext-master
gcc -g -O2 -shared icu_replace.c -fPIC -I ../../../build -o libSqlite3IcuReplace.so
cp libSqlite3IcuReplace.so ../../../build/
cd -
cd ../../
In result you will have:
build/sqlite3 # sqlite3 binary
build/libSqlite3Icu.so # unicode support
build/libSqlite3IcuReplace # regex_replace function
Test:
cd build
sqlite3 <<< "
.load ./libSqlite3Icu
.load ./libSqlite3IcuReplace
select regex_replace('^a', 'aab', 'b');
.exit
" # should output: bab
cd -
For me the above answers didn't work because of some missing parameters in the gcc command.
This works for me:
git clone https://github.com/gwenn/sqlite-regex-replace-ext.git
cd sqlite-regex-replace-ext-master/
./icu_replace.sh
Now you should be able to load the extension using: SELECT LOAD_EXTENSION('path-to-icu_replace.so');

How to create alpha_encoder.exe (webm-tools) under msys2?

I'm trying to compile alpha_encoder) (little utility of The WebM Project, under webm-tools).
I have a previous installation of msys2 (downloaded and configured by build_locally_with_various_option_prompts.bat) under c:\FFcompiler. It took its time, but I managed to compile ffmpeg, so I decided to use it (I think it will do). That's what I've done till now.
First, I cloned webm-tools under /cygdrive/c/FFcompiler/ffmpeg_local_builds/sandbox/win32/libvpx-1.4.0/third_party/. There's a Makefile so I tried to run make:
$ cd /cygdrive/c/FFcompiler/ffmpeg_local_builds/sandbox/win32/libvpx-1.4.0/third_party/
$ git clone https://chromium.googlesource.com/webm/webm-tools.git
$ cd webm-tools/alpha_encoder/
$ make
But g++ complains mkvparser.hpp doesn't exist. The command is
g++ -c -W -Wall -O3 -g -I../../libwebm alpha_encoder.cc -o alpha_encoder.o
After searching the web, it seems that webm-tools depends on libwebm, and expect finding it as a sibling folder of webm-tools. So...
$ cd ../..
$ git clone https://chromium.googlesource.com/webm/libwebm.git
$ cd libwebm
Now, what? README.libwebm tells that 'to cross compile libwebm for Windows using mingw-w64' first I must run cmake like this cmake -DCMAKE_TOOLCHAIN_FILE=path/to/libwebm/build/mingw-w64_toolchain.cmake path/to/libwebm. In my case:
cmake -DCMAKE_TOOLCHAIN_FILE=build/mingw-w64_toolchain.cmake .
And cmake cannot find i686-w64-mingw32-g++. After googling more, it seems the easiest way to fix this is to add bin of mingw-w64-i686 to PATH.
$ export PATH=/cygdrive/c/FFcompiler/ffmpeg_local_builds/sandbox/cross_compilers/mingw-w64-i686/bin:$PATH
After this, now cmake finishes successfully and creates a Makefile, but make stops with an error:
/cygdrive/c/FFcompiler/ffmpeg_local_builds/sandbox/win32/libvpx-1.4.0/third_part
y/libwebm/common/file_util.cc:44:39: error: 'tmpnam_s' was not declared in this
scope
errno_t err = tmpnam_s(tmp_file_name);
^
I've searched about the error but I'm stuck. What am I missing?

Installing and using the ParMetis library

I am installing ParMetis 4.0.3 but into a non-default directory, with:
make config prefix=/My-ParMETIS-Directory/
And afterward:
make install
After that, I get a set of directories in that folder. And to write a program that uses it, I'm supposed to add the 'include "parmetis.h"' in the headline, and also add the 'libraries/binaries'. How exactly do I do the latter?
I'm just trying to get my code to compile now, and doing so I run:
g++ test.cpp
This is test.cpp:
#include<iostream>
#include "include/parmetis.h"
using std::cout;
using std::endl;
int main()
{
cout << "Test!" << endl;
return 0;
}
I keep getting "was not declared in this scope" for everything/every-line in parmetis.h.
How can I get test.cpp use the other folders/files that were installed?
You need to provide the location of your ParMetis library to
the compiler, since you have choosen to install the library
not in the default library directories.
mpic++ test.cpp -I /My-ParMETIS-Directory/ -I /My-METIS-Directory/
Edit#2:
What I did to get your code compiling:
Download the ParMetis library from webpage to /tmp
cd /tmp/
wget http://glaros.dtc.umn.edu/gkhome/fetch/sw/parmetis/parmetis-4.0.3.tar.gz
Unpack archive
tar -xf parmetis-4.0.3.tar.gz
Install ParMETIS into directory /tmp/parmetis
mkdir parmetis
cd parmetis-4.0.3/
make config prefix=/tmp/parmetis
make install
Install METIS into directory /tmp/metis
cd /tmp/
mkdir metis
cd parmetis-4.0.3/metis
make config prefix=/tmp/metis
make install
Compile test.cpp which is located in /tmp/
cd /tmp/
mpic++ test.cpp -I /tmp/parmetis -I /tmp/metis
when you coding wtih C++ ,if you meet question like that :
ccJjiCo.o: In function `main':
bsplele.cpp:(.text+0x45e): undefined reference to `METIS_PartMeshNodal'
collect2: ld returned 1 exit status
you can check the compiler sentence and you should paste the -lmetis at the end of the compilation command.It is useful for me.
my right compilation command is that:g++ -L/home/hadoop/metis/lib -I/home/hadoop/metis/include/ LL_metis.cpp -lmetis

Install & Compile ZeroMQ/ZMQ/0MQ on Ubuntu 12.04 32bit

I really want to use 0MQ for a personal project, but I am having a very tough time getting things to compile after installation
Here is what I do:
#### Install prerequisites without errors: ####
$ sudo apt-get install libtool autoconf automake uuid-dev build-essential
#### Get 0MQ: ####
$ cd ~/Downloads
$ wget http://download.zeromq.org/zeromq-3.2.1-rc2.tar.gz
$ tar -xvzf zeromq-3.2.1-rc2.tar.gz
#### Install 0MQ without errors: ####
$ cd zeromq-3.2.1
$ ./configure
$ make
$ sudo make install
$ sudo ldconfig
#### Get the imatix zguide: ####
$ cd ~/Downloads
$ wget https://github.com/imatix/zguide/tarball/master
$ tar -xvzf master
This is where I need help. Running "./build all" in the imatix "examples/C" and "examples/C++" folders just results in loads of errors. I have also tried compiling using the "./c" and "./c -p" commands in the "/examples/C/" & "/examples/C++/" directories respectively. I don't get errors, but they generate ".o" and ".opp" files. Are these executables? After compiling I have tried "chmod +x" and "chown 777" to no avail. Here is what I do:
#### Generates hwclient.o ####
$ cd imatix-zguide-a690f10/
$ cd examples/C/
$ ./c hwclient.c
Compiling hwclient...
$ ./hwclient.o
bash: ./hwclient.o: Permission denied
#### Generates hwclient.opp ###
$ cd ../C++/
$ ./c -p hwclient.cpp
Compiling hwclient...
$ ./hwclient.opp
bash: ./hwclient.opp: Permission denied
I have also tried compiling with g++ which just results in similar errors to running "./build all":
$ g++ hwclient.cpp -o hwclient.exe
/tmp/ccWFyLHw.o: In function `main':
hwclient.c:(.text+0x16): undefined reference to `zmq_ctx_new'
hwclient.c:(.text+0x3a): undefined reference to `zmq_socket'
hwclient.c:(.text+0x52): undefined reference to `zmq_connect'
hwclient.c:(.text+0x73): undefined reference to `zmq_msg_init_size'
hwclient.c:(.text+0x7f): undefined reference to `zmq_msg_data'
hwclient.c:(.text+0xb9): undefined reference to `zmq_msg_send'
hwclient.c:(.text+0xc5): undefined reference to `zmq_msg_close'
hwclient.c:(.text+0xd1): undefined reference to `zmq_msg_init'
hwclient.c:(.text+0xed): undefined reference to `zmq_msg_recv'
hwclient.c:(.text+0x10d): undefined reference to `zmq_msg_close'
hwclient.c:(.text+0x12e): undefined reference to `zmq_close'
hwclient.c:(.text+0x13a): undefined reference to `zmq_ctx_destroy'
collect2: ld returned 1 exit status
What is the next step/what am I missing? I have looked all over the 0MQ site & wiki but nobody else seems to have an issue. Am I making a noob mistake? Am I executing the ".o" or ".opp" files incorrectly? Are they even executables?
Please help. I really want to use 0MQ!
I found that I had to upgrade to ZeroMQ 3.2.x to get the examples to compile properly. The current version in the CentOS/EPEL repositories is 2.1.9, which doesn't work with the examples in the zguide. My example here was done on a CentOS 6.3 server.
yum remove zeromq zeromq-devel
wget http://download.zeromq.org/zeromq-3.2.2.tar.gz
tar zxvf zeromq-3.2.2.tar.gz && cd zeromq-3.2.2
./configure
make && make install
cd ~/zguide/examples/C
gcc -o hwclient hwclient.c -lzmq
After talking on a few IRC channels I have figured it out.
#### Build a single file with: ####
./c -p filename.cpp
g++ -o filename filename.opp -lzmq
#### Build all in folder ####
CCLIBS='-lzmq' ./build all