Finding the package that contains a particular file in Ubuntu

It often happens that a file is missing during compilation and you get this kind of error: In file included from media/audio/linux/audio_manager_linux.cc:15:0: ./media/audio/linux/alsa_input.h:8:28: fatal error: alsa/asoundlib.h: No such file or directory compilation terminated. In file included from media/audio/linux/alsa_input.cc:5:0: ./media/audio/linux/alsa_input.h:8:28: fatal error: alsa/asoundlib.h: No such file or directory compilation terminated. That usually means a development package is missing. Sometime you can just guess the name of the package or you can use aptitude to find the file. There is also another (better) method in Ubuntu: apt-file utility allows you to find the package corresponding to a particular file. First install apt-file sudo apt-get install apt-file Them the first time, you need to download the files with the data for your system apt-file update Finally, you can use apt-file to find the package. For example with alsa/asoundlib.h apt-file search alsa/asoundlib.h libasound2-dev: /usr/include/alsa/asoundlib.h   Jean-Luc Aufranc (CNXSoft)Jean-Luc started CNX Software in 2010 as […]

Get CFLAGS for a Package with pkg-config

As I tried to cross-compile an application that required glibconfig.h, I found a way to retrieve the CFLAGS for a given package. Here’s the output for glib-2.0 and gtk-2.0 in qemu for overo: pkg-config –cflags glib-2.0 -I/usr/include/glib-2.0 -I/usr/lib/arm-linux-gnueabi/glib-2.0/include pkg-config –cflags gdk-2.0 -pthread -I/usr/include/gio-unix-2.0/ -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/arm-linux-gnueabi/glib-2.0/include -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pixman-1 Finally, I found out that glibconfig,h was in /usr/lib/arm-linux-gnueabi/glib-2.0/include as this file is generated by configure and is platform dependent. Jean-Luc Aufranc (CNXSoft)Jean-Luc started CNX Software in 2010 as a part-time endeavor, before quitting his job as a software engineering manager, and starting to write daily news, and reviews full time later in 2011. www.cnx-software.com

Finding a Missing Package in Ubuntu with Aptitude

When you configure a program before building, it will usually check for dependencies and if one is missing it will return an error such as: checking for OPENSSL… configure: error: Package requirements (openssl) were not met: No package ‘openssl’ found Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. It could be a PATH issue, but usually that simply means the development version of the library is not installed. Sometimes the name is easy to guess and can be installed with apt-get: sudo apt-get install packagename-devel But sometimes it’s more difficult to guess and Google is not always very helpful. In that case you can use aptitude to search for the package. For example for nss3: sudo aptitude search nss3 i   libnss3                         – Network Security Service libraries i   libnss3-1d                   – Network Security Service libraries p   libnss3-dbg                – Development files for the Network Security p   libnss3-dev                […]

Dropbear: Lightweight SSH Server / Client

You may need to remotely access your embedded device, or your embedded systems is simply headless. You could use telnet, but this is insecure. A secure way to access a device remotly is to use SSH protocol. OpenSSH is one implementation but this is relatively too large and may use uncesary space on a device with limited storage. That’s where Dropbear comes into play. Dropbear is a lightweight implementation of an SSH client and server and is ideal for embedded systems. Dropbear ARM executable is only 200 KB. Here’s how it’s described on its website: Dropbear is a relatively small SSH 2 server and client. It runs on a variety of POSIX-based platforms. Dropbear is open source software, distributed under a MIT-style license. Dropbear is particularly useful for “embedded”-type Linux (or other Unix) systems, such as wireless routers. The main features of dropbear: A small memory footprint suitable for memory-constrained […]

Cross-comping zlib for ARM target

Zlib is defind as “A Massively Spiffy Yet Delicately Unobtrusive Compression Library” and used in many projects requiring compression. Here are the instructions cross-compile zlib for ARM: Download zlib1.25 wget http://cdnetworks-kr-2.dl.sourceforge.net/project/libpng/zlib/1.2.5/zlib-1.2.5.tar.gz Extract it tar xzvf zlib-1.2.5.tar.gz cd zlib-1.2.5 Configure, build and install zlib. CC=armv5tel-redhat-linux-gnueabi-gcc ./configure –prefix=/home/jaufranc/edev/rootfs make make install This will install libz.a (static library) and libz.so (dynamic library) in /home/jaufranc/edev/rootfs/lib and copy the header files to /home/jaufranc/edev/rootfs/include. Jean-Luc Aufranc (CNXSoft)Jean-Luc started CNX Software in 2010 as a part-time endeavor, before quitting his job as a software engineering manager, and starting to write daily news, and reviews full time later in 2011. www.cnx-software.com

