Dariusz on Software Quality & Performance

03/01/2015

[FIXED] "not found (try using -rpath or -rpath-link)" during cross compilation

Filed under: en — Tags: — dariusz.cieslak @

linuxWhen you see the following kind of errors during cross compilation (linking phase):

ld: warning: libfontconfig.so.1, needed by …/libQtGui.so, not found (try using -rpath or -rpath-link)
ld: warning: libaudio.so.2, needed by …/libQtGui.so, not found (try using -rpath or -rpath-link)

There could be two reasons:

  • the list of required binaries is not complete and linker cannot complete the linking automatically
  • your $SYSROOT/usr/lib is not passed to linker by -rpath-link as mentioned in error message

During normal native build your libraries are stored in standard locations (/usr/lib) and locating libraries is easier. Cross compilation needs more attention in this ares as SYSROOT is not standard.

Then search for LDFLAGS setup in your build scripts:

LDFLAGS="-L${STAGING_LIBDIR}"

And change to the following:

LDFLAGS="-Wl,-rpath-link,${STAGING_LIBDIR}-L${STAGING_LIBDIR}"

The clumsy syntax -Wl,<options-with-comma-as-space> tells your compiler (that is used for linking purposes) to pass the options (with commas replaced by spaces of course) to linker (ld).

Buildroot basics

Filed under: en — Tags: , , — dariusz.cieslak @

linuxIf you are an embedded software developer like me chances are you use embedded Linux for the purpose. It's Open Source, has great tools support and is a great software environment where (almost) everything could be automated through command line interfaces.

Once you decide about operating system used the next step is to choose a build system that would be used for the task of building the software. There are few choices you can select from:

  • use pre-built toolchain and rootfs and add your binaries and configuration files (i.e. STLinux for ST-based devices)
  • use OpenEmbedded for full-featured buildsystem with packaging system included
  • use BuildRoot for simple build system without packaging system included

Today I'm going to tell you about the 3rd option. Buildroot states their view on packaging systems for embedded development this way:

We believe that for most embedded Linux systems, binary packages are not necessary, and potentially harmful. When binary packages are used, it means that the system can be partially upgraded, which creates an enormous number of possible combinations of package versions that should be tested before doing the upgrade on the embedded device. On the other hand, by doing complete system upgrades by upgrading the entire root filesystem image at once, the image deployed to the embedded system is guaranteed to really be the one that has been tested and validated.

After few years with OpenEmbedded and few months with Buildroot I like the simplicity of Buildroot model. Below you can find basic (the most important in my opinion) concepts of Buildroot.

(more…)

09/04/2014

Computers's helping hand

Filed under: en — Tags: — dariusz.cieslak @

grub

08/02/2014

Self-signed SSL certificate HOWTO

Filed under: en — Tags: , , — dariusz.cieslak @

logo_sslSSL is used for (1) encrypting HTTP traffic and for (2) authentication server against browser's database of trusted certificates. Generating SSL certificate properly is important if you want your customer to use https properly. It costs few bugs per year, but your customers won't have any warnings in browser before SSL session (purpose number 2).

However, for internal applications, self-signed certificate may be a sufficient solution (purpose 1 only). You will find below a minimal commands to generate local SSL certificate (accept default values when asked for data on stdin):

mkdir -p /etc/lighttpd/ssl/local
cd /etc/lighttpd/ssl/local
openssl genrsa -passout pass:1234 -des3 -out server.key 1024
openssl req -passin pass:1234 -new -key server.key -out server.csr
cp server.key server.key.org
openssl rsa -passin pass:1234 -in server.key.org -out server.key
openssl x509 -req -in server.csr -signkey server.key -out server.crt
cat server.key server.crt > server.pem

Then lighttpd installation:

$SERVER["socket"] == "<YOUR_IP_ADDRESS>:443" {
ssl.engine = "enable"
ssl.pemfile = "/etc/lighttpd/ssl/local/server.pem"
ssl.ca-file = "/etc/lighttpd/ssl/local/server.crt"
}

Then you have to accept server certificate in your browser and voila!

29/11/2013

Check current network bandwidth used on a Linux/Unix box

Filed under: en — Tags: , — dariusz.cieslak @

Sometimes you need to quickly measure current bandwidth used by your Linux box and don't have dedicated command installed. You can use standard /proc/ file entries to get that info from the system.

Example of a embedded device with a TS stream as an input:

( cat /proc/net/dev; sleep 1; cat /proc/net/dev; ) | awk '/eth0/ { b=$1; sub(/eth0:/,"",b); if(bp){ print (b-bp)/1024/1024, "MB/s" }; bp=b }'
1.00053 MB/s

Older Posts »

Powered by WordPress