Issues reproducing Filebot success in QNAP NAS - arm5vtel

Support for Synology NAS, QNAP NAS and other Embedded Linux systems
Post Reply
openone
Posts: 2
Joined: 25 Jan 2016, 05:57

Issues reproducing Filebot success in QNAP NAS - arm5vtel

Post by openone »

Hello There,

Awesome software you have here. Must have been a lot of your hardwork put into it. Thank you, Good sir.

Hardware is QNAP - TS212P , 2 bay NAS running Debian 8. It has an ARMv5 processor. I use it as my NAS and download station and also a bit of home automation. By default all my custom services run under user "dload", a near admin user.

Code: Select all

root@GrayNAS:/# cat /etc/debian_version
8.2
root@GrayNAS:/# uname -a
Linux GrayNAS 4.3.0-0.bpo.1-kirkwood #1 Debian 4.3.3-5~bpo8+1 (2016-01-07) armv5tel GNU/Linux
Java is installed and working.

Code: Select all

root@GrayNAS:~# java -version
java version "1.8.0_65"
Java(TM) SE Embedded Runtime Environment (build 1.8.0_65-b17, headless)
Java HotSpot(TM) Embedded Client VM (build 25.65-b01, mixed mode)
I tried to run filebot portable edition, But it looks like armv5 is not supported out of the box, none of the official deb repo packages worked either.

Code: Select all

root@GrayNAS:/opt/filebot# ./filebot.sh -script fn:sysinfo
FileBot 4.6.1 (r3454)
JNA Native: /opt/filebot/data/root/temp/jna-3506402/jna8892473533402168105.tmp: /opt/filebot/data/root/temp/jna-3506402/jna8892473533402168105.tmp: cannot open shared object file: No such file or directory
MediaInfo: java.lang.NoClassDefFoundError: Could not initialize class com.sun.jna.Native
7-Zip-JBinding: net.sf.sevenzipjbinding.SevenZipNativeInitializationException: Failed to load 7z-JBinding: no 7-Zip-JBinding in java.library.path
Chromaprint: fpcalc version 1.2.0 (fpcalc)
Extended Attributes: OK
Groovy Engine: 2.4.5
JRE: Java(TM) SE Embedded Runtime Environment 1.8.0_65 (headless)
JVM: 32-bit Java HotSpot(TM) Embedded Client VM
CPU/MEM: 1 Core / 121 MB Max Memory / 9 MB Used Memory
OS: Linux (arm)
Package: PORTABLE
Data: /opt/filebot/data/root
uname: Linux GrayNAS 4.3.0-0.bpo.1-kirkwood #1 Debian 4.3.3-5~bpo8+1 (2016-01-07) armv5tel GNU/Linux
Done ヾ(@⌒ー⌒@)ノ
None of the libjnidispatch.so were for ARMv5 and softfloat which i checked using readelf -a . So i purged all the default packages from the system, And compiled JNA and sevenzipbindings from the official repos. Still was getting the same result. So i modified the filebot.sh a little bit..

Code: Select all

ADD_ARGS="$ADD_ARGS-Djna.debug_load.jna=true "
ADD_ARGS="$ADD_ARGS-Djna.library.path=$APP_ROOT -Djava.library.path=$APP_ROOT "
Now the fn:sysinfo output

Code: Select all

root@GrayNAS:/opt/filebot# ./filebot.sh -script fn:sysinfo
FileBot 4.6.1 (r3454)
Trying (via loadLibrary) jnidispatch
Found jnidispatch on system path
JNA Native: Can't obtain updateLastError method for class com.sun.jna.Native
MediaInfo: java.lang.NoClassDefFoundError: Could not initialize class com.sun.jna.Native
7-Zip-JBinding: 9.20
Chromaprint: fpcalc version 1.2.0 (fpcalc)
Extended Attributes: OK
Groovy Engine: 2.4.5
JRE: Java(TM) SE Embedded Runtime Environment 1.8.0_65 (headless)
JVM: 32-bit Java HotSpot(TM) Embedded Client VM
CPU/MEM: 1 Core / 121 MB Max Memory / 9 MB Used Memory
OS: Linux (arm)
Package: PORTABLE
Data: /opt/filebot/data/root
uname: Linux GrayNAS 4.3.0-0.bpo.1-kirkwood #1 Debian 4.3.3-5~bpo8+1 (2016-01-07) armv5tel GNU/Linux
Done ヾ(@⌒ー⌒@)ノ
I researched around the web and found that updateLastError is from some old version and method doesnt exist from JNA version 4. So i did an careful find and delete on my system for libjnidispatch.so and JNA.jar. Then I moved my compiled libjnidispatch.so to /usr/lib/jni and JNA.jar to /usr/share/java/.

