Missing pkg-config results in configure error: possibly undefined macro

This small article is for you who wonder why a configure script under Linux failed with an error like:

configure.ac:204: error: possibly undefined macro: AC_MSG_ERROR
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
configure.ac:216: error: possibly undefined macro: AC_CHECK_LIB
configure.ac:328: error: possibly undefined macro: AC_CHECK_HEADER
autoreconf: /usr/bin/autoconf failed with exit status: 1
 FAILED 

So autoreconf failed with missing macros, but you just saw you had the latest version and no clue what is wrong with the code you tried to compile!
In most cases the problem is trivial – you are missing the

pkg-config

It is a helper tool used when compiling. It helps to have the correct compiler options and not to hard-coded them in your files. So search for this tool in your Linux distro and install it.

Under CentOS 7

yum install pkgconfig

Under Ubuntu/Debian

apt-get install pkg-config

Under Gentoo

emerge -v dev-util/pkgconfig

Install GO language in Ubuntu 16 LTS from the official site package

Ubuntu 16 LTS comes with too old GO language version, the version in the official repository is

golang-1.6.

Many programs released past couple of years depend on go lang 1.7+, so 1.6 in Ubuntu 16 LTS is really obsolete. At present the latest version is 1.9, so we’ll show you simple steps to install the go lang on your ubuntu 16 lts server

STEP 1) Get root if you want to install it globally to be used from any user!

sudo su
cd

STEP 2) Download the GO language binaries from the official site

https://golang.org/dl/

And copy the URL link of the program from the Linux section, now it has the following text:

Linux 2.6.23 or later, Intel 64-bit processor
go1.10.linux-amd64.tar.gz (114MB)

And download it with wget:

wget https://dl.google.com/go/go1.9.4.linux-amd64.tar.gz

STEP 4) Uncompress the file with “tar”

tar xzvf go1.9.4.linux-amd64.tar.gz

STEP 5) Move the files in “/usr/local/go”

you could put the installation anywhere, but most manual installed programs go to “/usr/local”

mv go /usr/local/

STEP 6) Set properly the environment to use your GO 1.9 installation

    • Create file with path and name

      /etc/profile.d/golang.sh

    • Make the file executable with
      chmod 755 /etc/profile.d/golang.sh
      
    • Insert the following line, which will add to the environment PATH your GO executable binaries
[[ -d "/usr/local/go" ]] && export PATH="$PATH:/usr/local/go/bin"

STEP 7) Reload the environment or just log off/in and check if you could execute the GO tool

root@srv.local:~# source /etc/profile
root@srv.local:~# go version
go version go1.9.4 linux/amd64

* Here are all the commands in one place to install the specific version of GO 1.9.4 AMD64, you can use them in a script:

cd
mkdir go-installation
cd ./go-installation
sudo wget https://dl.google.com/go/go1.9.4.linux-amd64.tar.gz
sudo tar xzvf go1.9.4.linux-amd64.tar.gz
sudo mv go /usr/local/
cat <<END | sudo tee /etc/profile.d/golang.sh 1>/dev/null
[[ -d "/usr/local/go" ]] && export PATH="\$PATH:/usr/local/go/bin"
END
sudo chmod 755 /etc/profile.d/golang.sh
source /etc/profile

And do not forget to

source /etc/profile

in your current shell session. It is mandatory for your current shell if you execute the above command from a script!

* This installation of GO Language 1.9 is from the official source the home site of GO Language. There are other easier ways to do it using, for example there are PPA repositories with Ubuntu packages ready to install, but they are not supported by the official GO team! Use them at your own risk as with all other PPA repositories.

Rename gnu screen session name

Ever wonder how you can rename your screen session name? You are in a hurry make a screen session execute some program and then you decide you want to leave the program executing there, but you named the session something not so informative like nothing (and get the default session name like “5026.pts-5.ubuntu” or similar…) or “test”. So there is an easy way of renaming the screen session name with a simple command of

screen -S <old_session_fullname> -X sessionname <new_session_name>

Here is the example for better clarity! Let’s say we have:

[root@srv ~]# screen -ls
There is a screen on:
        24624.test      (Detached)
1 Socket in /var/run/screen/S-root.

And here is the right renaming command. We want to rename the current gnu screen to “loganalyzing”:

screen -S 24624.test -X sessionname loganalyzing

As you can see you should use the fullname taken from the “screen -ls” command, in newer version you can use only the name like:

screen -S test -X sessionname loganalyzing

And here is the result:

[root@srv ~]# screen -ls
There is a screen on:
        24624.loganalyzing      (Detached)
1 Socket in /var/run/screen/S-root.