C++ linux install executable file on deploy environment - c++

Hello every one i need to deploy linux(centos) c++ project with make file or script. By one makefile or script install dependency and project executable binary.
my dependency applications libboost-devel,gcc-g++ and pcre. my excuteble binary file is run_excute

Yip sure - put the below commands into a file. At the top of the file add:
#!/bin/bash
Save the file - lets say you call it install; on the command line type:
chmod +x ./install
Then to build and install your program type:
sudo ./install
Alternatively, if you've got some time on your hands:
http://www.rpm.org/max-rpm/ch-rpm-build.html
As an example the basic rpm build process for fedora is:
Step 1: setup your machine to do packaging:
dnf install #development-tools fedora-packager rpmdevtools
rpmdev-setuptree
Step 2: source and Makefile
Place these in ~/rpmbuild/SOURCES
Step 3: Create a spec file
In ~/rpmbuild/SPECS create file called myname.spec. It should contain something like:
Summary: My program description
Name: myname
Version: 0.0.0
Release: 0
License: GPLv2
Group: Applications/Databases
Source: https://xyz.tar.gz
URL: http://myurl
BuildRequires: libicu-devel
BuildRequires: pcre-devel
%description
A couple of lines describing the package
%prep
%setup -q
%build
cd %{myname}/source
make %{?_smp_mflags}
%install
%make_install
%files
%{_bindir}/*
%changelog
* Tue Nov 10 2015 Yours Truly <me#somewhere.com> - 0.0.0-0
- Some change comments
Step 4: create the source and binary rpm
cd ~/rpmbuild/SPECS
rpmbuild -ba myname.spec
Step 5: use the rpm
cd ~/rpmbuild/RPMS/x86_64
rpm -Uvh ./myprogram-version-release.a.whole.lot.of.stuff.rpm

To install the dependencies use yum, so:
sudo yum install libboost-devel
sudo yum group install "Development Tools"
sudo yum install pcre-devel
To build the application, move to the directory with the makefile in it and do:
make
sudo make install
Finally to run the application
./run_excute
or if your lucky
run_excute
will work.

Related

How does one install a specific ocaml compiler when it doesn't appear on the opam switch list?

I've installed this compiler before in a docker container, but I don't understand why it's missing right now. Command and error:
(iit_synthesis) brando9~ $ opam switch create ocaml-variants.4.07.1+flambda_coq-serapi.8.11.0+0.11.1 ocaml-variants.4.07.1+flambda
[ERROR] No compiler matching `ocaml-variants.4.07.1+flambda' found, use `opam switch list-available' to see what is available, or use `--packages' to
select packages explicitly.
but it's not in the list:
(iit_synthesis) brando9~ $ opam switch list-available
# Listing available compilers from repositories: default
# Name # Version # Synopsis
ocaml-option-32bit 1 Set OCaml to be compiled in 32-bit mode for 64-bit Linux and OS X hosts
ocaml-option-flambda 1 Set OCaml to be compiled with flambda activated
ocaml-option-nnpchecker 1 Set OCaml to be compiled with --enable-naked-pointers-checker
ocaml-option-spacetime 1 Set OCaml to be compiled with spacetime activated
ocaml-options-vanilla 1 Ensure that OCaml is compiled with no special options enabled
Opam update fails
Output:
$ opam update --all
<><> Updating package repositories ><><><><><><><><><><><><><><><><><><><><><><>
Processing 1/1: [default: http]
Processing 1/1: [default: http]
[default] synchronised from https://opam.ocaml.org
[ERROR] Could not update repository "default": "~/anaconda/bin/patch -p1 -i /dfs/scratch0/brando9/.opam/log/patch-99014-0624b6" exited with code 2
I probably should have started with this but I installed opam with "manually" with deb because I don't have sudo. In particular I did this:
# - opam (snap, no sudo)
# ref: https://askubuntu.com/questions/339/how-can-i-install-a-package-without-root-access
apt-get download opam
#apt-get download opam_1.2.2-4_amd64
# manually checked the opam name
#ls | less
mkdir -p ~/.local
dpkg -x opam_1.2.2-4_amd64.deb ~/.local/bin
export PATH="$HOME/.local/bin:$PATH"
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc.user
source ~/.bashrc.user
tr ':' '\n' <<< "$PATH"
opam --version
before that I did try installing opam with conda (which has worked in the past) but it failed. I wonder if that screwed things up :/. Will try to reproduce to post the conda error. But I ran conda install -c conda-forge opam.
related:
How to install a specific version of ocaml compiler with opam
https://discuss.ocaml.org/t/why-doesnt-my-server-show-the-ocaml-compiler-that-i-need/10917
https://www.reddit.com/r/ocaml/comments/zed88p/how_does_one_install_a_specific_ocaml_compiler/
How does one install opam without sudo priveledges on linux/ubuntu?

Fixing gcc undefined include<> by manually installing library

I am running the golang command "go get -t github.com/otiai10/gosseract" , causing the error tessbridge.cpp:5:10: fatal error: leptonica/allheaders.h: No such file or directory, #include <leptonica/allheaders.h>. That library is https://github.com/DanBloomberg/leptonica. How do I install it from source so that the gcc command will work.
Before that command was producing the error "gcc not found", but then I followed https://superuser.com/questions/1294343/install-gcc-in-git-for-windows-bash-environment to setup gcc on windows.
I have not been able to find any references for what gcc expects when it encounters an include<>, and where those files should be located on the file system for it to link properly. Is it possible to install this library manually?
Here is much simpler solution for you. There was no need to install gcc on git-bash.
Install MSYS2. Follow complete installation guide.
On MSYS2 console enter the following commands :
pacman -S mingw-w64-x86_64-gcc
pacman -S mingw-w64-x86_64-leptonica
Add C:\msys64\mingw64\bin to PATH.
First step can be further simplified if you use Chocolatey. Just run these commands in elevated powershell : (Ignore first command if choco is already installed.)
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
Reopen elevated powershell and run these:
choco install -y msys2 --params="/InstallDir:C:\msys64"
refreshenv
$env:Path += ";C:\msys64\usr\bin"
pacman -S mingw-w64-x86_64-gcc
pacman -S mingw-w64-x86_64-leptonica
[Environment]::SetEnvironmentVariable("Path", "C:\msys64\mingw64\bin;" + $env:Path, "User")

kaldi python2 binary issue

I am installing kaldi in ubuntu 18.04. python2.7 is one of the dependencies to install kaldi. I have installed python2.7 by sudo apt-get install pytho2.7. Then to check the prerequisites run
extras/check_dependencies.sh. The result showing - "python2.7 is installed, but the python2 binary does not exit. Creating a symlink and adding this to tools/env.sh"
What is the next step to do?
You should add symlink to python2.7 binary:
ln -fs /usr/bin/python2.7 $(KALDI_ROOT)/tools/python/python2
Where $(KALDI_ROOT) is a root directory of Kaldi source code
i just input 'ln -fs /usr/bin/python2.7'

Cannot install Bioperl Moduals

Building BioPerl
Reading skip patterns from 'INSTALL.SKIP'.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
ERROR: Can't create '/usr/local/bin'
Do not have write permissions on '/usr/local/bin'
6. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
I cannot install bioperl on my linux,It happened when I run command 11 below:
7. git clone https://github.com/bioperl/bioperl-live.git
8. cd bioperl-live
9. perl Build.PL
10. ./Build test
11. ./Build install
Do not have write permissions on '/usr/local/bin'
Looks like you need to run the build script as root, so use the 'sudo' command like
sudo ./Build install
On a separate note, is there a specific reason you need to compile Bioperl from source? Using your distro's package manager would be the easiest way to go about getting bioperl running with the least number of headaches. Check out https://bioperl.org/INSTALL.html for a number of options for installing.

How to build dolphin on Ubuntu 14.04.3 LTS (Trusty Tahr)

I am not a Linux pro, but I have a task to modify KDE app "dolphin" for home using (modify address bar navigation mechanism). I think, that it would easy, but still have no understanding how to do this. Days of tries led me to the solution, that I should not build dolphin from dolphin repository (git://anongit.kde.org/dolphin), but from kde-baseapps repo:
sudo apt-get update
sudo apt-get install git-core build-essential libkactivities-dev
sudo apt-get build-dep dolphin
git clone git://anongit.kde.org/kde-baseapps && cd kde-baseapps && mkdir build && cd build && cmake -DCMAKE_INSTALL_PREFIX=`kde4-config --prefix` ..
make -j3
cd dolphin/src/
./dolphin4
Next I think, that I can find source code in "kde-baseapps" folder, but it references to "/usr/include" *.h-files, that references to corresponding *.cpp-files in "kdelibs" package.
That's right, that I should download "kdelibs" sources, modify them and build? That is right way to resolve task or exists a better way to do this?
Yeah, exists a better solution. kdelibs compilation isn't necessary, it is possible to modify only dolphin source code by this bash commands (from ~ dir):
mkdir src
cd src
sudo apt-get update
sudo apt-get build-dep kde-baseapps
apt-get source kde-baseapps
cd kde-baseapps-4.13.3/dolphin/src/
patch < ~/your.patch
cd ../..
mkdir build
cd build
cmake ..
make
sudo make install