Tuesday, March 22, 2011
Problems with microphone in Linux
I was experiencing problems with the microphone (in Skype) in Kubuntu Maverick 10.10: no input was received by the microphone, either in Skype or using the arecord. The soundcard is an
Intel [HDA Intel], device 0: AD198x Analog [AD198x Analog]and kmix was showing the capture device's volume at the maximum.
I don't know whether KDE configuration was spoiled by something, e.g., an update. However, I solved the problem by setting the capture source to the front mic, using alsamixer command line command (kmix does not seem to show any option about this).
So, if you have similar problem, run alsamixer from the command line, press F4 so that it shows only the Capture devices, set the volume of the capture devices (in my case Front mic) as high, and, most importantly, set the Input sources of capture (in my case Front mic).
Now your mic should work!
Pubblicato da betto a 4:45 PM 0 commenti
Tuesday, February 08, 2011
Find and Rename files in Linux
I had to rename many files (in particular their extensions) which were spread throughout many folders.
I already knew find and rename utilities but I had never used them together...
here's the command line to rename all files in all the folders of the current directory with extension .first to .second
find . -name "*.first" -exec rename -v 's/\.first$/\.second/' {} +
hope this helps :)
Pubblicato da betto a 10:38 AM 2 commenti
Etichette: linux
Thursday, January 13, 2011
Compile Linux Kernel in Ubuntu with KernelCheck (and Nvidia drivers)
I've always recompiled Linux kernel on all my Linux installations, starting from the kernel sources of the Ubuntu repositories. Then I've heard about the famous 200 lines kernel patch, that I wanted to try, but it doesn't seem to apply to ubuntu linux sources (or at least I had this impression), and I didn't want to try the alternatives.
Then I stumbled upon this nice article about using KernelCheck (which I didn't know) to compile the linux kernel (not from the ubuntu repositories):
a graphical user interface program designed to make the kernel-compiling process as easy as the click of a button. KernelCheck will fetch the latest information from http://www.kernel.org, which hosts the source packages for the Linux kernel, and ask the user which one they would like to compile into a .deb package (with the option of installing the kernel after the compilation).The article also applies the 200 lines patch, so I decided to give it a try! The articles shows a video, but I'd like to blog about my experience with some screenshots.
Most important, I decided to blog about my experience because of the Nvidia drivers I have on some of my Linux computers, since the first experience with KernelCheck and nvidia drivers was really bad. I think I found a solution to deal with these drivers, so that I can compile the kernel, the patch, and have nvidia drivers work without a problem :)
After you installed kernelcheck, and run it you'll have some screens, and first of all you must retrieve available kernel information:
Then I select the custom compilation
Now, you can select some options.
At this point, it is crucial
- NOT to select the reconfiguration of X server
- NOT to install the nvidia driver
- to select "apply custom patch to the kernel" (if you want to try the 200 lines patch)
- I prefer not to install the kernel package after compilation: I'll do that myself
After the download of the needed packages is finished, you'll get a terminal window where you can apply manually the patch (that you can download it from here), and apply it, as it is shown in the screenshot (then you need to close the terminal window)
Then, you'll get the chance to configure the kernel before compilation. Make sure you have all the options you need set (it looks like kernelcheck starts from the current configuration, so, for instance, the processor family is already set as your current configuration).
To enjoy the 200 lines kernel patch, you must enable "Automatic process group scheduling" under "General setup", as shown in the following screenshot:
Then, the compilation starts, and, you know, it might take some time (though for my computer, and configuration it takes less than 1 hour)
Then, you'll be suggested to reconfigure the X server... DON'T DO THIS, and answer no
Then, the kernel deb packages (-image and -headers) will be ready in /usr/src, and you can manually install them.
Note that, during the installation, the Ubuntu kernel utilities will smartly compile and configure the current nvidia modules for you!
Now, reboot and enjoy :)
P.S. I cannot swear my computer is faster now with the 200 lines kernel patch... but I have the impression it is :)
Wednesday, October 13, 2010
Using Compiz in KDE 4
I've been using KDE 4 for some time now, and I was pretty happy with its own desktop effects. However, lately, I started to notice that kwin and xorg process were taking some CPU usage, and with graphic cards such as Intel GMA and ATI, the effects were not so smooth (while in Gnome with compiz they were much better). So I decided to try and use compiz with KDE as well; here's my (positive) installation and configuration experience.
First of all I installed all these packages
emerald libemeraldengine0 compiz compizconfig-settings-manager compiz-kde compiz-fusion-plugins-main compiz-fusion-plugins-extra fusion-iconThen you found the compiz-fusion application in my KDE menu, in System. Run it, and you can set some configuration options with that icon, in particular, you need to change the window decoration to emerald, and the window manager (to compiz). Then you must select reload window manager.
To keep compiz as the default window manager when KDE starts, you need to change System Settings -> Default Applications -> Window Manager (by selecting Compiz).
Of course, now you can configure compiz settings with its setting manager, but I suggest you to use the simpler configuration manager, simple-ccsm, as illustrated here.
Now enjoy compiz! :)
Pubblicato da betto a 12:08 PM 2 commenti
Wednesday, July 28, 2010
Merging Subtitles in Video Files with DivXConverter
I recently discovered this cool program, DivXConverter, which I didn't find in my Ubuntu distribution (you can download the .deb file, though, and install the required dependencies), but that's really useful and easy to use.
"DivX converter is a simple Mencoder frontend to Produce DivX Player Compatible AVI video format with the ability to merge subtitles . It support many video and audio filters and many presets."Now, the interesting features I've just used is the ability of merging a subtitle file (typically .srt) into a corresponding AVI file.
Here's what to do (see also the following screenshot):
- Add the avi file (and select the output folder and the compression, I left the default Normal compression)
- Make sure to select Xvid in the "Video Filters" tab to make sure the resulting avi is compatible with dvd/divx readers (at least the with ones I own)
- You can leave the default settings for Audio
- Select the subtitle file (I set ASCII as the encoding)
- Go back to the main window
- Press "Convert" and enjoy the resulting AVI file
Pubblicato da betto a 5:19 PM 0 commenti
Friday, July 09, 2010
mounting none on /dev failed: No such device
If you're experiencing this error message at boot in Linux (e.g., after you recompiled the kernel in Ubuntu Lucid)
mounting none on /dev failed: No such device
don't be scared, the boot will continue and there'll be no problem (at least, I read in some posts); I never experienced problems even with this error at boot.
But if you want to get rid of it, just make sure that you have
CONFIG_DEVTMPFS=y
in your .config file of your kernel source directory.
Pubblicato da betto a 3:00 PM 3 commenti
Monday, May 03, 2010
Package php-doc missing in Ubuntu Lucid
After installing the new Ubuntu Lucid I discovered that the package php-doc is not available anymore. Since I often work offline, having the php documentation installed to be browsed offline is a must for me.
It looks like for the moment that package is not available due to build failures.
Fortunately, the package for karmic can be installed without any problem, and you can download it from here. :)
Sunday, December 06, 2009
Huawei E1692 in Linux Kubuntu 9.10 Karmic
In a previous post I blogged about sucessfully installing this Huawei E1692 Internet device in Ubuntu Jaunty. Now that I switched to Kubuntu Karmic I found out that this device was not recognized any more.
Fortunately, this was a known issue, and I found this blog post which summarizes the solution to use this device also in Ubuntu Karmic.
I followed the instructions, however, the device still didn't show up (in particular, it wasn't mounted as an external device so that I could run the installation procedure). Probably it's a problem of Kubuntu and not Ubuntu (and I don't have Ubuntu version of Karmic, but only the Kubuntu one), so I cannot tell for sure.
However, you only need to perform some manual steps and it works in Kubuntu as well.
First, you need to follow the instructions found in this blog post anyway.
First of all, by running dmesg after inserting the device you should see something like the following lines which, at least, tells you that the device is recognized (though not mounted):
[ 664.188996] usb-storage: device found at 6In particular, this tells that the "CD" part of the device is represented by sr1, so you run
[ 664.188998] usb-storage: waiting for device to settle before scanning
[ 664.189997] scsi9 : SCSI emulation for USB Mass Storage devices
[ 664.190571] usb-storage: device found at 6
[ 664.190573] usb-storage: waiting for device to settle before scanning
[ 669.189727] usb-storage: device scan complete
[ 669.191577] scsi 8:0:0:0: CD-ROM HUAWEI Mass Storage 2.31 PQ: 0 ANSI: 2
[ 669.191585] usb-storage: device scan complete
[ 669.194267] scsi 9:0:0:0: Direct-Access HUAWEI SD Storage 2.31 PQ: 0 ANSI: 2
[ 669.212737] sr1: scsi-1 drive
[ 669.213052] sr 8:0:0:0: Attached scsi CD-ROM sr1
[ 669.213215] sr 8:0:0:0: Attached scsi generic sg2 type 5
[ 669.214044] sd 9:0:0:0: Attached scsi generic sg3 type 0
[ 669.235684] sd 9:0:0:0: [sdb] Attached SCSI removable disk
sudo mount -t iso9660 /dev/sr1 /mnt/and then you can run the installation
sudo /mnt/install_linuxYou should see a terminal window
and after that, you should see the applet
After the installation, the device is detected automatically by the system, the applet shows up, and you won't need to do the mount manually.
Hope this helps :-)
Thursday, November 05, 2009
Compiling Qt 4.6 from sources
If you feel like trying the new Qt 4.6, which is currently in beta, and if you're using Linux, for which it is available only in source code package, or if you need the current development version from the git repository (for instance, for building the git repository version of Qt-Creator, you'll have to compile qt from sources.
This is quite straightforward, but I'll blog it here, in case it might provide some help for those who never compiled it.
If you obtained the source package, then you'll need to unpack it somewhere in your home.
If you want the git version (of course you need the git program), you'll first obtain the sources from the git repository:
git clone git://gitorious.org/qt/qt.gitand then switch to the 4.6 branch
cd qtNow, instead of compiling qt in the same directory where the sources are, let's make a shadow build, so that the source directory will stay untouched; this will also allow us to do possible several builds of the library (e.g., we may want to do a static build of the library, a debug build, etc.). Thus we create a build directory where we'll run the compilation (note that at the moment the build directory must be at the same level, thus we must not create the build directory inside the source directory).
git checkout -b 4.6 origin/4.6
Thus, for instance, this are the directories I have for building qt
bettini@bettini-desktop-karmic:~/install/qt-git$ ll(where qt is where you have the qt sources; in case you got the source archive, this directory might be called something like qt-everywhere-opensource-src-4.6.0-beta1).
total 8
drwxr-xr-x 2 bettini bettini 4096 2009年11月04日 21:33 build
drwxr-xr-x 17 bettini bettini 4096 2009年11月04日 21:33 qt
Now, let's enter the build directory and run the configure script. If you don't pass any -prefix option to configure, the library will be built to be installed into the directory /usr/local/Trolltech/Qt-4.6.0/):
cd buildyou'll have to answer some questions, and then you'll be ready to compile:
../qt/configure
Which edition of Qt do you want to use ?Now you're ready to run make and wait for about a couple of hours (even more if you don't have a fast machine); of course you may want to tweak the configuration so that you don't build some parts of qt (e.g., the examples); you may want to take a look at configure options by running configure --help.
Type 'c' if you want to use the Commercial Edition.
Type 'o' if you want to use the Open Source Edition.
Preparing build tree...
This is the Qt/X11 Open Source Edition.
You are licensed to use this software under the terms of
the Lesser GNU General Public License (LGPL) versions 2.1.
Type 'L' to view the Lesser GNU General Public License version 2.1.
Type 'yes' to accept this license offer.
Type 'no' to decline this license offer.
Do you accept the terms of the license?
Qt is now configured for building. Just run 'make'.
Once everything is built, you must run 'make install'.
Qt will be installed into /usr/local/Trolltech/Qt-4.6-git
To reconfigure, run 'make confclean' and 'configure'.
After compilation ended, you can install the library; if you chose to install it in a path which is not your home, remember that you need superuser privileges:
sudo make installWhen this ended, you'll have your qt installed in the path specified at configuration time (or the default one), e.g.:
bettini@bettini-prog-karmic:~$ ll /usr/local/Trolltech/Qt-4.6.0/Note that sometimes documentation is not installed (you can take a look at the doc directory which should have html and qch subdirectories). I experienced this if I use a different prefix at configuration time. If this is the case, you need to first build explicitly the documentation with make docs and then, run the same configure command again (i.e., with the same options), and then run the make install command another time, and the documentation should be installed correctly.
total 364
drwxr-xr-x 2 root root 4096 2009年11月05日 07:30 bin
drwxr-xr-x 22 root root 4096 2009年11月05日 07:29 demos
drwxr-xr-x 5 root root 4096 2009年11月05日 07:30 doc
drwxr-xr-x 36 root root 4096 2009年11月05日 07:29 examples
drwxr-xr-x 21 root root 4096 2009年11月05日 07:28 include
drwxr-xr-x 3 root root 4096 2009年11月05日 07:28 lib
drwxr-xr-x 96 root root 4096 2009年11月05日 07:30 mkspecs
drwxr-xr-x 2 root root 4096 2009年11月05日 07:28 phrasebooks
drwxr-xr-x 10 root root 4096 2009年11月05日 07:28 plugins
-rw-r--r-- 1 root root 332881 2009年10月13日 09:43 q3porting.xml
Now, you're ready to enjoy the qtdemo, by running /usr/local/Trolltech/Qt-4.6.0/bin/qtdemo
Now, if you have another version of qt already installed in your system (e.g., the one packaged for your distribution) and you want to use the one you've just compiled it?
Well, thanks to qmake, this is quite easy: it's just a matter of invoking the qmake of your compiled version of qt (instead of the one in the system path).
For instance, let's take the mdi example that comes with qt, and let's take, for instance, the one already installed in your system (if you don't have qt examples already installed from your distribution, you can still take the one that is in the sources you downloaded), and copy it into a local folder:
bettini@bettini-prog-karmic:~/tmp/qt$ cp -rf /usr/lib/qt4/examples/mainwindows/mdi .
cd mdi
If I want to build this example using the version of qt we've just compiled it's just a matter of running
/usr/local/Trolltech/Qt-4.6.0/bin/qmake mdi.proNow, if I run make, the g++ compiler will be invoked with the right include path and library path for our compiled version of qt:
makeFor instance, here's some output (note the -I and -L options):
g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Trolltech/Qt-4.6.0/mkspecs/linux-g++ -I. -I/usr/local/Trolltech/Qt-4.6.0/include/QtCore -I/usr/local/Trolltech/Qt-4.6.0/include/QtGui -I/usr/local/Trolltech/Qt-4.6.0/include -I. -o main.o main.cppBy the way, note that the right version of the moc compiler is used (and the same holds for uic if your application needs it).
...
/usr/local/Trolltech/Qt-4.6.0/bin/moc -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Trolltech/Qt-4.6.0/mkspecs/linux-g++ -I. -I/usr/local/Trolltech/Qt-4.6.0/include/QtCore -I/usr/local/Trolltech/Qt-4.6.0/include/QtGui -I/usr/local/Trolltech/Qt-4.6.0/include -I. mdichild.h -o moc_mdichild.cpp
...
g++ -Wl,-O1 -Wl,-rpath,/usr/local/Trolltech/Qt-4.6.0/lib -o mdi main.o mainwindow.o mdichild.o moc_mainwindow.o moc_mdichild.o qrc_mdi.o -L/usr/local/Trolltech/Qt-4.6.0/lib -lQtGui -L/usr/local/Trolltech/Qt-4.6.0/lib -L/usr/X11R6/lib -lQtCore -lpthread
If you now run the mdi program, and choose the Help -> About Qt menu item, you'll get the proof you're using your version of qt 4.6
Let's do some more experiments, and recompile the mdi example with the system version of qt (thus, it's better to get rid of the mdi directory and get a fresh new copy of the mdi example). Now we use the system version of qmake:
qmake -versionand let's build the example this way
QMake version 2.01a
Using Qt version 4.5.2 in /usr/lib
qmake mdi.proNote that the compiler options are now different
make
g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -o main.o main.cppIf we run the application and select the about qt menu item we can see that we have the 4.5 version of qt:
...
/usr/bin/moc-qt4 -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. mdichild.h -o moc_mdichild.cpp
...
g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -o qrc_mdi.o qrc_mdi.cpp
g++ -Wl,-O1 -o mdi main.o mainwindow.o mdichild.o moc_mainwindow.o moc_mdichild.o qrc_mdi.o -L/usr/lib -lQtGui -lQtCore -lpthread
However, you can run this application, which is built using qt 4.5, so that it uses the 4.6 version of the library you compiled from source (assuming that we are using dynamically linked library):
LD_LIBRARY_PATH=/usr/local/Trolltech/Qt-4.6.0/lib ./mdiThis will force the dynamic linker to use the 4.6 version of the dynamic libraries.
Again, you can get the evidence using the about qt menu item.
This is possible due to version 4.6 being backward compatible.
Have fun with Qt :-)
Pubblicato da betto a 9:03 AM 13 commenti
Saturday, October 10, 2009
Keep track of your network usage using vnstat
Since I started using my mobile connection to connect to Internet (now and then), I felt the need to keep track of my network usage (since I only have 500mb a month, and my provider doesn't seem to provide the usage on a website). And of course, I'm talking Linux OS ;-)
I stumbled upon this nice software, vnstat, http://humdi.net/vnstat, which really suits my needs.
Unfortunately, the version that comes with Ubuntu is quite old, so I was suggested in the forum, to download and compile from sources the latest version from the website.
After unpackaged the tarbal, it's just a matter of running make install (as a superuser)
sudo make installThen, the first time, you need to create the database; since I'm interested in my ppp0 mobile connection, I did
Installing vnStat...
Installing config to /etc/vnstat.conf
install -d -m 755 /usr/bin /usr/sbin /usr/share/man/man1 /usr/share/man/man5 /var/lib/vnstat
install -s -m 755 src/vnstat /usr/bin
install -s -m 755 src/vnstatd /usr/sbin
install -m 644 man/vnstat.1 /usr/share/man/man1
install -m 644 man/vnstatd.1 /usr/share/man/man1
install -m 644 man/vnstat.conf.5 /usr/share/man/man5
sudo vnstat --force -u -i ppp0Before starting, I prefered to tweak the configuration a bit, so I created $HOME/.vnstatrc and I added this option
# interface specific limitsThis seemed to help getting rid of those annoying 4gb spikes. (On a side note, I often use the application that came with my Internet Huawei card, which often, very often, suffer from those 4gb spikes which definitely spoil the statistics of network usage, that's why I had to find a better solution to keep track of that.)
# example 8Mbit limit for eth0 (remove # to activate):
#MaxBWeth0 8
MaxBWppp0 8
Now you can setup the vnstat daemon so that it starts automatically when the computer starts
sudo cp examples/init.d/ubuntu/vnstat /etc/init.d/And if you want to start it right now
sudo chmod 755 /etc/init.d/vnstat
sudo update-rc.d vnstat defaults
sudo /etc/init.d/vnstat startEvery 5 minutes the daemon updates the database with the statistics (of course you can configure many things, see the vnstat documentation).
You can see the current statistics
bettini@bettini-laptop:~$ vnstat
Database updated: Sat Oct 10 15:37:54 2009
ppp0 since 04.09.09
rx: 292.90 MiB tx: 104.48 MiB total: 397.38 MiB
monthly
rx | tx | total | avg. rate
------------------------+-------------+-------------+---------------
Sep '09 243.74 MiB | 88.89 MiB | 332.62 MiB | 1.05 kbit/s
Oct '09 49.16 MiB | 15.59 MiB | 64.76 MiB | 0.64 kbit/s
------------------------+-------------+-------------+---------------
estimated 157 MiB | 48 MiB | 205 MiB |
daily
rx | tx | total | avg. rate
------------------------+-------------+-------------+---------------
yesterday 329 KiB | 172 KiB | 501 KiB | 0.05 kbit/s
today 7.91 MiB | 2.25 MiB | 10.16 MiB | 1.48 kbit/s
------------------------+-------------+-------------+---------------
estimated 10 MiB | 3 MiB | 13 MiB |
The daily statistics
bettini@bettini-laptop:~$ vnstat -d
ppp0 / daily
day rx | tx | total | avg. rate
------------------------+-------------+-------------+---------------
04.09. 8.96 MiB | 6.99 MiB | 15.94 MiB | 1.51 kbit/s
05.09. 12.05 MiB | 4.37 MiB | 16.42 MiB | 1.56 kbit/s
06.09. 9.21 MiB | 4.14 MiB | 13.35 MiB | 1.27 kbit/s
08.09. 25.17 MiB | 9.68 MiB | 34.86 MiB | 3.30 kbit/s
09.09. 6.64 MiB | 2.74 MiB | 9.38 MiB | 0.89 kbit/s
10.09. 22.53 MiB | 7.88 MiB | 30.41 MiB | 2.88 kbit/s
12.09. 10.58 MiB | 4.64 MiB | 15.22 MiB | 1.44 kbit/s
13.09. 5.13 MiB | 2.07 MiB | 7.21 MiB | 0.68 kbit/s
14.09. 7.67 MiB | 2.18 MiB | 9.86 MiB | 0.93 kbit/s
18.09. 12.54 MiB | 2.31 MiB | 14.85 MiB | 1.41 kbit/s
19.09. 16.28 MiB | 5.14 MiB | 21.42 MiB | 2.03 kbit/s
20.09. 4.76 MiB | 1.47 MiB | 6.24 MiB | 0.59 kbit/s
22.09. 11.99 MiB | 4.29 MiB | 16.27 MiB | 1.54 kbit/s
23.09. 17.75 MiB | 8.66 MiB | 26.41 MiB | 2.50 kbit/s
24.09. 8.80 MiB | 2.94 MiB | 11.74 MiB | 1.11 kbit/s
26.09. 15.72 MiB | 4.99 MiB | 20.71 MiB | 1.96 kbit/s
27.09. 383 KiB | 108 KiB | 491 KiB | 0.05 kbit/s
29.09. 23.36 MiB | 6.18 MiB | 29.55 MiB | 2.80 kbit/s
30.09. 24.23 MiB | 8.09 MiB | 32.32 MiB | 3.06 kbit/s
01.10. 9.90 MiB | 5.62 MiB | 15.52 MiB | 1.47 kbit/s
04.10. 22.22 MiB | 5.15 MiB | 27.37 MiB | 2.60 kbit/s
05.10. 8.81 MiB | 2.40 MiB | 11.21 MiB | 1.06 kbit/s
09.10. 329 KiB | 172 KiB | 501 KiB | 0.05 kbit/s
10.10. 7.91 MiB | 2.25 MiB | 10.16 MiB | 1.48 kbit/s
------------------------+-------------+-------------+---------------
estimated 10 MiB | 3 MiB | 13 MiB |
for months
bettini@bettini-laptop:~$ vnstat -m
ppp0 / monthly
month rx | tx | total | avg. rate
------------------------+--------------+--------------+---------------
Sep '09 243.74 MiB | 88.89 MiB | 332.62 MiB | 1.05 kbit/s
Oct '09 49.25 MiB | 15.68 MiB | 64.93 MiB | 0.64 kbit/s
------------------------+--------------+--------------+---------------
estimated 157 MiB | 48 MiB | 205 MiB |
and so on.
Very nice! :-)
Pubblicato da betto a 3:26 PM 0 commenti
Etichette: linux, networking
Thursday, October 01, 2009
Compiling Boost Regex in Linux
Boost libraries provide many interesting C++ libraries with cool functionalities. I've been using for many years now boost shared pointers and boost regex library (for regular expression). In particular, I'm using them in my software GNU Source-Highlight. These libraries are usually available in LInux distributions, but if they are not, and you need to build them (compile them) from sources... well... here comes trouble :-)
The first time, it is actually not easy to build boost libraries from sources, even though you're used to build programs from sources following the usual "./configure && make && make install"; in particular, boost use their own build system based on bjam. Indeed, I've had many complaints from source-highlight users when it comes to build source-highlight and the boost libraries are not available in their system.
I hope this post sheds some light for building boost libraries from source. In particular, I'll concentrate on regex library (in fact, you're not required to build all the libraries: you can simply select the ones you're interested in). Note that some boost libraries come only in the shape of header files (like shared pointers) and others require also a lib file (like regex). Note, however, that all the header files will be installed anyway (they basically do not require any compilation), while library files require compilation, and compiling all the libraries in boost may require some time; thus, having the chance to select only some libraries is quite useful.
In this post I'll assume that you want to build only the regex library and to install all the built files into $HOME/opt/boost (so that you will not need root access rights).
Once you unpacked the sources into a directory, say ~boost
tar xjvf ~/Downloads/boost_1_39_0.tar.bz2you get into that directory
cd ~boostand run the booststrap command
./bootstrap.sh \Hopefully, you will get no error, and then you're ready to build and install the boost headers and the regex library with the following command:
--prefix=$HOME/opt/boost \
--libdir=$HOME/opt/boost/lib \
--with-libraries=regex
./bjam --build-dir=build --layout=system installThis will install the directories include and lib into $HOME/opt/boost.
You can now test your installation using the example program you find in the boost website, example.cpp:
#include <boost/regex.hpp>
#include <iostream>
#include <string>
int main()
{
std::string line;
boost::regex pat( "^Subject: (Re: |Aw: )*(.*)" );
while (std::cin)
{
std::getline(std::cin, line);
boost::smatch matches;
if (boost::regex_match(line, matches, pat))
std::cout << matches[2] << std::endl;
}
}
Since you installed boost in a directory which is probably not in the search path of your compiler, you will need to specify the path for header inclusion and the path for library, as follows:
g++ -I$HOME/opt/boost/include example.cpp -o example \If everything went fine, you'll have your program to test.
-L$HOME/opt/boost/lib -lboost_regex
If you want to run your program, remember that the boost regex library you built is a dynamic library, thus, again, since it is not installed in a system path where the loader searches for libraries to load at run-time, you'll need to specify that path with the environment variable LD_LIBRARY_PATH, e.g.,
LD_LIBRARY_PATH=$HOME/opt/boost/lib ./exampleAs I said before, you could have install the library and headers in system path, e.g., /usr; all you have to do is to specify a different bootstrap command
./bootstrap.sh \and then run bjam as before (but with root privileges).
--prefix=/usr \
--libdir=/usr/lib \
--with-libraries=regex
Hope this helps :-)
Pubblicato da betto a 10:56 AM 8 commenti
Friday, August 07, 2009
Huawei E1692 in Linux Ubuntu Jaunty
I've just tried this Internet device, HUAWEI E1692 with Linux Ubuntu Jaunty, and basically everything worked out fine smoothly. The Internet connection can be established either with the NetworkManager Gnome applet, or using the application that comes with the device. Linux is officially supported with the provided drivers, and basically the installation works fine, thought the instructions provided are not completely correct...
As for the installation, you need to insert the usb device, and the first time, it is recognized as a USB memory storage; you can then access the data stored in the device, where you find a folder with the drivers and the installation script.
Since the installation requires root privileges it is required to run the install script in the Linux folder using the terminal:
cd /media/Alice\ MOBILE\ HW/Linux
sudo ./install
As suggested in this thread, it is better to specify the installation path, even though you're OK with the default one, by simply inserting the full path. The installation should then succeed
Now, you should be able to setup a connection with NetworkManager applet (actually I had another connection setup for the same operator, thus I could simply reused that one).
Now, an icon should be put in your desktop to use the application that ships with the device; however, I couldn't connect using that application link, probably because the application requires root privileges... but it works fine if I start it from a terminal
cd /usr/local/Alice_MOBILE_E1692/
sudo ./MobilePartner
and then you should be able to connect
The nice thing of this application is that you can keep track of your traffic
and you can send SMSs and access your addressbook
Friday, May 08, 2009
Goodbye ATI, welcome NVIDIA
I recently bought a new desktop, a slim one: the s3530.it HP Pavilion slimline, which I've really enjoyed since the very first moment! It is very small, compact, silent, and it provides basically everything!
When I bought it I noticed that it was endorsed with an ATI graphical card, but I said to myself "ATI? Never owned one... but it is well supported in Linux as far as I remember..." Gosh I was quite wrong!
If supported means that you need to get stuck with 2d or experience very sloooow motions in 3d then, it is right, it is supported, otherwise... :'(
I had always had nice experiences with Nvidia, and I didn't want to give up compiz special effects (after all I have a powerful desktop!), so after a quite hard research to find someone selling an Nvidia lowprofile graphic card, I substituted that crap of ATI with an Nvidia GE-FORCE 8400 GS graphical card, and now everything works like magic, with a very fluent graphic!
Of course, Ubuntu provides the driver for that! Well it did it also for ATI, but that driver really sucks!
I'll never buy another computer again if endorsed with an ATI, this is for sure! :-)
Sunday, April 05, 2009
Ubuntu Jaunty 9.04 beta on a Dell Latitude D630
I've been using this laptop, a Dell Latitude D630 for more than one year now, and I've always used Kubuntu (but always up to 8.04). Today, I decided to give a try to Ubuntu Jaunty 9.04 (still in beta); I preferred Ubuntu instead of Kubuntu because the same version of Kubuntu has a bug at the end of the installation process which does not let you decide whether to install the boot loaded on a specific partition instead of the MBR.
I tested the system live first, and experienced no problems. Thus, I installed it on the hard disk (on another partition, since I'm still keeping the kubuntu 8.04 installation).
The first nice thing I noticed was that now it's much easier to select your time zone, and the Region and City lists are neater (you can select the time zone with a few clicks now).
Also the suggestion of the keyboard layout works fine!
Then we come to the partitioning step:
I also specified to mount my other linux installation in a specific directory
The installation also offers the possibility of importing existing accounts (note that it detected windows and other Linux installations), but I preferred not to.
Then, before starting the installation...
remember to click on the advanced button, to setup the boot loader as you prefer, otherwise it will be installed on the MBR.
Now, since I already have grub installed (from my main kubuntu 8.04 installation), and want to keep that that way, I chose to install the ubuntu boot loader on the first sector of the installation partition (in my case (hd0,5) or /dev/sda6):
Now, I'm read to start the installation:
Of course, I had to change the grub menu.lst file of my main linux kubuntu 8.04 installation in order to add a menu item to boot this new Linux installation:
title Ubuntu JauntyBy selecting this grub menu item, I can boot the new Jaunty installation.
root (hd0,5)
chainloader +1
The first impression was really good! Everything seems to work fine: ethernet (Broadcom Corporation NetXtreme BCM5755M Gigabit Ethernet PCI Express (rev 02)), wireless (Network controller: Intel Corporation PRO/Wireless 3945ABG [Golan] Network Connection (rev 02)), bluetooth, graphic card (Intel Corporation Mobile GM965/GL960 Integrated Graphics Controller (rev 0c)) with special effects on!
It also looks like the infamous bug concerning too many load/unload cycles is not there anymore!
Stay tuned, as I'll keep this post up to date with new information :-)
Pubblicato da betto a 2:57 PM 9 commenti