Installing an ARM Toolchain in Fedora

You can easily install an arm cross-compiler on Fedora as follows: cd /etc/yum.repos.d/ sudo wget http://ftp.linux.org.uk/pub/linux/arm/fedora/cross/cross.repo sudo yum install armv5tel-redhat-linux-gnueabi-gcc You can check the installation worked by checking the cross-compiler version [jaufranc@localhost ~]$ armv5tel-redhat-linux-gnueabi-gcc -v Using built-in specs. Target: armv5tel-redhat-linux-gnueabi Configured with: ../configure –prefix=/usr –mandir=/usr/share/man –infodir=/usr/share/info –enable-shared –enable-threads=posix –enable-checking=release –with-system-zlib –enable-__cxa_atexit –disable-libunwind-exceptions –enable-languages=c,c++ –disable-libgcj –with-sysroot=yes –enable-version-specific-runtime-libs –target=armv5tel-redhat-linux-gnueabi Thread model: posix gcc version 4.1.2 20070925 (Red Hat 4.1.2-33.fa1) This will only install the C compiler (gcc), to install the C++ compiler, run the following command: sudo yum install armv5tel-redhat-linux-gnueabi-gcc-c++ Tested in Fedora 12. Jean-Luc Aufranc (CNXSoft)Jean-Luc started CNX Software in 2010 as a part-time endeavor, before quitting his job as a software engineering manager, and starting to write daily news, and reviews full time later in 2011. www.cnx-software.com

Cross Compiling libavg for ARM

libavg is a high-level development platform for media-centric applications using Python as scripting language and written in C++. Bear in mind that are many dependencies with libavg 1.6. I have not built all the libraries required, but instead simply taken the pre-built binaries and header files in the qemu overo image and copied the files as follows: mkdir mnt sudo mount -o loop,offset=$[106496*512] overo_sd_alip.img mnt mkdir ~/edev/beagleboard/libs/lib -p mkdir ~/edev/beagleboard/libs/include cp mnt/usr/lib/* ~/edev/beagleboard/libs/lib/ -rf -d cp mnt/lib/* ~/edev/beagleboard/libs/lib/ -rf -d cp /mnt/usr/include/* ~/edev/beagleboard/libs/include -rf -d sudo umount mnt The -d flag skips the symlink, so we need to recreate then for all library so that the compiler can find libname.so instead of libname.so.12. Save the following scripts to symlinks.sh:

and run it where the arm libraries are located (in my case in /home/jaufranc/edev/beagleboard/libs/lib, /home/jaufranc/edev/beagleboard/libs/lib/arm-linux-gnueabi and /home/jaufranc/edev/beagleboard/libs/lib/mesa). This will  create symlinks for most libraries, but not all. Some will still […]

Cross-Compiling Mesa 3D Graphics Library for ARM

Mesa is an open-source implementation of the OpenGL specification that can be used for software emulation or  complete hardware acceleration for modern GPUs.The Mesa library is used by a variety of games (e.g. Quake 2.3), libraries (e.g PyOpenGL), science and technical applications and utilities (e.g. xscreensaver). MesaLib requires X11 libraries. I’ll assume those are already cross-compiled here. For this build, I used pre-built X11 libraries found in ALIP (ARM Internet Platform) binaries. I used the method described here and copied the libs in /lib and /usr/lib and header files in /lib/include found in the qemu overo image respectively to /home/jaufranc/edeve/beagleboard/libs/lib and /home/jaufranc/edeve/beagleboard/libs/include. make sure you use the “-d” with cp to avoid copying the symlinks or some symbolic links would point to x86 binaries or files that do not exist. Here are the instructions to cross-compile MesaLib 7.11 for ARM using arm-linux-guneabi-gcc: Download the latest version of Mesa source code: […]

UP 7000 x86 SBC