But still the same errors were popping up, Filebot either finds an old version with updateLastError or incompatible linux-arm lib inside the jar.


Finally when i was abt to give up, I tried a temporary solution, I replaced the com/libjnidispatch.so as an experiment.

Code: Select all

jar uf FileBot.jar com/sun/jna/linux-arm/libjnidispatch.so
Now it worked!! :D :D

Code: Select all

root@GrayNAS:/opt/filebot# ./filebot.sh -script fn:sysinfo
FileBot 4.6.1 (r3454)
Looking in classpath from sun.misc.Launcher$AppClassLoader@10dea4e for /com/sun/jna/linux-arm/libjnidispatch.so
Found library resource at jar:file:/opt/filebot/FileBot.jar!/com/sun/jna/linux-arm/libjnidispatch.so
Trying /opt/filebot/data/root/temp/jna-3506402/jna8017015433184415889.tmp
Found jnidispatch at /opt/filebot/data/root/temp/jna-3506402/jna8017015433184415889.tmp
JNA Native: 4.0.1
MediaInfo: MediaInfoLib - v0.7.70
7-Zip-JBinding: 9.20
Chromaprint: fpcalc version 1.2.0 (fpcalc)
Extended Attributes: OK
Groovy Engine: 2.4.5
JRE: Java(TM) SE Embedded Runtime Environment 1.8.0_65 (headless)
JVM: 32-bit Java HotSpot(TM) Embedded Client VM
CPU/MEM: 1 Core / 121 MB Max Memory / 9 MB Used Memory
OS: Linux (arm)
Package: PORTABLE
Data: /opt/filebot/data/root
uname: Linux GrayNAS 4.3.0-0.bpo.1-kirkwood #1 Debian 4.3.3-5~bpo8+1 (2016-01-07) armv5tel GNU/Linux
Done ヾ(@⌒ー⌒@)ノ
.

I went in reverse and verified there are no old files and verified paths and all. Still i am not sure why filebot is not able to find the system libs. I dont want to modifiy the jar file but rather keep it untouched for updates.

My filebot.sh ->

Code: Select all

#!/bin/sh
PRG="$0"

# resolve relative symlinks
while [ -h "$PRG" ] ; do
	ls=`ls -ld "$PRG"`
	link=`expr "$ls" : '.*-> \(.*\)$'`
	if expr "$link" : '/.*' > /dev/null; then
		PRG="$link"
	else
		PRG="`dirname "$PRG"`/$link"
	fi
done

# make it fully qualified
WORKING_DIR=`pwd`
PRG_DIR=`dirname "$PRG"`
APP_ROOT=`cd "$PRG_DIR" && pwd`

# restore original working dir
cd "$WORKING_DIR"

# user per user app data location to avoid permission conflicts between root and admin users
APP_DATA="$APP_ROOT/data/$USER"

# add APP_ROOT to LD_LIBRARY_PATH
if [ ! -z "$LD_LIBRARY_PATH" ]
then
	export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$APP_ROOT"
else
	export LD_LIBRARY_PATH="$APP_ROOT"
fi

# force JVM language and encoding settings
export LANG="en_US.UTF-8"
export LC_ALL="en_US.UTF-8"

ADD_ARGS=" "
ADD_ARGS="$ADD_ARGS-Djna.debug_load.jna=true "
#ADD_ARGS="$ADD_ARGS-Djna.library.path=$APP_ROOT -Djava.library.path=$APP_ROOT "
# ADD_ARGS="$ADD_ARGS-verbose:class "
ADD_ARGS="$ADD_ARGS-Djna.nosys=true "

# FileBot settings
EXTRACTOR="SevenZipNativeBindings"	# use the lib7-Zip-JBinding.so native library
# EXTRACTOR="SevenZipExecutable"		# use the 7z executable
# EXTRACTOR="ApacheVFS"					# use Apache Commons VFS2 with junrar plugin

java $JAVA_OPTS \
	-Djna.library.path="$APP_ROOT" \
	-Djava.library.path=="$APP_ROOT" \
	-Dunixfs=false \
	-DuseGVFS=false \
	-DuseExtendedFileAttributes=true \
	-DuseCreationDate=false \
	-Dfile.encoding="UTF-8" \
	-Djava.net.useSystemProxies=false \
	-Dsun.net.client.defaultConnectTimeout=10000 \
	-Dsun.net.client.defaultReadTimeout=60000 \
	-Dapplication.deployment=portable \
	-Dnet.filebot.Archive.extractor="$EXTRACTOR" \
	-Dnet.filebot.AcoustID.fpcalc="fpcalc" \
	-Dapplication.dir="$APP_DATA" \
	-Djava.io.tmpdir="$APP_DATA/temp" \
	-Duser.home="$APP_DATA" \
	-Djava.util.prefs.PreferencesFactory=net.filebot.util.prefs.FilePreferencesFactory \
	-Dnet.filebot.util.prefs.file="$APP_DATA/prefs.properties" \
	$ADD_ARGS \
	-jar \
	"$APP_ROOT/FileBot.jar" "$@"
