EzDev.org

compiling interview questions

Top 15 compiling interview questions

972 Jobs openings for compiling


No acceptable C compiler found in $PATH

I want to install one package named speech_tools-2.1-release.tar.gz. After I run command ./configure in this package, it show me a message:

Configure: error: no acceptable C compiler found in $PATH  
See 'config.log' for more details  

What do I do?


Source: (StackOverflow)

cmake fails with "CMake Error: your CXX compiler: "CMAKE_CXX_COMPILER-NOTFOUND" was not found."

jonquil@jonquil-Satellite-L755D:~/Downloads/akonadi-googledata-1.2.0/build$ cmake ..
-- The C compiler identification is GNU
-- The CXX compiler identification is unknown
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
CMake Error: your CXX compiler: "CMAKE_CXX_COMPILER-NOTFOUND" was not found.   Please set CMAKE_CXX_COMPILER to a valid compiler path or name.
CMake Error at /usr/share/cmake-2.8/Modules/FindKDE4.cmake:98 (MESSAGE):
  ERROR: cmake/modules/FindKDE4Internal.cmake not found in
  /home/jonquil/.kde/share/apps;/usr/share/kubuntu-default-settings/kde4-profile/default/share/apps;/usr/share/kde4/apps
Call Stack (most recent call first):
  CMakeLists.txt:6 (find_package)


CMake Warning (dev) in CMakeLists.txt:
  No cmake_minimum_required command is present.  A line of code such as

    cmake_minimum_required(VERSION 2.8)

  should be added at the top of the file.  The version specified may be lower
  if you wish to support older CMake versions for this project.  For more
  information run "cmake --help-policy CMP0000".
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Configuring incomplete, errors occurred!

With autotools I get this:

