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
Related
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
Im trying to compile an example of Coarray Fortran file.
https://github.com/ljdursi/coarray-examples
The command for compile is:
mpifort diffusion/diffusion-coarray.f90 -fcoarray=lib -o diffusion/diffusion-coarray -L ${PATH_TO_OPENCOARRAY_LIB} -lcaf_mpi
I've already installed the OpenCoarrays, using spack
But there is an error:
/usr/bin/ld: cannot find -lcaf_mpi
collect2: error: ld returned 1 exit status
Without -lcaf_mpi the error is:
/tmp/ccOdrmfc.o: In function `MAIN__':
diffusion-coarray.f90:(.text+0x32): undefined reference to `_gfortran_caf_num_images'
diffusion-coarray.f90:(.text+0x4c): undefined reference to `_gfortran_caf_this_image'
diffusion-coarray.f90:(.text+0x66): undefined reference to `_gfortran_caf_this_image'
diffusion-coarray.f90:(.text+0x77): undefined reference to `_gfortran_caf_num_images'
diffusion-coarray.f90:(.text+0x8a): undefined reference to `_gfortran_caf_num_images'
diffusion-coarray.f90:(.text+0xaa): undefined reference to `_gfortran_caf_this_image'
diffusion-coarray.f90:(.text+0xbd): undefined reference to `_gfortran_caf_this_image'
diffusion-coarray.f90:(.text+0xf4): undefined reference to `_gfortran_caf_num_images'
End etc.
Where is the problem?
Thanks for help. I've solved the problem. If anyone will be interested, here is my solution:
1. Install Linuxbrew following their instructions:
sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)"
test -d ~/.linuxbrew && PATH="$HOME/.linuxbrew/bin:$HOME/.linuxbrew/sbin:$PATH"
test -d /home/linuxbrew/.linuxbrew && PATH="/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:$PATH"
test -r ~/.bash_profile && echo "export PATH='$(brew --prefix)/bin:$(brew --prefix)/sbin'":'"$PATH"' >>~/.bash_profile
echo "export PATH='$(brew --prefix)/bin:$(brew --prefix)/sbin'":'"$PATH"' >>~/.profile
Install OpenCoarrays library brew install opencoarrays
Now we can compile files with caf and cafrun
Compile .exe-file caf fname.f90 -o test.exe
Run the program cafrun -np (numimages) test.exe
Hope it will be helpful for someone!
P.S. My OS is Ubuntu 16.04.4 LTS, gfortran: GNU Fortran 5.4.0 20160609 so the rest of necessary tools (for example, compiler caf and launcher cafrun are the part of OpenCoarrays package) will be installed by following the instruction.
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?
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
I have installed libboost-dev through apt-get, and it's placed in /usr/lib.
/usr/lib$ ls | grep boost
libboost_filesystem.so.1.46.1
libboost_iostreams.so.1.46.1
libboost_serialization.so.1.46.1
libboost_system.so.1.46.1
libboost_thread.so.1.46.1
libboost_wserialization.so.1.46.1
But when I tried to compile a source that uses boost_thread I still got a error.
$ g++ tcp_echo.cpp -o tcp_echo -L/usr/lib -llibboost_thread
/usr/bin/ld: cannot find -lboost_thread
collect2: ld returned 1 exit status
$ g++ tcp_echo.cpp -o tcp_echo -L/usr/lib -lboost_thread
/usr/bin/ld: cannot find -lboost_thread
collect2: ld returned 1 exit status
What's the right way to install and link to libboost?
One thing I notice is that you do have no libboost_thread.so. You have
the versioned 1.46.1 file but usually libraries will create a symbolic
link to the versioned copy with the undecorated name. That might not
be it but it's one thing I noticed. (This is typically done by the
installer.) – Omaha
I think this is the point. It imply that I installed libboost the wrong way. In fact, I only installed libboost-dev:
sudo apt-get install libboost-dev
But what should I do is:
sudo apt-get install libboost-dev libboost1.46-doc libboost-date-time1.46-dev ibboost-filesystem1.46-dev libboost-graph1.46-dev libboost-iostreams1.46-dev libboost-math1.46-dev libboost-program-options1.46-dev libboost-python1.46-dev libboost-random1.46-dev libboost-regex1.46-dev libboost-serialization1.46-dev libboost-signals1.46-dev libboost-system1.46-dev libboost-test1.46-dev libboost-thread1.46-dev libboost-wave1.46-dev
(Or, in my particular case, install libboost-system1.46-dev libboost-thread1.46-dev at least)
And once you install them correctly, there should be .a and .so in /usr/lib.
/usr/lib$ ls | grep boost
libboost_date_time.a
libboost_date_time-mt.a
libboost_date_time-mt.so
libboost_date_time.so
libboost_date_time.so.1.46.1
libboost_filesystem.a
libboost_filesystem-mt.a
... and so on ...
In Ubuntu 16.04, the package is named: libboost-all-dev (not libboost-dev-all)
The comment box screwed up the quoting of this suggestion, so I'm posting it as an answer to get correct quoting.
It used to be, Ubuntu had the meta-package libboost-dev-all to install all of those. However, I can't seem to find it now. Here's a command line that might help:
sudo apt-get install `apt-cache search libboost | \
grep -- -dev | \
grep -v '[12]\.[0-9]' | \
awk '{ print $1; }'`
(Taken from https://github.com/imvu-open/istatd/ file install-boost-dev.sh )