How do i make Filebot use system libs? Can i set the preferred lib? Please help this novice.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Issues reproducing Filebot success in QNAP NAS - arm5vte

Post by rednoah »

1.
FileBot itself is all Java, so that should be fine. But getting all the (optional) native libraries working on arm5vtel might be tricky, and I can't help much with that. I'm surprised you got library loading working (though it might still crash once the native code is actually executed). I bow to you Good Sir! :D


2.
So you want to make sure that your libjnidispatch.so is loaded, correct?

Disable all the JNA jar/unpack/load magic:

Code: Select all

-Djna.nounpack=true
-Djna.nosys=false
JNA has 3 library path options that are considered, so I'd explicitly set them all:

Code: Select all

-Djna.boot.library.path="$APP_ROOT"
-Djna.library.path="$APP_ROOT"
-Djava.library.path="$APP_ROOT"

3.
Please help this novice.
Says the guy that went as far as adding -Djna.debug_load.jna=true to figure it out. :D
:idea: Please read the FAQ and How to Request Help.
openone
Posts: 2
Joined: 25 Jan 2016, 05:57

Re: Issues reproducing Filebot success in QNAP NAS - arm5vte

Post by openone »

rednoah wrote: So you want to make sure that your libjnidispatch.so is loaded, correct?

Disable all the JNA jar/unpack/load magic:

Code: Select all

-Djna.nounpack=true
-Djna.nosys=false
JNA has 3 library path options that are considered, so I'd explicitly set them all:

Code: Select all

-Djna.boot.library.path="$APP_ROOT"
-Djna.library.path="$APP_ROOT"
-Djava.library.path="$APP_ROOT"
Thank you!! That worked fine. Now it works! :D
rednoah wrote: But getting all the (optional) native libraries working on arm5vtel might be tricky, and I can't help much with that. I'm surprised you got library loading working (though it might still crash once the native code is actually executed)
Fortunately, I tried it for two times, it is working perfectly! Now i setup a cron job, lets see how it goes. :D

Says the guy that went as far as adding -Djna.debug_load.jna=true to figure it out. :D
lol .. I am no coding genius like you, sir! I just know one or two about linux scripting. I wish to learn a programming language completely one day. :?

P.S. Sorry for reporting late, NAS got the wrong kernel flashed by mistake. Just restored it :D

EDIT: Is it ok if i share the compiled libs and maybe write a How-to? :roll:
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Issues reproducing Filebot success in QNAP NAS - arm5vte

Post by rednoah »

Is it ok if i share the compiled libs and maybe write a How-to?
Of course! That'd be much appreciated! :geek:
:idea: Please read the FAQ and How to Request Help.
rowdyrahz
Posts: 8
Joined: 22 Feb 2016, 06:36

Re: Issues reproducing Filebot success in QNAP NAS - arm5vte

Post by rowdyrahz »

rednoah wrote:
Is it ok if i share the compiled libs and maybe write a How-to?
Of course! That'd be much appreciated! :geek:
I installed filebot 4.6.1 with no success so i use ,filebot version, 4.5.3 any how to for QNAP NAS - arm5vtel?
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Issues reproducing Filebot success in QNAP NAS - arm5vte

Post by rednoah »

The Java core components will always just work on any platform. In this aspect 4.6.1, 4.5.3 and any other version is exactly the same.

Setting up the optional native components may be tricky on some platforms.

What exactly are you trying to do? What exactly is the issue?
:idea: Please read the FAQ and How to Request Help.
rowdyrahz
Posts: 8
Joined: 22 Feb 2016, 06:36

Re: Issues reproducing Filebot success in QNAP NAS - arm5vte

Post by rowdyrahz »

No issue just want to have the latest version of filebot. thanks.
vstancea
Posts: 15
Joined: 26 Oct 2016, 21:38

Re: Issues reproducing Filebot success in QNAP NAS - arm5vtel

Post by vstancea »

Hi openone,

I also have the TS-212P and i would like to install FileBot on it, but i'm a complete noob. Could you make a step by step tutorial?

Thanks.
Post Reply