jonquil@jonquil-Satellite-L755D:~/Downloads/akonadi-googledata-1.2.0/build/build$ autoreconf -i -f
Can't exec "libtoolize": No such file or directory at /usr/bin/autoreconf line 196.
Use of uninitialized value in pattern match (m//) at /usr/bin/autoreconf line 196.
autoreconf: `configure.ac' or `configure.in' is required

Source: (StackOverflow)

Compile OpenGL Program (Missing GL/gl.h)

I am a complete Linux/Ubuntu noob, so I apologize for any dumb portions of this question or follow up ones.

I am trying to get a program that my software engineering class's group wrote onto my home computer. At school, we have Linux, and it will compile and run fine there. I downloaded VMWare, installed Ubuntu on a virtual machine, and now am trying to get my program to open.

When ever I try to run my make file however, I get an error that says

gcc -I../include -pthread -O1 -c rain.c
In file included from rain.c:19:0:
../include/GL/glfw.h:176:21: fatal error: GL/gl.h: No such file or directory
compilation terminated.
make: *** [rain.o] Error 1

Would anyone happen to know why it can't find this file, when it can on my school computers? And what I'd need to do to download it or get it in the right spot?


Source: (StackOverflow)

What's the Linux equivalent to Windows batch files?

I have a batch file which I use to create an .apk file on my Windows machine. Now I need to be able to create the .apk file in Ubuntu but I don't know how translate my .bat file to a script to be able to run it on Ubuntu.

Below is the batch file which works fine on Windows. Will you please give me some hints on how I can run it on Ubuntu?

@echo off
set PAUSE_ERRORS=0
:user_configuration

:: Path to Flex SDK 
set FLEX_SDK=C:\sdk\flex_sdk_4.5.1.21328

:: Path to Android SDK
set ANDROID_SDK=C:\sdk\android

:validation
if not exist "%FLEX_SDK%\bin" goto flexsdk
if not exist "%ANDROID_SDK%\platform-tools" goto androidsdk
goto succeed

:validation
if not exist "%FLEX_SDK%\bin" goto flexsdk
if not exist "%ANDROID_SDK%\platform-tools" goto androidsdk
goto succeed

:flexsdk
echo.
echo ERROR: incorrect path to Flex SDK
echo.
if %PAUSE_ERRORS%==1 pause
exit

:androidsdk
echo.
echo ERROR: incorrect path to Android SDK in 'bat\SetupSDK.bat'
echo.

if %PAUSE_ERRORS%==1 pause
exit

:succeed
set PATH=%PATH%;%FLEX_SDK%\bin
set PATH=%PATH%;%ANDROID_SDK%\platform-tools

:: Android packaging
set AND_CERT_NAME="PeymanApp"
set AND_CERT_PASS=fd
set AND_CERT_FILE=cert\SampleApp.p12
set AND_ICONS=icons/android

set AND_SIGNING_OPTIONS=-storetype pkcs12 -keystore "%AND_CERT_FILE%" -storepass     %AND_CERT_PASS%

:: Application descriptor
set APP_XML=application.xml

:: Files to package
set APP_DIR=bin
set FILE_OR_DIR=-C %APP_DIR% .

:: Your application ID (must match <id> of Application descriptor)
set APP_ID=air.com.doitflash.SampleApp

:: Output packages
set DIST_PATH=dist
set DIST_NAME=PeymanApp

:validation
%SystemRoot%\System32\find /C "<id>%APP_ID%</id>" "%APP_XML%" > NUL
if errorlevel 1 goto badid
goto end_validation

:badid
echo.
echo ERROR: Application ID (APP_ID) does NOT match Application descriptor '%APP_XML%'     (id)

echo.

:end_validation

set TARGET=
set PLATFORM=android

::call bat\Packager.bat
if "%PLATFORM%"=="android" goto android-config

:android-config
set CERT_FILE=%AND_CERT_FILE%
set SIGNING_OPTIONS=%AND_SIGNING_OPTIONS%
set ICONS=%AND_ICONS%
set DIST_EXT=apk
set TYPE=apk
goto start

:start
if not exist "%CERT_FILE%" goto certificate
:: Output file
set FILE_OR_DIR=%FILE_OR_DIR% -C "%ICONS%" .
if not exist "%DIST_PATH%" md "%DIST_PATH%"
set OUTPUT=%DIST_PATH%\%DIST_NAME%%TARGET%.%DIST_EXT%
:: Package

echo true
echo.
call adt -package -target %TYPE%%TARGET% %OPTIONS% %SIGNING_OPTIONS% "%OUTPUT%"     "%APP_XML%" %FILE_OR_DIR% -extdir lib/
echo.
if errorlevel 1 goto failed
goto end

:certificate
echo Certificate not found: %CERT_FILE%
echo.

if %PAUSE_ERRORS%==1 pause
exit

:failed
echo APK setup creation FAILED.

if %PAUSE_ERRORS%==1 pause
exit

:end

Source: (StackOverflow)

How to properly update / install / compile ibus on 14.04, dconf problems?

I updated recently to phpstorm 9.5 and it says I should update ibus to 1.5.11 or newer (which at this point the current one).

Ok. I downloaded 1.5.11 from source and try to install it. I got some dependencies solved, but at one point I have a strange configuration error, that Package requirements (dconf >= 0.7.5) were not met.

after installing dconf-tools and other parts of the dconf package I still get this massage. Than I did sudo apt-cache show dconf-tools and found in the output that libdconf0 (<< 0.7.3-2) is causing problems, as libdconf1 is 0.20.0-1 which seems to be newer.

Assuming that on 14.04 libconfd0 is not used anymore this information is obsolete for the compiling ibus.

How can I solve this?

Edit 1:

  • installed dconf-tools, dconf-cli, dconf-editor as dconf package is not present in the packages.
  • checked the /etc directory there is dconf related stuff there
  • checked ibus/configure mechanism for dconf:

    if test x"$enable_dconf" = x"yes"; then
        # check dconf
        PKG_CHECK_MODULES(DCONF,
            [dconf >= 0.7.5],
        )
        PKG_CHECK_EXISTS([dconf >= 0.13.4],
            [AC_DEFINE(DCONF_0_13_4, TRUE, [dconf is 0.13.4 or later])],
            [])
        # check glib-compile-schemas
        GLIB_GSETTINGS
        enable_dconf="yes (enabled, use --disable-dconf to disable)"
    fi
    

Edit 2:

libdconf0 was misleading


Source: (StackOverflow)

How to solve configure: error: readline library not found?

I have an Ubuntu 10.04 LTS server with a minimal install that I want to compile postgres on. With the minimal install the server did not have gcc so I had to do an apt-get install gcc but now I keep getting this error from the postgres ./configure.

configure: error: readline library not found

I can't seem to find the name of the package that contains the readline library. So I have two questions.

  1. What is the name of the package that contains readline?
  2. Is there some way given the error message above for me to find the associated package from its standard name?

Source: (StackOverflow)

How to build all my installed package from sources?

I've read about how source-based linux distros like Gentoo can have considerable performance increases when compared to pre-built distros like Ubuntu because they install from source with optimizations for your particular system. Is is possible to build Ubuntu from source to get the same kind of benefit?


Source: (StackOverflow)

Cross-Compile for ARM?

How do I set up GCC for cross compiling for the ARM processor? The host would be on x68 ( AMD64 - Ubuntu 12.04 ) and the target would be ARM ( Raspberry Pi as well as Pandaboard - will do separate compilations for each )?


Source: (StackOverflow)

Type of code conversion used in Linux executable files

I want to ask that what type of encoding is used to make linux executable files e.g. hexadecemal, binary or anything else. how is it converted ? Is there any way to get back the original code from this executable file?

Here's a bit of code I have:

ELF���������>�����%|�����@�������������������@�8��@���������������������@�������@�����7<�����7<������� ������������������f�����f���������������������� ������[�UPX!L
h�h�8����������?�E�h=��ڊ̓�N�    4���9ISloB�q�w�]ȉ.��,ς��Q䝦����#e��-�N����/�b,���d<��'��-E��6E�s�/�U���ly�V�Y2]"a��S�.�hU�|�S�J�I�2���X}
�G0�;���5d�$���.)

