Regarding "make install" - makefile

I was installing OpenGV and it is said there that
At least under Linux and OSX, the installation on the host OS (including the headers) can be activated by simply setting INSTALL_OPENGV to ON.
Is this meant for the make install? At least that is how I understand it.
If that is the case, why in the dockerfile of the OpenSfM (this library depends on the OpenGV), it is like this?
# Install opengv from source
RUN \
mkdir -p /source && cd /source && \
git clone https://github.com/paulinus/opengv.git && \
cd /source/opengv && \
mkdir -p build && cd build && \
cmake .. -DBUILD_TESTS=OFF -DBUILD_PYTHON=ON && \
make install && \
cd / && \
rm -rf /source/opengv
The flag for INSTALL_OPENGV is not set to on and yet, it is ok to make install. Looking at the CMakeLists.txt file of the OpenGV, the INSTALL_OPENGV flag is default to OFF.

Judging from CMakeLists.txt, when INSTALL_OPENGV is OFF, only headers are installed.
When the flag is ON, it also installs binaries produced by the opengv target.
CMake's install target is a default target that gets generated even if there are no install() calls in CMakeLists.txt. In that case make install would simply do nothing.

Related

Singularity 3.6.2 Installation

I have problems with installation of singularity 3.6.2 in linux mint, I followed the instructions of https://sylabs.io/guides/3.0/user-guide/installation.html.
I installed the dependencies and Go.
Then I run the command for install the latest version:
export VERSION=3.6.2 && # adjust this as necessary \
mkdir -p $GOPATH/src/github.com/sylabs && \
cd $GOPATH/src/github.com/sylabs && \
wget https://github.com/sylabs/singularity/releases/download/v${VERSION}/singularity-${VERSION}.tar.gz && \
tar -xzf singularity-${VERSION}.tar.gz && \
cd ./singularity && \
./mconfig
The error is:
Configuring for project `singularity' with languages: C, Golang
=> running pre-basechecks project specific checks ...
=> running base system checks ...
checking: host C compiler... cc
checking: host C++ compiler... c++
checking: host Go compiler (at least version 1.13)... not found!
mconfig: could not complete configuration
I have go (go version)
go version go1.15.2 linux/amd64
I don't know what happend!
Thanks so much!
I was struggling with the same error. All the suggestions say that probably you have an older version of Go and that's why. But turned out it's even more important to place Go and Singularity in the right locations.
I found these docs https://github.com/hpcng/singularity/blob/release-3.5/INSTALL.md are the most useful and correct about where to put what in terms of directories.
The key is to clone Singularity in a directory which is GOPATH:
You won't have this directory by default so create it first
$ mkdir -p ${GOPATH}/src/github.com/sylabs && \
cd ${GOPATH}/src/github.com/sylabs && \
git clone https://github.com/sylabs/singularity.git && \
cd singularity
Make sure your singularity is here: {GOPATH}/src/github.com/sylabs/singularity
To summarize:
The Go itself is located here /usr/local/go
GOPATH would be something like home/your_username/go and the singularity will be located inside in e.g. home/your_username/go/src/github.com/sylabs/singularity
The issue was reported in 5099.
# 5320 also mentions:
I deleted the PPO python 3.6 and this worked fine!
Make sure nothing is executed as root, which would have a $PATH different from your current user.
If someone faces this issue, follow this installation guide.
sudo apt-get update && \
sudo apt-get install -y build-essential \
libseccomp-dev pkg-config squashfs-tools cryptsetup
sudo rm -r /usr/local/go
export VERSION=1.13.15 OS=linux ARCH=amd64 # change this as you need
wget -O /tmp/go${VERSION}.${OS}-${ARCH}.tar.gz https://dl.google.com/go/go${VERSION}.${OS}-${ARCH}.tar.gz && \
sudo tar -C /usr/local -xzf /tmp/go${VERSION}.${OS}-${ARCH}.tar.gz
echo 'export GOPATH=${HOME}/go' >> ~/.bashrc && \
echo 'export PATH=/usr/local/go/bin:${PATH}:${GOPATH}/bin' >> ~/.bashrc && \
source ~/.bashrc
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh |
sh -s -- -b $(go env GOPATH)/bin v1.21.0
mkdir -p ${GOPATH}/src/github.com/sylabs && \
cd ${GOPATH}/src/github.com/sylabs && \
git clone https://github.com/sylabs/singularity.git && \
cd singularity
git checkout v3.6.3
cd ${GOPATH}/src/github.com/sylabs/singularity && \
./mconfig && \
cd ./builddir && \
make && \
sudo make install
singularity version

how to enable host compilation but not cross compilation on yocto on certain files

I am trying to build gutenprint 5.2.14 for arm platform using yocto project "devtool". During the compile process, I am getting this error for the file "lt-extract-strings" saying cannot binary execute file: Exec format error
Upon looking at the file, it a 32-bit arm-executable.
OpenWRT says to implement this when doing cross-compilation.
define Build/Compile
# Replace the cross-compiled "extract-string" by a shell-script that
# runs the host's own compiled version (gutenprint needs to run this)
(cd $(PKG_BUILD_DIR) && $(MAKE) -C src/xml extract-strings && \
$(RM) src/xml/extract-strings && \
echo '#!/bin/sh' > src/xml/extract-strings && \
echo 'exec $(HOST_BUILD_DIR)/src/xml/extract-strings "$$$$#" ' \
>> src/xml/extract-strings && chmod +x src/xml/extract-strings && cp src/xml/extract-strings /tmp/)
$(call Build/Compile/Default)
endef
the link to the file is here
I tried looking for sources on how to implement this fix above in a yocto recipe but I had no luck finding it. Can someone help me solve this issue ?
Thanks in advance

Create a static build of GraphicsMagick with all deps included?

I have had a look around Google to see if I can find a static build of GraphicsMagick with all possible filetype support and (ideally) dcraw built in.
Ideally, it would be fully self contained and essentially portable.
I am only really bothered about macOS and Windows (the GraphicsMagick site suggests that the Windows build is already built like that -- though I am unsure about dcraw).
I am a web developer who wants to use this in an Electron app, so I am not sure of the correct terminology , so please forgive any inaccuracies in the ramblings above.
For mac I use following script to create a static version with png, jpg and webp included:
# download sources
curl -L http://ftp.icm.edu.pl/pub/unix/graphics/GraphicsMagick/1.3/GraphicsMagick-1.3.31.tar.gz | tar xvz
# zlib needed for png
curl -L http://ftp.icm.edu.pl/pub/unix/graphics/GraphicsMagick/delegates/zlib-1.2.11.tar.gz | tar xvz
curl -L http://ftp.icm.edu.pl/pub/unix/graphics/GraphicsMagick/delegates/libpng-1.6.28.tar.gz | tar xvz
curl -L http://ftp.icm.edu.pl/pub/unix/graphics/GraphicsMagick/delegates/libwebp-1.0.0.tar.gz | tar xvz
curl -L http://ftp.icm.edu.pl/pub/unix/graphics/GraphicsMagick/delegates/jpegsrc.v6b2.tar.gz | tar xvz
export mydir=$(pwd)
export CPPFLAGS="-I$mydir/include"
export LDFLAGS="-L$mydir/lib"
# use `less zlib-<TAB>/configure` to discover configure options
(cd zlib-* && ./configure --static --prefix=$mydir && make install)
(cd libpng-* && ./configure --disable-shared --prefix=$mydir && make install)
(cd libwebp-* && ./configure --disable-shared --enable-libwebpmux --prefix=$mydir && make install)
(cd jpeg-* && ./configure --disable-shared --prefix=$mydir && make install)
(cd GraphicsMagick-* && ./configure --disable-installed --prefix=$mydir && make install)
./bin/gm version
ldd ./bin/gm
# test
mkdir test && cd test
cp ../jpeg-6b2/testimg.bmp ./test.bmp
../bin/gm convert test.bmp jpg.jpg
../bin/gm convert jpg.jpg jpg.bmp
../bin/gm convert test.bmp png.png
../bin/gm convert png.png png.bmp
../bin/gm convert test.bmp webp.webp
../bin/gm convert webp.webp webp.bmp
You could use that as a start for including further libraries if needed. My use case was also to include it in electron. After trying to crosscompile a static Windows version I came to the conclusion that for the Windows version it would be less maintenance-cost to use the officially provided precompiled multi-file version.

pkg-config: PKG_PROG_PKG_CONFIG: command not found

I get the following error
./configure: line 11162: PKG_PROG_PKG_CONFIG: command not found
when this is code is executed in (kivy-ios/tools-build-sdlmixer.sh)
if [ ! -f libtremor/tremor/.libs/libvorbisidec.a ]; then
try cd libtremor/tremor
echo > asm_arm.h
CC="$ARM_CC" AR="$ARM_AR" \
LDFLAGS="$ARM_LDFLAGS" CFLAGS="$ARM_CFLAGS" \
OGG_CFLAGS="-I../../libogg/include" \
OGG_LDFLAGS="-L../../libogg/src/.libs" \
PKG_CONFIG_LIBDIR="../../libogg" \
ACLOCAL_FLAGS="-I $DESTROOT/share/aclocal -I `aclocal --print-ac-dir`" ./autogen.sh \
--prefix=$DESTROOT \
--disable-shared \
--host=arm-apple-darwin \
--enable-static=yes \
--enable-shared=no
try make
try make install
try cd ../..
fi
My pkg-config application is in my PATH (/usr/local/bin). I've also tried exporting PKG_CONFIG_PATH on my command line to /usr/local/bin/pkg-config and /usr/local/lib/pkgconfig. I've tried exporting LD_LIBRARY_PATH to various paths as well (not sure where it should point to tbh), and that doesn't seem to help either.
I read something about multiple aclocal directories on my system, which could be problematic, but its not clear to me how to resolve that or determine its the issue.
This linux build newbie (on OSX) appreciates any help.
When that script calls autogen.sh, aclocal is failing to find pkg.m4, an M4 macro package that comes with pkg-config and provides the PKG_PROG_PKG_CONFIG macro. Where is pkg-config installed, and what directories is aclocal searching?
Had the same issue with linux Alpine for an DockerImage.
Solved it by installing autoconf, automake and pkgconf:
apk --update add autoconf automake build-base libtool nasm pkgconf

Make install causes recompiles

I am writing a master makefile to compile and install multiple autoconf based libraries, which depend on each other. All works well for the first go. The issue is: if I am working on one of these libraries individually and do "make && make install" header files in the prefix folder are overwritten (even if they are untouched). This causes all dependent libraries to compile from scratch.
Is there a way to avoid the unnecessary recompiles without hacking into the makefiles?
Maybe the solution is a little late, but
./configure INSTALL="install -p"
fixes the recompilation problem. This flag makes GNU install set the timestamps of the installed files to the timestamps of the built files.
You could use sentinel files that exist only to establish your dependency graph. For eg.
prefix := /usr/local
.PHONY: all
all: libx-built
libx-built \
: libx.tar.gz \
; tar xzvf $# \
&& cd libx \
&& ./configure --prefix=$(prefix) \
&& make && make install \
&& touch $#
Then, you'd make a dependent liby build only when libx-built is new.
liby-built \
: liby.tar.gz libx-built \
; ...

Resources