EzDevInfo.com

compile interview questions

Top compile frequently asked interview questions

Compiling the Linux kernel

Just for the learning experience, I have recompiled the Linux kernel with different options, installed and booted from it. It was both instructive and straightforward. However, I was overwhelmed by the large number of options available.

My questions are:

  1. Does it make sense to spend time trying to optimize the Linux kernel for my particular laptop? Will it make a significant improvement?
  2. Are there any tools that can read the configuration of my computer and suggest a config?

Source: (StackOverflow)

What language are compilers written with?

Are compilers written in different languages than the language they compile?


Source: (StackOverflow)

Advertisements

How was the first compiler compiled?

This has always racked my brain. Compilers compile code. I imagine that the compiler is coded. So to actually run the code for a compiler, you'd have to compile it.

How was the first compiler compiled?


Source: (StackOverflow)

How to list imported symbols in ELF executable?

For PE executable, I can list the imported symbols using

dumpbin /imports FILE.EXE

or using the depends utility which is GUI application.

`nm ELF-binary' just returns "no symbols".


Source: (StackOverflow)

Compiling FFMPEG for ARM

I have a Linux ARM computer (BeagleBone Black). I am trying to do some camera streaming and need FFMPEG to do it. I have tried everything that I can think of (including following guides for compiling it in general), but have failed to compile FFMPEG (for ARM) without fatal errors.

Does anyone know how to compile FFMPEG for an ARMv7 processor?


Source: (StackOverflow)

Compile gvim from sources?

Recently, I've installed vim like so:

hg clone https://vim.googlecode.com/hg/ vim
cd vim
sudo ./configure --enable-rubyinterp=yes --enable-pythoninterp=yes --enable-gui=gtk2 --prefix=/opt/vim
make 
make install
make install clean

So, my VIM's binaries now live under /opt/vim/bin. Here is ls -la of this dir:

$ ls -la /opt/vim/bin
total 1500
drwxr-xr-x 2 root root    4096 2011-05-25 12:46 .
drwxr-xr-x 4 root root    4096 2011-05-25 12:46 ..
lrwxrwxrwx 1 root root       3 2011-05-25 12:46 ex -> vim
lrwxrwxrwx 1 root root       3 2011-05-25 12:46 rview -> vim
lrwxrwxrwx 1 root root       3 2011-05-25 12:46 rvim -> vim
lrwxrwxrwx 1 root root       3 2011-05-25 12:46 view -> vim
-rwxr-xr-x 1 root root 1504188 2011-05-25 12:46 vim
lrwxrwxrwx 1 root root       3 2011-05-25 12:46 vimdiff -> vim
-rwxr-xr-x 1 root root    2084 2011-05-25 12:46 vimtutor
-rwxr-xr-x 1 root root   13900 2011-05-25 12:46 xxd

Where is my vim.gtk? I specified --enable-gui=gtk2 in configure. Shouldn't it say the installer I want a GUI version as well as console application?

I specified gtk version correctly:

$ dpkg -l libgtk[0-9]* | grep ^i
ii  libgtk2-perl                          1:1.221-4                                  Perl interface to the 2.x series of the Gimp Toolkit library
ii  libgtk2.0-0                           2.18.3-1ubuntu2.2                          The GTK+ graphical user interface library
ii  libgtk2.0-bin                         2.18.3-1ubuntu2.2                          The programs for the GTK+ graphical user interface library
ii  libgtk2.0-common                      2.18.3-1ubuntu2.2                          Common files for the GTK+ graphical user interface library

UPDATE: It is written on src/INSTALL

 88 Unix: COMPILING WITH/WITHOUT GUI
 89
 90 NOTE: This is incomplete, look in Makefile for more info.
 91
 92 These configure arguments can be used to select which GUI to use:
 93 --enable-gui=gtk      or: gtk2, motif, athena or auto
 94 --disable-gtk-check
 95 --disable-motif-check
 96 --disable-athena-check
 97
 98 --enable-gui defaults to "auto", so it will automatically look for a GUI (in
 99 the order of GTK, Motif, then Athena).  If one is found, then is uses it and
100 does not proceed to check any of the remaining ones.  Otherwise, it moves on
101 to the next one.

So I tried not to specify --enable-gui hoping it will find which GUI engine/toolkit to use on its own... Still the same result :(

UPDATE: Furthermore:

/opt/vim/bin$ ./vim -g
E25: GUI cannot be used: Not enabled at compile time

UPDATE:

Do I need ALL of this:

$ sudo aptitude search gtk | grep dev
p   gnunet-gtk-dev                  - secure, trust-based peer-to-peer framework
v   gtkgl-dev                       -                                           
p   gtkparasite                     - GTK+ debugging and development tool       
p   libaiksaurusgtk-1.2-dev         - graphical interface to the Aiksaurus toolk
v   libaiksaurusgtk-dev             -                                           
p   libcanberra-gtk-dev             - a simple abstract interface for playing ev
p   libchamplain-gtk-0.4-dev        - A Gtk+ widget to display maps (development
p   libclutter-gtk-0.10-dev         - Open GL based interactive canvas library G
p   libdbusmenu-gtk-dev             - Menus over DBus shared library for GTK    
p   libempathy-gtk-dev              - High-level library and user-interface for 
v   libequeue-gtk2-ocaml-dev        -                                           
p   libexif-gtk-dev                 - Library providing GTK+ widgets to display/
p   libgalago-gtk-dev               - libraries and header files for developing 
p   libgdu-gtk-dev                  - GTK+ standard dialog library for libgdu - 
p   libggadget-gtk-1.0-dev          - Google Gadgets GTK+ development files     
p   libggz-gtk-dev                  - GGZ Gaming Zone: core client embedding lib
p   libghc6-gtk-dev                 - A GUI library for Haskell (Gtk2Hs) -- GTK+
p   libghc6-gtkglext-dev            - A GUI library for Haskell (Gtk2Hs) -- gtkg
p   libghc6-gtksourceview2-dev      - A GUI library for Haskell (Gtk2Hs) -- GtkS
p   libghc6-soegtk-dev              - A GUI library for Haskell (Gtk2Hs) -- soeg
p   libglrr-gtk-dev                 - Development library of Grift (gtk)        
p   libgpod-nogtk-dev               - development files for libgpod (version wit
p   libgtk-directfb-2.0-dev         - Development files for the GTK+ library - D
p   libgtk-vnc-1.0-dev              - A VNC viewer widget for GTK+ (development
i   libgtk2.0-dev                   - Development files for the GTK+ library
p   libgtkada2-dev                  - Development files for libgtkada2
p   libgtkdatabox-0.9.0-1-dev       - A Gtk+ library to display large amounts of
v   libgtkdatabox-dev               -
p   libgtkextra-x11-2.0-dev         - A useful set of widgets for GTK+ (developm
p   libgtkgl2.0-dev                 - OpenGL area for GTK (development files)
p   libgtkglext1-dev                - OpenGL Extension to GTK+ (development file
p   libgtkglextmm-x11-1.2-dev       - C++ bindings for GtkGLExt (Development fil
p   libgtkhex0-dev                  - GNOME Hex editor for files (development he
p   libgtkhtml-editor-dev           - HTML rendering/editing library - editor wi
p   libgtkhtml2-dev                 - HTML rendering/editing library - developme
p   libgtkhtml3.14-dev              - HTML rendering/editing library - developme
p   libgtkhtml3.8-dev               - HTML rendering/editing library - developme
p   libgtkimageview-dev             - image viewer widget for GTK+ (development
p   libgtkmathview-dev              - rendering engine for MathML documents
p   libgtkmm-2.4-dev                - C++ wrappers for GTK+ 2.4 (development fil
p   libgtkmm-utils-dev              - utility functions, classes and widgets wri
p   libgtksourceview-dev            - development files for the GTK+ syntax high
p   libgtksourceview2.0-dev         - development files for the GTK+ syntax high
p   libgtksourceviewmm-1.0-dev      - C++ binding of GtkSourceView - development
p   libgtksourceviewmm-2.0-dev      - C++ binding of GtkSourceView - development
p   libgtkspell-dev                 - Development files for GtkSpell
p   libindicate-gtk-dev             - GNOME panel indicator applet - shared libr
p   libjana-gtk-dev                 - A set of GTK+ widgets to visualise libjana
p   liblablgtk2-gl-ocaml-dev        - OCaml bindings to GtkGL
p   liblablgtk2-gnome-ocaml-dev     - OCaml bindings to GNOME
p   liblablgtk2-ocaml-dev           - OCaml bindings to Gtk+ version 2
p   liblablgtkmathview-ocaml-dev    - OCaml bindings for libgtkmathview, a GTK w
p   liblablgtksourceview-ocaml-dev  - OCaml bindings for libgtksourceview, a sou
v   libnotify-dev-gtk2.10           -
p   libocamlnet-gtk2-ocaml-dev      - OCaml application-level Internet libraries
p   libpolkit-gtk-1-dev             - PolicyKit GTK+ API - development files
v   libsylpheed-claws-gtk2-dev      -
p   libtinymailui-gtk-dev           - Framework for mobile applications with e-m
p   libtinymailui-gtkhtml-dev       - Framework for mobile applications with e-m
p   libtracker-gtk-dev              - GTK+ widgets for apps that use tracker - d
v   libunicapgtk-dev                -
p   libunicapgtk2-dev               - graphical widgets for unicap - development
p   libwxgtk2.6-dev                 - wxWidgets Cross-platform C++ GUI toolkit (
p   libwxgtk2.8-dev                 - wxWidgets Cross-platform C++ GUI toolkit (
p   libzbargtk-dev                  - scanning and decoding bar codes (GTK+ bind
p   python-galago-gtk-dev           - Galago presence library (Python interface)
p   python-gtk2-dev                 - GTK+ bindings: devel files
p   telepathy-devel-gtk             - Telepathy Development packages for GTK

Looks like most of ths packages I don't need. E.g. Frameworks for mobile apps, ... HTML renderers, etc. The one I've installed is libgtk2.0-dev... Still, I can't compile gVIM.... Agrhhhhh


Source: (StackOverflow)

Compiling the Linux kernel, how much size is needed?

I have downloaded the newest most stable Linux kernel, 2.6.33.2.

I thought I would test this using VirtualBox. So I create a dynamically sized harddisk of 4 GB. And installed CentOS 5.3 with just the minimum packages.

I setup the make menuconfig with just the default settings.

After that I ran make and got the following error:

net/bluetooth/hci_sysfs.o: final close failed: No space left on device
make[2]: *** [net/bluetooth/hci_sysfs.o] Error 1
make[1]: *** [net/bluetooth] Error 2
make: *** [net] Error 2

The amount of space I have left is:

# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                      3.3G  3.3G     0 100% /
/dev/hda1              99M   12M   82M  13% /boot
tmpfs                 125M     0  125M   0% /dev/shm

My virtual size is 4 GB, but the actual size is 3.5 GB.

$ ls -hl
total 7.5G
-rw-------. 1 root root 3.5G 2010-04-13 14:08 LFS.vdi

How much size should I give when compiling and installing a Linux kernel? Are there any guidelines to follow when doing this? This is my first time, so just experimenting with this.


Source: (StackOverflow)

Which PC components make the biggest impact on your compile times for Visual Studio?

Which PC specifications have the biggest impact on your compile times? Disk? Clock speed? Number of CPU cores?


Source: (StackOverflow)

Errors compiling Firefox on Debian

I want compile Firefox on Debian so I create .mozconfig like:

mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/ff-dbg
ac_add_options --enable-application=browser

...and now use this command to compile ( create make ):

 ./configure 

...but I get this error:

configure: error: Library requirements (libnotify >= 0.4) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.

...so search in repo:

i   libnotify-bin                  - sends desktop notifications to a notifica
i A libnotify0.4-cil               - CLI library for desktop notifications    
i A libnotify1                     - sends desktop notifications to a notifica
v   libnotify1-gtk2.10             -            

What can I do to get this compiled?


Source: (StackOverflow)

segfaults while compiling VLC on low memory system

I'm trying to compile VLC from this GitHub repo on my Allwinner device (ARM Cortex-A8 NEON with armhf kernel and about 380 MB of RAM) using instructions provided here.

I keep getting segfaults, so I created a swap partition like this:

 root@lianro:~/# dd if=/dev/zero of=/swap bs=1M count=1024
 root@linaro:~/# mkswap -c /swap
 root@linaro:~/# swapon /swap

It got better; instead of breaking randomly after about one minute it breaks randomly after a long time, last time it almost finished but I got a segfault on one of the last modules.

Swap doesn't seem to be used at all at any point during the compilation. I have plenty of disk space free.

What can be the problem?


Source: (StackOverflow)

How to remove a package I compiled and installed manually?

I recently compiled and installed Git on a new install of Mac OS 10.6 but it didn't install the documentation.

I now realize I should've used the precompiled package offered here: http://code.google.com/p/git-osx-installer/downloads/list

How do I remove all the files that I added to my system using make install with the Git source code?

Edit: I've had similar problems in the past with other packages, too. For example, ./configure with the incorrect --prefix= or something. What's the general practice for removing unix packages?


Source: (StackOverflow)

Compiling PHP on OS X: iconv works only if forced to 64-bit

I'm trying to compile PHP and I kept getting this error during make:

Undefined symbols for architecture x86_64:
  "_iconv_open", referenced from:
      __php_iconv_mime_decode in iconv.o
      __php_iconv_strlen in iconv.o
      _php_iconv_string in iconv.o
      __php_iconv_strpos in iconv.o
      _zif_iconv_substr in iconv.o
      _zif_iconv_mime_encode in iconv.o
      _php_iconv_stream_filter_factory_create in iconv.o
      ...
  "_iconv_close", referenced from:
      __php_iconv_mime_decode in iconv.o
      __php_iconv_strlen in iconv.o
      _php_iconv_string in iconv.o
      __php_iconv_strpos in iconv.o
      _zif_iconv_substr in iconv.o
      _zif_iconv_mime_encode in iconv.o
      _php_iconv_stream_filter_dtor in iconv.o
      ...
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status

The ./configure command of PHP has the iconv folder pointing to /opt/local, so the macport iconv library is used (which is installed using the the +universal flag). Doing file I get:

/opt/local/lib/libiconv.dylib: Mach-O universal binary with 2 architectures
/opt/local/lib/libiconv.dylib (for architecture i386):  Mach-O dynamically linked shared library i386
/opt/local/lib/libiconv.dylib (for architecture x86_64):    Mach-O 64-bit dynamically linked shared library x86_64

I tried then install the iconv library manually, forcing only the 64-bit architecture (I installed it in /usr/local) and it works. The output of file is:

/usr/local/lib/libiconv.dylib: Mach-O 64-bit dynamically linked shared library x86_64

Why is this happening? I manage to build and make PHP work with the manual installation, but I don't understand.


Source: (StackOverflow)

Is it possible to run an x86 binary on an ARM processor?

Is it possible to convert/recompile an already compiled x86 binary into an ARM binary?

I'm using a BeagleBoard with a command-line Ubuntu (Maverick) and want to run a Ventrilo server but the x86 executable they supply cannot be run on the hardware as far as I can tell (most likely due to differing architecture).

Unfortunately I don't have access to the source to allow me to recompile it natively.

If not, is there any other way I can get the binary to run (emulation for example)?


Source: (StackOverflow)

Compiling PHP 7 with mssql support

So I'm trying to switch to PHP 7. Unfortunately I'm in need to connect to an MSSQL Server so I'll need the dblib driver for pdo. With PHP5 you could ust the php5-sybase Package.

So I tried to do it manually following this "Guide". freetds compiled as aspected but PHP said WARNING: unrecognized options: --with-sybase

On an other Website i found simply adding --with-mssql should work, but also failed.

Anyone having any hints or solutions for me?


Source: (StackOverflow)

Python ./configure does not find g++ compiler

I'm trying to compile Python 3.4.1 on an emulated ARM machine (with Debian 7). ./configure gives me

checking for g++... no

but g++ is installed. So what could be the problem? I know it's not strictly needed, but I'd prefer that make will use g++ for c++ code.


Source: (StackOverflow)