what is it suppose to mean?


Source: (StackOverflow)

How do I set up ccache?

I want to use ccache to speed up compilation. I came across how do I enable ccache

This is what I have done so far:

$ sudo apt-get install -y ccache
$ dpkg -l ccache
ii  ccache  3.1.6-1   Compiler cache for fast recompilation of C/C++ code
$ whereis ccache
ccache: /usr/bin/ccache /usr/lib/ccache /usr/bin/X11/ccache /usr/share/man/man1/ccache.1.gz

I appended ccache to path by adding to my ~/.bashrc

$ export PATH="/usr/lib/ccache:$PATH"
$ source ~/.bashrc
$ echo $PATH 
/usr/lib/ccache:/usr/local/cuda-5.5/bin/:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

The symbolic links looks fine:

$ ll /usr/lib/ccache/
total 76
drwxr-xr-x   2 root root  4096 mai   22 10:48 ./
drwxr-xr-x 253 root root 69632 mai   22 10:48 ../
lrwxrwxrwx   1 root root    16 mai   22 10:48 avr-g++ -> ../../bin/ccache*
lrwxrwxrwx   1 root root    16 mai   22 10:48 avr-gcc -> ../../bin/ccache*
lrwxrwxrwx   1 root root    16 mai   22 10:48 avr-gcc-4.5.3 -> ../../bin/ccache*
lrwxrwxrwx   1 root root    16 mai   22 10:48 c++ -> ../../bin/ccache*
lrwxrwxrwx   1 root root    16 mai   22 10:48 c89-gcc -> ../../bin/ccache*
lrwxrwxrwx   1 root root    16 mai   22 10:48 c99-gcc -> ../../bin/ccache*
lrwxrwxrwx   1 root root    16 mai   22 10:48 cc -> ../../bin/ccache*
lrwxrwxrwx   1 root root    16 mai   22 10:48 g++ -> ../../bin/ccache*
lrwxrwxrwx   1 root root    16 mai   22 10:48 g++-4.6 -> ../../bin/ccache*
lrwxrwxrwx   1 root root    16 mai   22 10:48 gcc -> ../../bin/ccache*
lrwxrwxrwx   1 root root    16 mai   22 10:48 gcc-4.6 -> ../../bin/ccache*
lrwxrwxrwx   1 root root    16 mai   22 10:48 x86_64-linux-gnu-g++ -> ../../bin/ccache*
lrwxrwxrwx   1 root root    16 mai   22 10:48 x86_64-linux-gnu-g++-4.6 -> ../../bin/ccache*
lrwxrwxrwx   1 root root    16 mai   22 10:48 x86_64-linux-gnu-gcc -> ../../bin/ccache*
lrwxrwxrwx   1 root root    16 mai   22 10:48 x86_64-linux-gnu-gcc-4.6 -> ../../bin/ccache*

