FS#12592 - kde-config segfaults when run from within fakeroot
Attached to Project:
Arch Linux
Opened by Jakub Schmidtke (tanis) - Sunday, 28 December 2008, 04:57 GMT
Last edited by Hugo Doria (hdoria) - Wednesday, 29 April 2009, 11:35 GMT
Opened by Jakub Schmidtke (tanis) - Sunday, 28 December 2008, 04:57 GMT
Last edited by Hugo Doria (hdoria) - Wednesday, 29 April 2009, 11:35 GMT
|
Details
Description:
When /opt/kde/bin/kde-config is run normally, it works fine. When it is run from within fakeroot, it throws segmentation fault. It means, that no packages using kdelibs3 can be built by users other than root. Additional info: kdelibs3 3.5.10-2 fakeroot 1.10.1-1 Steps to reproduce: $ /opt/kde/bin/kde-config $ fakeroot # /opt/kde/bin/kde-config Segmentation fault |
This task depends upon
@Andy: Do you have any ideas? kde-config works fine when called without the absolute path and it also works fine as root.
If you have a solution drop me a comment here or via IM / mail.
I tried to recompile kdelibs3 with --enable-debug to include meaningful backtrace from the crash,
but kdelibs3 refuse to build (with enable and with disable debug options)...
I have no idea where to start here, but makepkg-git solves these problems as it only runs inside fakeroot during package() (not during build()), eliminating these problems altogether (the cp, mv, install, mkdir tools still work fine inside fakeroot).
#include <stdio.h>
int main(int argc, char *argv[])
{
printf("Hola Arch Linux\n");
return 0;
}
compile with gcc hola. -o hola -lGL
then:
LD_LIBRARY_PATH=/usr/lib/libfakeroot LD_PRELOAD=libfakeroot.so LD_DEBUG=files ./hola #fail when run with libGL (that load libnvidia-tls) but not with the libGL package from ArchLinux mesa3D.
can see,
19174: ./hola: error: symbol lookup error: undefined symbol: pthread_key_create (fatal)
then rebuild hola with gcc hola. -o hola -lGL -lpthread, this undefined symbol disapear, but always crash :(
There are importan notes on README.txt from nvidia, that can be useful, about TLS and pthreads and dlopen(), also i tried to link "faked" and "libfakeroot" to -lpthread but, not solves the problem.
fakeroot can be built to either use SYSV IPC or TCP for message passing.
Cases for which the SYSV IPC version fails or causes problems but for
which fakeroot-tcp has been observed to work well include the items
listed below.
* Multithreaded applications (using pthread)
* Running under realtime-preempt kernel
bug 12766, which is about mplayer compilation that breaks with the latest nvidia drivers. Building in chroots is a solution, but what about users who want to build mplayer with nvidia vdpau? They can't use fakeroot to build the package.Hi i again here. I tested to build fakeroot --with-ipc=tcp and then the problem dissapear :) can run the binary linked to libGL -> libnvidia-tls inside this :)
[djgera@gerardo ~]$ gcc hola.c -o hola -lGL
[djgera@gerardo ~]$ ldd hola | grep tls
libnvidia-tls.so.1 => /usr/lib/tls/libnvidia-tls.so.1 (0xb6ea9000)
[djgera@gerardo ~]$ fakeroot ./hola
Hola Arch Linux
* Using fakeroot compiled "--with-ipc=tcp" maybe the fakeroot package can install both fakeroot (the current with sysv ipc, and fakeroot-tcp) and a flag for makepkg select the desired fakeroot.
* Using a "dirty hack" using the libGL.so.1.2 from libgl package for example:
[djgera@gerardo ~]$ fakeroot ./hola
/usr/bin/fakeroot: line 178: 2492 Segmentation fault FAKEROOTKEY=$FAKEROOTKEY LD_LIBRARY_PATH="$PATHS" LD_PRELOAD="$LIB" "$@"
[djgera@gerardo ~]$ ls -l libGL.so*
lrwxrwxrwx 1 djgera djgera 10 2009-02-18 15:44 libGL.so -> libGL.so.1*
lrwxrwxrwx 1 djgera djgera 12 2009-02-18 15:44 libGL.so.1 -> libGL.so.1.2*
-rwxr-xr-x 1 djgera djgera 525761 2008-09-25 14:56 libGL.so.1.2*
[djgera@gerardo ~]$ LD_LIBRARY_PATH=. fakeroot ./hola
Hola Arch Linux
[djgera@gerardo ~]$ LD_PRELOAD=./libGL.so.1.2 fakeroot ./hola
Hola Arch Linux
[djgera@gerardo ~]$
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=516024
The bug report in debian seems to be stuck as well...
Edit /etc/makepkg.conf so that you disable fakeroot. (Just add ! in front of fakeroot)
e.g. BUILDENV=(!fakeroot !distcc color !ccache !xdelta)
Now you can build the package using makepkg without segfaults from fakeroot. The only problem now is that ownership will be set incorrectly on the files in the package itself. To fix that just extract the package to an empty directory, change the ownership inside and repackage it. This is how it's basically done:
mkdir temp
tar -C temp -xvf package.tar.gz
rm -f package.tar.gz
sudo chown -R 0:0 temp
cd temp
tar -cvzf ../package.tar.gz .PKGINFO *
cd ..
rm -rf temp
Of course if your package includes .INSTALL just add that after .PKGINFO when you package it.
And then don't forget to reenable fakeroot in your /etc/makepkg.conf so that your other builds don't get messed up with incorrect ownership.
Since the fakeroot problem seems to really only affect a small amount of packages, this isn't to much to go through for one when you need to build it. I've only experienced the problem when building mplayer myself.