Empty /usr/include/sys/ directory, missing files

I just installed Ubuntu 12.04 on a USB stick out of curiosity and started some development and noticed, that /usr/include/sys/, a heavily important directory for POSIX compliant programming, was empty! Some digging revealed that the files I was looking for where located under /usr/include/i386-linux-gnu/sys/ instead.

So what do we do to fix this? I just copied everyting from /usr/include/sys/ to /usr/include/i386-linux-gnu/sys/ (asoundlib.h in my case)

sudo cp /usr/include/sys/* i386-linux-gnu/sys/

Then I deleted that folder

sudo rm -r /usr/include/sys/

And finally made a symlink to that other /sys/

sudo ln -s /usr/include/i386-linux-gnu/sys/ /usr/include/sys

 

Done 🙂

Veröffentlicht unter Uncategorized | Verschlagwortet mit , , , , , , , | Hinterlasse einen Kommentar

Linux: Allegro5 static linking for beginners

To be able to link your allegro projects statically under Linux, you will have to build static versions of the allegro lib-files.

First, read this article on how to obtain the source code via SVN. I recommend you to install ALL of the dependencies to avoid later problems:

#apt-get install build-essential subversion cmake cmake-curses-gui xorg-dev libgl1-mesa-dev libglu-dev libpng-dev libcurl4-dev libfreetype6-dev libjpeg-dev libvorbis-dev libopenal-dev libphysfs-dev libgtk2.0-dev libasound-dev libpulse-dev libflac-dev libdumb1-dev

The documentation dependencies aren’t a must have, you can obtain the API-reference here.

Follow the wiki article until „Running CMake“. Here is where we change something. Instead of

ccmake -DCMAKE_INSTALL_PREFIX=/usr ..

we run

ccmake -DSHARED=off -DCMAKE_INSTALL_PREFIX=/usr ..

This will configure it not to create shared objects but static versions, instead.
Alternatively you can start ccmake like in the article and toggle off the „SHARED“ option after configuring.
Now you can hit c twice, then press g.
Now you are ready to build. Type

make

and wait for it to compile.
After that, you can finally install the libs by typing

#make install

If everything was successful, you will find at least a file called „liballegro-static.a“ under /usr/lib/.

Well, that was it for the installation, now you want to compile your code and make it „portable“, right?
To handle the correct parameters to the compiler and linker, pkg-config is used.
To build a static version of your project that only includes allegro5/allegro.h, a typical command could look like this:

gcc -Wall source.c `pkg-config –libs –static allegro-static-5.1` -o program

NOTICE: I use allegro5.1, you will have to change the filenames according to your version!

Lets say, your code also uses the primitives-addon and you want to link statically against it, as well. Simply add the according
package:

gcc -Wall source.c `pkg-config –libs –static allegro-static-5.1 allegro_primitives-static-5.1` -o program

Got it? You can use pkg-config to find out, what packages you have installed. Type

pkg-config allegro

and press TAB for auto-completion. You should get a list of all installed allegro-libs.

That was pretty much it, I hope this helped a bit.

Veröffentlicht unter Allegro, C++, Linux | Verschlagwortet mit , , , , , , , , , , , , | 3 Kommentare

Fixing loose Thinkpad screen / lid / hinge

I guess every Lenovo Thinkpad (damn you, Lenovo! 😉 ) owner knows this: you have the perfect notebook, it’s awesome, its design and sturdiness is just… SWEET! But for some reason, Lenovo wasn’t able to deliver the used quality of IBM when it comes to hinges. They are worn out within months, a shame when i look at the old IBM TP my dad used 10years ago… its hinges are still as good as new. So after some usage, the lid will become loose, as you can see in many videos on the web. Now for some ThinkPads (and other notebooks, as well!) there is a rather easy fix, involving two screws to be tighten.
This wasn’t the case for my R60. Instead, it uses a somewhat weird construction that looks like this:
Thinkpad R60 hinge

The problem of this design simply is the fact that the bolt, which connects the lid with the body, is NOT fixed in any sort of way. It’s simply stuck in there with some sort of liquid that provides a better grip:
ThinkPad R60 lid hinge bolt
(Just a small screw right there in the center could have done the job…)

Over the time, the material will be worn out so the bolt becomes loose which causes the whiggling.
So now it’s the question: how do we make the „nut“ for the bolt sit more tightly?
You can use several methods, such as grip-increasing liquids (ScrewGrab?) or glue/sticky substances.
One could even tighten that nut with a hammer or drill a hole into the end of the bolt and drive a screw into it.

However, I found this to be the easiest way: pull the bolt out of the socket, stick some pieces of thin, yet robust wire (read the comments, copper is a soft metal, steel should be better!) through the hole and stick the bolt back in, using a hammer or so.
thinkpad wiremod

You should end up with something like this:
VentiLator's ThinkPad WireHinge :D

An other material that could work even better is teflon-wire or a similar material that is more resistive than copperthread 😉

Okay, this sounds too easy, right? Here is the problem: the hinges are not easy to access. You have to disassemble the whole front, including the keyboard, in order to get to the screws of the hinge-sockets and in order to pull out the cables of the antennas that go right through the hinges into the lid and so on… But friendly enough, Lenovo/IBM helps you with disassembling =) There are so called Hardware Maintenance Manuals for every thinkpad that include a complete list of partnumbers and a (dis)assembling guide. Just search for your ThinkPad here: http://www-307.ibm.com/pc/support/site.wss/homeLenovo.do?country=us.
thinkpad gore

However, after reassembling, everything still works + the lid is back to normal, tight and stable =)

– Cheers

Veröffentlicht unter IBM/Lenovo Thinkpad | Verschlagwortet mit , , , , , , , , , , , , , , , , | 12 Kommentare

Lazarus missing sources: sysutils.ppu and more

For whatever reason you might want do do some Delphi/Pascal on your Linux Distribution using Lazarus as an IDE.

Many people encounter the error, that their sources-folder isn’t set correctly or they miss the package „fpc-source“. For the latter, type this into a terminal to install it:

sudo apt-get install fpc-source

When trying to compile a simple onClick event for example, this is what you get:

Error: source not found: unit /usr/lib/fpc/2.4.0/units/i386-linux/rtl/sysutils.ppu

I had a hard time, finding the right directory so just for the record, here it is (Ubuntu Lucid Lynx + Linux 2.6.32-24-generic):
/usr/share/fpcsrc/2.4.0/

On Windows it should be C:\lazarus\fpc\2.2.4\source\ or similar.

If you can not find the directory, you are probably missing the package „fpc-source“, which is needed to successfully develop with lazarus.

Veröffentlicht unter Linux, Software | Verschlagwortet mit | 1 Kommentar

Linux/ALSA: Soundkarte korrekt einstellen via alsactl & alsamixer

Moin,

ich hatte von Anfang an Probleme mit meinen Soundkarten, bei keiner habe ich es hinbekommen, dass die Soundaufnahme problemlos funktioniert.

Heute duempel ich also mal uebermuedet durchs Netz und… stosse auf die einfachste Loesung aller Zeiten.

Im Nachhinein moechte man sich in den A*sch treten, jaja.

Seit einiger Zeit existiert das Tool „alsaconf“ nicht mehr im alsa-utils Paket. Das uebernahm frueher die Soundkarteneinstellungen. Das wusste ich auch zuvor, nur war mir keine Alternative bekannt.

Diese ist jedoch ganz einfach, „alsactl init“. Das Programm versucht selbststaendig, die beste Konfiguration fuer den installierten Chip zu finden. Werden keine festen Profile gefunden, wird die Hardware mit einer guess-method initialisiert.

Also zur Konfiguration des Chipsatzes einfach

alsactl init

also root ausfuehren.

Ist das Programm durchgelaufen, sollten noch manuelle Einstellungen an den Lautstaerkereglern vorgenommen werden. Dazu einfach

alsamixer

ausfuehren und die gewuenschten Regler verschieben. Das Programm wird ueber die ‚Esc‘-Taste beendet.

=)

Veröffentlicht unter Linux, Software | Verschlagwortet mit , , , , , , , , , , , , , , | 2 Kommentare

OpenVPN komplett deinstallieren

Ich hatte heute die Ehre, die Bekanntschaft mit einer verkorksten OpenVPN-Installation zu machen :-/

/* Notiz an mich selbst: niemals .deb Pakete und Pakete ueber apt zugleich holen! /*

So, das Paket, welches ueber apt installiert wurde, konnte problemlos mit einem

sudo apt-get remove –purge openvpn openvpn-blacklist

komplett entfernt werden.

Das .deb Paket sollte sich da etwas schwerer tun.  Das Webinterface liess sich noch immer aufrufen.

Geholfen hat schliesslich folgendes:

sudo dpkg -r openvpn-as

sudo dpkg –purge openvpn-as

Das spuckte dann ein paar Warnungen aus:

dpkg – Warnung: Während Entfernens von openvpn-as ist Verzeichnis »/usr/local/openvpn_as/etc/web-ssl« nicht leer, wird daher nicht gelöscht.
dpkg – Warnung: Während Entfernens von openvpn-as ist Verzeichnis »/usr/local/openvpn_as/etc/db« nicht leer, wird daher nicht gelöscht.
dpkg – Warnung: Während Entfernens von openvpn-as ist Verzeichnis »/usr/local/openvpn_as/etc/licenses« nicht leer, wird daher nicht gelöscht.
dpkg – Warnung: Während Entfernens von openvpn-as ist Verzeichnis »/usr/local/openvpn_as/etc« nicht leer, wird daher nicht gelöscht.
dpkg – Warnung: Während Entfernens von openvpn-as ist Verzeichnis »/usr/local/openvpn_as« nicht leer, wird daher nicht gelöscht.
dpkg – Warnung: Während Entfernens von openvpn-as ist Verzeichnis »/usr/local« nicht leer, wird daher nicht gelöscht.

Mitlerweile liess sich das Admininterface nicht mehr aufrufen. Also am einfachsten mit

sudo nautilus

Nautilus starten und die Ordner aus den Warnmeldungen von oben manuell loeschen.
Alternativ dazu geht natuerlich auch ein beherztes

sudo rm -r /usr/local/openvpn*

– Gruss

Veröffentlicht unter Linux | Verschlagwortet mit , , , , , , , , , , , , | Hinterlasse einen Kommentar

VLC als Streamingserver

Der VLC Mediaplayer bietet unter anderem einen hervorragenden Streamingserver, um Video- und Audiomaterial über Netzwerke zu streamen.

Ich moechte hier kurz erklaeren, wie ihr einen (Video-)Streamingserver startet und als Client darauf zugreift.

Server:

1. Startet den VLC und navigiert zu „Medien“ -> „Streaming…“ (Shortcut: Strg + S)

2. Waehlt das zu streamende Medium aus, zum Beispiel einen Film, den ihr als DVD in eurem Laufwerk vorliegen habt 😉 Alternativ kann statt einem Volume auch eine Datei ausgewaehlt werden (.mp3, .avi, etc…)

3. Wenn ihr nun auf „Stream“ klickt, oeffnet sich ein zweites Fenster, in dem ihr das Output-Protokoll, den Port und die Dateicodierung (so wie einige weitere Optionen) einstellen koennt. Solltet ihr ein Video (beispielsweise als .avi vorliegend) im lokalen Netz streamen wollen (z.B. von eurem Server auf den HTPC), so empfehle ich folgende Einstellungen:

  • Outputs: „RTP“ + „UDP RTP vorziehen“, als Adresse eure lokale Broadcast-IP eintragen („ifconfig“ in ein Terminal eingeben, beim entsprechenden Controller wird neben der normalen IP auch eine Broadcast-IP angezeigt), (freien) Port waehlen.
  • Profil: „Verkapselung“ auf „MPEG-TS“
  • Fuer „Video-„, „Audiocodec“ und „Untertitel“ nichts weiteres Einstellen (es sei denn, Untertitel liegen in einer separaten Datei vor und werden erwuenscht)

4. „Stream“ klicken – nun startet der Server und das Video wird abgespielt.

Client:

1. Um das gestreamte Material auch zu empfangen, muss der entsprechende Server als Medium gewaehlt werden. Startet also den VLC und navigiert zu „Medien“ -> „Netzwerk oeffnen…“ (Shortcut: Strg + N)

2. Ein Fenster oeffnet sich, in dem ihr nun das im Server eingestellte Protokoll auswaehlt, in unserem fall waehlt man „UDP“ als Protokoll und gibt als Adresse die lokale Broadcast-IP des Servers sowie den Port ein.

3. Klickt man nun auf „Wiedergabe“, so oeffnet sich das Video 🙂

Veröffentlicht unter Software | Verschlagwortet mit , , , , , , , , , , , , , | Hinterlasse einen Kommentar