The link looks good:

$ which g++
/usr/lib/ccache/g++

$ make
g++ -o affine_euler affine_euler.cpp -O3 -DEIGEN_NO_DEBUG -I/usr/include/eigen3
g++ -o test_eigen test_eigen.cpp -O3 -DEIGEN_NO_DEBUG -I/usr/include/eigen3

But the cache is empty:

$ ccache -s
cache directory                     /home/dell/.ccache
cache hit (direct)                     0
cache hit (preprocessed)               0
cache miss                             0
files in cache                         0
cache size                             0 Kbytes
max cache size                       1.0 Gbytes

Where am I wrong ?


Source: (StackOverflow)

Installing packages into local directory?

I'd like to install software packages, similar to apt-get install <foo> but:

  1. Without sudo, and
  2. Into a local directory

The purpose of this exercise is to isolate independent builds in my continuous integration server.

I don't mind compiling from source, if that's what it takes, but obviously I'd prefer the simplest approach possible. I tried apt-get source --compile <foo> as mentioned here but I can't get it working for packages like autoconf. I get the following error:

dpkg-checkbuilddeps: Unmet build dependencies: help2man

I've got help2man compiled in a local directory, but I don't know how to inform apt-get of that. Any ideas?

UPDATE: I found an answer that almost works at http://askubuntu.com/a/350/23678. The problem with chroot is that it requires sudo. The problem with apt-get source is that I don't know how to resolve dependencies. I must say, chroot looks very appealing. Is there an equivalent command that doesn't require sudo?


Source: (StackOverflow)

How to compile C++ source code ("iostream.h not found" error)?

I do not want to discuss about C++ or any programming language!I just want to know what am i doing wrong with linux ubuntu about compiling helloworld.cpp!

I am learning C++ so my steps are:

open hello.cpp in vim and write this

