How to access shell environment variables in Perl script

Question: I would like to access several environment variables in my Perl script. How can I access shell variables from a Perl program? In some cases you may want to access shell environment variables (e.g., $PATH, $PWD, $HOME, $LANG) in your Perl script. While you can pass any needed environment variables to your Perl script […]
Continue reading…

 

How to fix “configure: error: pcre.h not found”

Question:When I try to compile a program, it fails with the following error. How can I fix this error on [insert your Linux distro]? configure: error: pcre.h not found … pcre.h is a development header file for PCRE (Perl Compatible Regular Expressions), which is a C library for pattern-matching regular expressions whose syntax and semantics […]
Continue reading…

 

How to enable and use logging module in Python

Question: I am writing a Python program, and I would like to use Python’s built-in logging facility to debug the program. How can I enable and use the logging module in Python? Logging is an essential debugging feature for any programming and scripting language, which goes beyond simple print statements. For example, logging allows you […]
Continue reading…

 

How to fix “fatal error: ncursesw/ncurses.h: No such file or directory”

Question: When I try to compile a program, it fails with the following error. fatal error: ncursesw/ncurses.h: No such file or directory #include <ncursesw/ncurses.h> How can I fix this error on [insert your Linux distro]? ncursesw/ncurses.h is a development header file for ncursesw, which is source-compatible with ncurses library, but supports wide characters or Unicode […]
Continue reading…

 

How to fix “ImportError: No module named setuptools” on Linux

Question: I was trying to install a Python package using setup.py (“python setup.py install”). However, it failed with the following error message: Traceback (most recent call last): File “setup.py”, line 2, in import setuptools ImportError: No module named ‘setuptools’ How can I fix this error? There are several ways to package, distribute and install Python […]
Continue reading…

 

How to install Node.js on Linux

Question: How can I install Node.js on [insert your Linux distro]? Node.js is a server-side software platform built on Google’s V8 JavaScript engine. Node.js has become a popular choice for building high-performance server-side applications all in JavaScript. What makes Node.js even more attractive for backend server development is the huge ecosystem of Node.js libraries and […]
Continue reading…

 

How to change default Java version on Linux

Question: When I am trying to run a Java program on Linux, I am getting the following error. Looks like the Java program is compiled for a different Java version than the default Java program installed on my Linux. How can I switch the default Java version on Linux? Exception in thread “main” java.lang.UnsupportedClassVersionError: com/xmodulo/hmon/gui/NetConf […]
Continue reading…

 

How to install git on Linux

Question: I am trying to clone a project from a public Git repository, but I am getting “git: command not found” error. How can I install git on [insert your Linux distro]? Git is a popular open-source version control system (VCS) originally developed for Linux environment. Contrary to other VCS tools like CVS or SVN, […]
Continue reading…

 

How to install Go language on Linux

Go (also called “golang”) is an open-source programming language initially developed by Google. It was born with several design principles in mind: simplicity, safety, and speed. The Go language distribution comes with various tools for debugging, testing, profiling and code-vetting. Nowadays the Go language and its tool chain are available in the base repositories of […]
Continue reading…

 

How to check glibc version on Linux

Question: I need to find out the version of the GNU C library (glibc) that I have on my Linux system. How can I check glibc version on Linux? The GNU C library (glibc) is the GNU implementation of the standard C library. glibc is a critical component of the GNU toolchain, which is used […]
Continue reading…

 

How to print “optimized out” value in gdb

Question: I was debugging a program with gdb debugger. When I tried to print the value of a variable while tracing a function call, gdb says “<value optimized out>”, not displaying the value. How can I show the value of an <optimized out> variable in gdb? Modern compilers such as gcc are able to perform […]
Continue reading…

 

How to fix “failed to run aclocal: No such file or directory”

Question: I am trying to build a program on Linux. The development release of the program comes with “autogen.sh” script. When I run it to create configure script, however, I am getting the following error: Can’t exec “aclocal”: No such file or directory at /usr/share/autoconf/Autom4te/FileUtils.pm line 326. autoreconf: failed to run aclocal: No such file […]
Continue reading…

 

How to upgrade Ruby on CentOS

Question: I installed a Ruby package with rubygems on CentOS 6.5. When I attempt to start the Ruby application, it fails to start because my CentOS system does not meet the minimum version requirement of Ruby (1.9 and higher). How can I upgrade Ruby on CentOS? On CentOS 6.5, the default version of Ruby installed […]
Continue reading…

 

How to install RubyGems on Linux

Question: I am trying to install a Ruby application package from RubyGems, but I’m getting the following error when attempting to install a Ruby package. How can I install RubyGems on [insert your Linux distro]? “bash: gem: command not found” RubyGems is a package manager for building, uploading, downloading and installing Ruby packages (also called […]
Continue reading…

 

How to upgrade autoconf on CentOS

Question: I am trying to use autoconf to generate a configuration file on CentOS. However, it fails with the following error. Apparently, the default autoconf on CentOS is not meet the requirement. How can I upgrade autoconf on CentOS? “configure.ac:1: error: Autoconf version 2.69 or higher is required” autoconf is a development tool used to […]
Continue reading…

 

How to fix “failed to run libtoolize: No such file or directory” error

Question: During compilation, I’m getting the following error. How can I fix “libtoolize: No such file or directory” error? Can’t exec “libtoolize”: No such file or directory at /usr/share/autoconf/Autom4te/FileUtils.pm line 345, line 5. autoreconf: failed to run libtoolize: No such file or directory autoreconf: libtoolize is needed because this package uses Libtool The error indicates […]
Continue reading…