Pthreads library broken in DSM3/1337 on ARM ?

Any questions about the Command Line Interface can be placed here!
Forum rules
Please note the disclaimer before modifying your Synology Product.

Pthreads library broken in DSM3/1337 on ARM ?

Postby nelek » Sun Nov 07, 2010 12:39 pm

I've already posted a similar question, but I'd like to get some feedback from the modders community if they are experiencing the same issue, or if its just me.

It seems that no matter what I try, I cannot get to compile any packages that make use of the pthread library on my ARM based Synology NAS. I have a 410j running DSM3/1337. Configure scripts of linux software that makes use of pthreads don't detect my phtreads library, although I've installed all header files which are detected properly and libpthread.so.0 is present in /lib.

Sofar I've tried the following :

1) replacing the config.guess and config.sub files from these packages with more up to date variants;
2) feeding --libdir=/lib to the configure script;
3) Exporting the environment variables for the correct library directories before compiling;
4) When comparing with DSM3-1337 on powerpc, we noticed that several aliases were missing in /opt/lib, so I went ahead and created symlinks for them :
/opt/lib/libpthread-0.10.so -> /lib/libpthread.so.0
/opt/lib/ libpthread.so.0 -> /lib/libpthread.so.0

These packages compile fine on DSM3/ppc and on several x86 2.6 Linux based distributions (Ubuntu 10.10, Debian Etch)

Either I'm missing something trivial and inobvious, or something is seriously busted on DSM3 on ARM. Anyone have thoughts on where to look further to solve this issue? Or have an idea for a working workaround?

Thanks!
DS1512+
nelek
Beginner
Beginner
 
Posts: 21
Joined: Mon Sep 27, 2010 11:26 am

Re: Pthreads library broken in DSM3/1337 on ARM ?

Postby nelek » Sat Nov 13, 2010 8:03 pm

Researching this a bit further, it seems like something is seriously busted with the pthread libraries provided by ipkg. The problem can easily be reproduced by doing the following :

Make a test.c file containing :

Code: Select all
int main(int argc, char **argv)
{
return 0;
}


then typing :
Code: Select all
gcc test.c -o test.exe -lpthread


to compile the source file which should result in the following errors :

Code: Select all
/opt/lib/gcc/arm-none-linux-gnueabi/4.2.3/../../../../arm-none-linux-gnueabi/lib/libpthread.so: undefined reference to `__default_sa_restorer_v2@GLIBC_PRIVATE'
/opt/lib/gcc/arm-none-linux-gnueabi/4.2.3/../../../../arm-none-linux-gnueabi/lib/libpthread.so: undefined reference to `__default_rt_sa_restorer_v2@GLIBC_PRIVATE'
/opt/lib/gcc/arm-none-linux-gnueabi/4.2.3/../../../../arm-none-linux-gnueabi/lib/libpthread.so: undefined reference to `__default_rt_sa_restorer_v1@GLIBC_PRIVATE'
/opt/lib/gcc/arm-none-linux-gnueabi/4.2.3/../../../../arm-none-linux-gnueabi/lib/libpthread.so: undefined reference to `__default_sa_restorer_v1@GLIBC_PRIVATE'


Workaround

1) backup the pthread libraries found in /opt/arm-none-linux-gnueabi/lib/ :

Code: Select all
mkdir /opt/arm-none-linux-gnueabi/lib_disabled
mv /opt/arm-none-linux-gnueabi/lib/libpthread* /opt/arm-none-linux-gnueabi/lib_disabled


2) Copy the pthread libraries found in /opt/lib

Code: Select all
cp /lib/libpthread.so.0 /opt/arm-none-linux-gnueabi/lib/
cd /opt/arm-none-linux-gnueabi/lib/
ln -s libpthread.so.0 libpthread.so
ln -s libpthread.so.0 libpthread-2.5.so


Crude workaround, but it works. Packages can now properly detect pthreads.
DS1512+
nelek
Beginner
Beginner
 
Posts: 21
Joined: Mon Sep 27, 2010 11:26 am

Re: Pthreads library broken in DSM3/1337 on ARM ?

Postby mbeddow » Tue Feb 22, 2011 3:33 pm

Many thanks for figuring this out, and for troubling to post the solution that nobody else could apparently help you with.

Your posting here is especially valuable, because anyone trying to Google a solution will hit a very large number of posts stemming from the same error messages on some Solaris boxes, but the cause and remedy there are totally different from what the ipkg-based platforms require.

Your workaround finally makes it possible to compile Apache2.2 from source (including the htpasswd utility that isn't in the DSM3 version of Apache)

If anybody wants to try Apache 2.2 compilation, there's one more step to avoid the build failing with lpthread resolution errors. You need to add -lpthread to the linker parameters, because the Apache configure script as shipped doesn't put it there.
mbeddow
I'm New!
I'm New!
 
Posts: 3
Joined: Tue Feb 22, 2011 3:19 pm

Re: Pthreads library broken in DSM3/1337 on ARM ?

Postby trvrnrth » Wed Feb 23, 2011 12:43 am

Just a quick note to add another word of thanks, this solved my problems compiling libtorrent-rasterbar at the weekend.
trvrnrth
I'm New!
I'm New!
 
Posts: 3
Joined: Fri Feb 18, 2011 1:19 pm

Re: Pthreads library broken in DSM3/1337 on ARM ?

Postby kvicho » Fri Jul 01, 2011 7:41 pm

Just a small note and BIG thanks!! I was trying to compile Bacula backup on my DS 409 and it kept failing until I found your article. Well done and thanks again.
kvicho
I'm New!
I'm New!
 
Posts: 1
Joined: Fri Jul 01, 2011 7:35 pm

Re: Pthreads library broken in DSM3/1337 on ARM ?

Postby jsolomon » Sat Jan 28, 2012 6:17 pm

I spent hours before I found this article which solved my problems. I was stuck at step 3, as I didn't know I had to export the variables. Thanks!
jsolomon
I'm New!
I'm New!
 
Posts: 1
Joined: Sat Jan 28, 2012 6:14 pm

Re: Pthreads library broken in DSM3/1337 on ARM ?

Postby Zakhar » Fri May 24, 2013 10:28 pm

Many thanks for this solution.

As libpthread.so.0 in the /opt/armel..../lib is a symbolic link to the real library, I just replaced it to a link towards the working library under /lib
Zakhar
I'm New!
I'm New!
 
Posts: 9
Joined: Wed Mar 13, 2013 8:20 pm

Re: Pthreads library broken in DSM3/1337 on ARM ?

Postby Nippey » Tue Jan 21, 2014 1:19 pm

Thank you for this information!

This helped me compiling p7zip. :)
Nippey
I'm New!
I'm New!
 
Posts: 3
Joined: Tue Jan 21, 2014 10:50 am


Return to Command Line Interface

Who is online

Users browsing this forum: No registered users and 2 guests