#include <iostream.h>
int main()
{
    cout << "Hello World!\n";`
    return 0;
}

So, after that i tried in the terminal this

g++ hello.cpp

AND the output is

hello.cpp:1:22: fatal error: iostream.h: No such file or directory
compilation terminated.

What do you suggest? Any useful step by step guide for me?Thanks!


Source: (StackOverflow)

What are the packages/libraries I should install before compiling Python from source?

Once in a while I need to install a new Ubuntu (I used it both for desktop and servers) and I always forget a couple of libraries I should have installed before compiling, meaning I have to recompile, and it's getting annoying.

So now I want to make a complete list of all library packages to install before compiling Python (and preferably how optional they are).

This is the list I compiled with below help and by digging in setup.py. It is complete for Ubuntu 10.04 and 11.04 at least:

build-essential (obviously)
libz-dev        (also pretty common and essential)
libreadline-dev (or the Python prompt is crap)
libncursesw5-dev
libssl-dev
libgdbm-dev
libsqlite3-dev
libbz2-dev

For Python 3.2 and later:

liblzma-dev

More optional:

tk-dev
libdb-dev

Ubuntu has no packages for v1.8.5 of the Berkeley database, nor (for obvious reasons) the Sun audio hardware, so the bsddb185 and sunaudiodev modules will still not be built on Ubuntu, but all other modules are built with the above packages installed.

UPDATE

There are in Ubuntu 14.04 even more patches needed for Python 2.6, and 2.7 etc. I would recommend to instead checkout pyenv. It contains a script python-build (located in plugins/python-build/bin). With it you can install arbitrary Python versions like this:

$ ./python-build 2.7.8 /opt/python27

Where 2.7.8 is the version and /opt/python27 is the path it will be installed. Pyenv will download the Python version, apply the necessary patches and configure; make; make install for you.

END UPDATE

Python 2.5 and Python 2.6 also needs to have LDFLAGS set on Ubuntu 11.04 and later, to handle the new multi-arch layout:

export LDFLAGS="-L/usr/lib/$(dpkg-architecture -qDEB_HOST_MULTIARCH)"

For Python 2.6, 2.7 and 3.0 you also need to explicitly enable SSL after running the ./configure script and before running make. In Modules/Setup there are lines like this:

#SSL=/usr/local/ssl
#_ssl _ssl.c \
#       -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
#       -L$(SSL)/lib -lssl -lcrypto

Uncomment these lines and change the SSL variable to /usr:

SSL=/usr
_ssl _ssl.c \
       -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
       -L$(SSL)/lib -lssl -lcrypto

Python 2.6 and 3.0 also needs Modules/_ssl.c modified to be used with OpenSSL 1.0, which is used in Ubuntu 11.10. At around line 300 you'll find this:

    else if (proto_version == PY_SSL_VERSION_SSL3)
        self->ctx = SSL_CTX_new(SSLv3_method()); /* Set up context */
    else if (proto_version == PY_SSL_VERSION_SSL2)
        self->ctx = SSL_CTX_new(SSLv2_method()); /* Set up context */
    else if (proto_version == PY_SSL_VERSION_SSL23)
        self->ctx = SSL_CTX_new(SSLv23_method()); /* Set up context */

Change that into:

    else if (proto_version == PY_SSL_VERSION_SSL3)
        self->ctx = SSL_CTX_new(SSLv3_method()); /* Set up context */
#ifndef OPENSSL_NO_SSL2
    else if (proto_version == PY_SSL_VERSION_SSL2)
        self->ctx = SSL_CTX_new(SSLv2_method()); /* Set up context */
#endif
    else if (proto_version == PY_SSL_VERSION_SSL23)
        self->ctx = SSL_CTX_new(SSLv23_method()); /* Set up context */

This disables SSL_v2 support, which apparently is gone in OpenSSL1.0.

Python 2.4 (yes, I still have some old projects that need 2.4) needs this patch to setup.py:

--- setup.py    2006-10-08 19:41:25.000000000 +0200
+++ setup.py        2012-05-08 14:02:14.325174357 +0200
@@ -269,6 +269,7 @@
         lib_dirs = self.compiler.library_dirs + [
             '/lib64', '/usr/lib64',
             '/lib', '/usr/lib',
+           '/usr/lib/x86_64-linux-gnu'
             ]
         inc_dirs = self.compiler.include_dirs + ['/usr/include']
         exts = []
@@ -496,7 +497,8 @@
                 ssl_incs += krb5_h
         ssl_libs = find_library_file(self.compiler, 'ssl',lib_dirs,
                                      ['/usr/local/ssl/lib',
-                                      '/usr/contrib/ssl/lib/'
+                                      '/usr/contrib/ssl/lib/',
+                                     'x86_64-linux-gnu'
                                      ] )

         if (ssl_incs is not None and

And it needs to be compiled with:

env CPPFLAGS="-I/usr/lib/x86_64-linux-gnu" LDFLAGS="-L/usr/include/x86_64-linux-gnu"  ./configure --prefix=/opt/python2.4

Source: (StackOverflow)

What's a simple way to recompile the kernel?

I'm interested in compiling a new kernel under Ubuntu 12.04 x86 64 bit.

I found this wiki page which is basically a mirror for this blog and there are a lot of steps (git, etc.) that appear useless to me.

With earlier releases/distros, I used to create a .config file and modify a Makefile if I needed to, then just run make and it's done.

Is there is a simple way to do this under Ubuntu?


Source: (StackOverflow)

How do I install the latest version of node.js?

How do I install node.js in Ubuntu? I've been looking around, and I can't find anything. Is there a Ubuntu package for node.js, or do I have to compile it myself?


Source: (StackOverflow)