Showing posts with label Archlinux. Show all posts
Showing posts with label Archlinux. Show all posts

Tuesday, March 23, 2010

Use LibSVM in WEKA in an Archlinux box

I found both WEKA and libSVM in AUR, however, neither maintainer considered that a user might use them together... It seem we Archie got to work it out ourselves, so here is what I did:

Dowload WEKA tarball from AUR, and Change weka.sh to

#! /bin/sh
# Note: the '-Xmx256m' flag is used to set the maximum memory that the java
# program is allowed. When working with large data sets, this number may need
# to be increased based on how much memory you wish to allow weka to have.
# Specifying command line arguments will override the defaults shown here.
# Example: '-Xmx512m'
DEFAULT_ARGS='-Xms32m -Xmx256m'
if [ $# -gt 0 ]; then
ARGS="$@"
else
ARGS="$DEFAULT_ARGS"
fi
java -classpath
"${CLASSROOT+CLASSROOT:}/usr/share/java/weka/weka.jar:/usr/share/java/libsvm.jar"
weka.gui.GUIChooser $ARGS

Do not forget to change the MD5SUM of weka.sh in PKGBUILD file :) Modify LibSVM PKGBUILD to:

# Contributor: Pierre Gueth
# Modified by: Yuanjie Huang
pkgname=libsvm
pkgver=2.9
pkgrel=2
pkgdesc="A library for Support Vector Machines classification, include
binaries and python bindings."
arch=(x86_64 i686)
url="http://www.csie.ntu.edu.tw/~cjlin/libsvm/"
license=('GPL')
groups=()
depends=()
makedepends=()
optdepends=()
provides=()
conflicts=()
replaces=()
backup=()
options=()
install=
source=("http://www.csie.ntu.edu.tw/~cjlin/cgi-bin/libsvm.cgi?+http://www.csie.ntu.edu.tw/~cjlin/libsvm+tar.gz")
noextract=()
md5sums=('c48109c825d8326d71c8c8564589736d')
build() {
cd "$srcdir/$pkgname-$pkgver"
make || return 1
install -D -m755 svm-train $pkgdir/usr/bin/svm-train
install -D -m755 svm-predict $pkgdir/usr/bin/svm-predict
install -D -m755 svm-scale $pkgdir/usr/bin/svm-scale
install -D -m644 java/libsvm.jar $pkgdir/usr/share/java/libsvm.jar
cd "python"
python setup.py build || return 1
python setup.py install --root $pkgdir
}

Then makepgk and install, have fun.

Thursday, February 25, 2010

libpng12.so.0 missing problem in Archlinux

Archlinux has been offering libpng14 recently, however if some self-compiled packages are used in the system, it may turn out an disaster :(

I had cario, freetype2 & libxft compiled from abs so as to enable sort of cleartype effect in type rendering, however, after I updated libpng recently from version 12 to 14, I cannot boot into gdm correctly. I cannot even run vim in a console for it complains that libpng12.so.0 cannot be found.

So I have to:

  1. boot with run level 3 (adding 3 at the end of grub's kernel line);
  2. login as root and remove self-compiled packages that require libpng12, cario, freetype2 & libxft in my case (I found -d option useful since I will soon reinstall these packages);
  3. recompile new versions with libpng14;
  4. install those packages.

Thursday, November 5, 2009

Mount internal filesystem without passwd with udisk (formerly devicekit-disk)

Abstract: Use policykit to avoid root password for mount an internal filesystem.

Last week, I updated my Arch Linux laptop, and got the new deviekit-disk. Then I found that the authorizations set with gnome interface, which actually sets theorg.freedesktop.hal.storage..., stops work. I have to give the root passwd when I try to mount an internal filesystem, which is really bothering:(

Luckly it is not hard to solve this problem with Policykit, though there dosen't seem to be a sweet GUI to help. All you have to do is simply create a text file named anything with suffix .pkla in /etc/polkit-1/localauthority/50-local.d/ and fill it with the content below:

[filesystems mount internal privs]
Identity=unix-group:disk
Action=org.freedesktop.devicekit.disks.filesystem-mount-system-internal
ResultAny=no
ResultInactive=no
ResultActive=yes

In case you have udisks2 instead of udisks, the action should written like this:

Action=org.freedesktop.udisks2.filesystem-mount-system;org.freedesktop.udisks2.filesystem-mount

Here I allow all users in group disk to mount internal filesystem without root password. disk is the default group of storage devices, you should add yourself to this group. Otherwise you can specify your login name:

Identity=unix-user:yourname

To see all possible actions, check /usr/share/polkit-1/actions directory.
You can always man pklocalauthority for more info:)


Update (May 22nd 2012)

Udisks2 uses different action name.


Update (Oct 25th, 2011)

Latest udev will set storage devices of group disk. So I specify group disk instead of storage now.

PS: I moved to a new blog.


Update (April 3rd 2010)

People from freedesktop.org are making a great progress - by renaming devicekit-disk as udisk (Sounds talking about flash disk, isn't it?)... So you got to change Action=org.freedesktop.devicekit.disks.filesystem-mount-system-internal to Action=org.freedesktop.udisks.filesystem-mount-system-internal.

Dear sirs/madams from freedesktop.org, will you please stop renaming things? It's not fun, at all :(


Update (April 16th, 2010)

It seems /etc/polkit-1/localauthority/50-local.d/ is a better place to apply your own settings.


Update (Nov 2nd, 2010)

The configuration file has to be named with suffix .pkla to be recognized, for more details you can man pklocalauthority. And lots of thanks goes to Awebb who kindly points this out :)

Tuesday, July 21, 2009

Firefox 3.5.1 (Shiretoko) fails to launch in Arch Linux

Abstract: Firefox 3.5.1 needs libjpeg.

After updating my Firefox (Shiretoki) to version 3.5.1 in Arch Linux, I cannot launch it. When I tried to start it from command line, it says:

$ firefox
Coundn't load XPCOM
$

Then I tried to run xulrunner directly, I got a Error message saying that libjpeg cannot be found. So I installed libjpeg-7-1, and Firefox is back again. Hopefully the Arch people can add libjpeg to Firefox's dependency.