Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[How-To] Fix GSPCA Webcams for Skype on 64-bit Gentoo
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
ksp7498
Apprentice
Apprentice


Joined: 08 Jun 2006
Posts: 225
Location: North Carolina - US

PostPosted: Tue Jun 09, 2009 12:19 am    Post subject: [How-To] Fix GSPCA Webcams for Skype on 64-bit Gentoo Reply with quote

My webcam, like most other GSPCA webcams, doesn't work out-of-the-box with Skype because it requires version 1 compatibiliy libraries from libv4l. If your webcam works fine with "luvcview -f vuf" but shows up as a garbled mess in Skype, then this applies to you. This is easy to fix on 32-bit--you simply install media-libs/libv4l and then use LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so and it works. However, there is a problem on 64-bit: skype is 32-bit only, but the package installs 64-bit libraries. Skype cannot load 64-bit libraries, so this method doesn't work anymore. As of yet, portage does not provide any convenient method to install simultaneous x86/amd64 versions of packages, and plus I wanted to fix this problem without needing any custom ebuilds or overlays, so here is what I worked out.

Who this guide is for: People who need to fix their garbled webcam in Skype on amd64, and would prefer not to hack portage to install 32-bit libraries on its own.

What are the benefits of this method? It can't potentially break portage, and it is completely and easily reversible.

What are the drawbacks? It requires a bit of elbow grease on your part. I don't know how this fix will hold up if skype is upgraded to a new version.

DISCLAIMER: Messing around with libraries can be dangerous. For the purpose of this guide, pretend that /usr/lib and /usr/lib32 don't even exist. Do not touch them. Do not copy random files into them. I am not a skilled linux coder, but I believe these steps are safe. Your mileage may vary. Do not follow this guide unless you are willing to fix a broken system if it somehow fails. I don't think that's very likely though.



REQUIREMENTS: an amd64 system (if you're on x86 then just use the method described in the first paragraph!), Skype, rpm2targz, your favorite archiver (tar works), tree is helpful to check your directory structure


The Fix

What we are going to do is download some pre-built 32-bit versions of the compatibility libraries that we need, place them in /usr/local/lib32, and then edit the skype launch script to find the new libraries.

First we need to download the libraries. I found a bunch of fedora rpm's for this package and I randomly tried the first one I saw, and it worked. http://rpm.pbone.net/index.php3/stat/4/idpl/11376390/com/libv4l-0.5.8-1.fc11.i386.rpm.html Here is the link to the package. Download libv4l-0.5.8-1.fc11.i386.rpm to someplace out of the way, like your desktop or something. Don't put it at /, you'll end up with files in places you don't want them. Convert the rpm to a tar:

Code:
rpm2tar libv4l-0.5.8-1.fc11.i386.rpm


Now extract the tar file:

Code:
tar -xvf libv4l-0.5.8-1.fc11.i386.tar


You'll end up with a folder called 'usr' in your current directory. This is why we didn't extract the tar file at /--if we did, the files we extracted would go right into our /usr/lib folder. That would be bad. Now we need to copy the libraries to /usr/local/lib32. please be careful with this command. notice that there is NOT a leading / in the first argument, but there IS a leading / in the second argument!

Code:
 cp -rv usr/lib/* /usr/local/lib32


Double-check the directory structure of /usr/local/lib32, it should look like this:
Code:
hamlet /usr/local/lib32 # tree
.
|-- libv4l
|   |-- v4l1compat.so
|   `-- v4l2convert.so
|-- libv4l1.so.0
|-- libv4l2.so.0
`-- libv4lconvert.so.0


Now we need to edit the skype startup script to see these libraries. /usr/bin/skype isn't a program itself, its just a bash script that calls /opt/skype/skype. Make a backup of your original skype script just in case:

Code:
cp /usr/bin/skype /usr/bin/skype.backup


Open up /usr/bin/skype in your favorite text editor. I'll show what mine looks like now, and I'll explain the changes I've made:

Code:
#!/bin/sh
cd "/opt/skype"
if [ -n "/opt/skype" ] ; then
        if [ "${LD_LIBRARY_PATH+set}" = "set" ] ; then
                export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/opt/skype:/usr/local/lib32"
        else
                export LD_LIBRARY_PATH="/opt/skype:/usr/local/lib32"
        fi
fi
export LD_PRELOAD=/usr/local/lib32/libv4l/v4l1compat.so
exec /opt/skype/skype "$@"


Here are the changes I made:
1. at the end of both "export LD_LIBRARY_PATH" statements I added /usr/local/lib32.
2. right before the exec statement I added "export LD_PRELOAD=/usr/local/lib32/libv4l/v4l1compat.so"

Now run /usr/bin/skype, and your webcam should work!

MAINTENANCE
1. if you ever decide to remove this fix, just delete these libraries in /usr/local/lib32 and restore the skype script from the backup you made. Or, re-emerging skype would probably replace it with the original as well. My /usr/local/lib32 is empty other than these files so its easy to find and remove them, but if you have other things there then you could theoretically use any other arbitrary directory. Just change my directions accordingly.
2. As mentioned above, if you re-emerge skype it will probably overwrite the /usr/bin/skype script to the default one. You may want to make a backup of your modified script to /usr/bin/skype.fixed or something in case this happens.

This method worked great for me, but I'm very interested in other people's feedback. Especially if I am doing something here that is more dangerous than I realize. I hope it is helpful to other people who need skype on amd64! :D
_________________
“Isn’t it enough to see that a garden is beautiful without having to believe that there are fairies at the bottom of it too?”
– Douglas Adams
Back to top
View user's profile Send private message
rmanola
n00b
n00b


Joined: 30 Jun 2009
Posts: 2

PostPosted: Sat Jul 18, 2009 1:25 pm    Post subject: Reply with quote

Worked great for me. Thanks very much for the contribution!!
Back to top
View user's profile Send private message
nalldrin
n00b
n00b


Joined: 04 Nov 2003
Posts: 19
Location: Pittsburgh, PA

PostPosted: Sun Jul 26, 2009 3:27 am    Post subject: Worked here too Reply with quote

Worked for me too. Thanks!
Back to top
View user's profile Send private message
Black
Apprentice
Apprentice


Joined: 10 Dec 2002
Posts: 158
Location: Québec, Canada

PostPosted: Sun Aug 02, 2009 9:20 pm    Post subject: Reply with quote

Oh yes, you're the man! :) It works on my Logitech webcam too, which is using the zc3xx driver.

Quick note: permissions! I run with umask 077, so unless I do the following, my normal user account can't load the libraries.

Code:
chmod 750 /usr/local/lib32/* -R
chgrp video /usr/local/lib32/* -R

This will restrict the webcam to users in the video group, but if you want it unrestricted, use 755 instead of 750 and you can ignore the second line above.
Back to top
View user's profile Send private message
nadir-san
Apprentice
Apprentice


Joined: 29 May 2004
Posts: 174
Location: Ireland

PostPosted: Wed Aug 05, 2009 8:42 pm    Post subject: Reply with quote

seems not to be working, in gdb it reports


Code:
ERROR: ld.so: object '/usr/local/lib32/libv4l/v4l1compat.so' from LD_PRELOAD cannot be preloaded: ignored.
Back to top
View user's profile Send private message
Black
Apprentice
Apprentice


Joined: 10 Dec 2002
Posts: 158
Location: Québec, Canada

PostPosted: Fri Aug 07, 2009 7:46 pm    Post subject: Reply with quote

Can you post the result of:

Code:
ls -l /usr/local/lib32/
ls -l /usr/local/lib32/libv41/
Back to top
View user's profile Send private message
bartek
Tux's lil' helper
Tux's lil' helper


Joined: 16 Mar 2004
Posts: 83
Location: Poland, Pysznica

PostPosted: Sat Aug 15, 2009 10:08 pm    Post subject: Reply with quote

nadir-san wrote:
seems not to be working, in gdb it reports


Code:
ERROR: ld.so: object '/usr/local/lib32/libv4l/v4l1compat.so' from LD_PRELOAD cannot be preloaded: ignored.

Have the same problem

Code:
ls -l /usr/local/lib32/
ERROR: ld.so: object '/usr/local/lib32/libv4l/v4l1compat.so' from LD_PRELOAD cannot be preloaded: ignored.
razem 132
drwxr-xr-x 2 bartek users   112 08-15 23:57 libv4l
-rwxr-xr-x 1 bartek users 17116 2009-01-11  libv4l1.so.0
-rwxr-xr-x 1 bartek users 36252 2009-01-11  libv4l2.so.0
-rwxr-xr-x 1 bartek users 76056 2009-01-11  libv4lconvert.so.0

ls -l /usr/local/lib32/libv4l/v4l1compat.so
ERROR: ld.so: object '/usr/local/lib32/libv4l/v4l1compat.so' from LD_PRELOAD cannot be preloaded: ignored.
-rwxr-xr-x 1 bartek users 4192 2009-01-11  /usr/local/lib32/libv4l/v4l1compat.so
Back to top
View user's profile Send private message
Black
Apprentice
Apprentice


Joined: 10 Dec 2002
Posts: 158
Location: Québec, Canada

PostPosted: Sat Aug 15, 2009 11:20 pm    Post subject: Reply with quote

Permissions look good... How about:
Code:
~ $ file /usr/local/lib32/libv4l/v4l1compat.so


I get:
Code:
/usr/local/lib32/libv4l/v4l1compat.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, stripped
Back to top
View user's profile Send private message
bartek
Tux's lil' helper
Tux's lil' helper


Joined: 16 Mar 2004
Posts: 83
Location: Poland, Pysznica

PostPosted: Sun Aug 16, 2009 5:43 pm    Post subject: Reply with quote

Black wrote:
Permissions look good... How about:
Code:
~ $ file /usr/local/lib32/libv4l/v4l1compat.so


I get:
Code:
/usr/local/lib32/libv4l/v4l1compat.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, stripped

Mine looks the same
Code:
X2 lib32 # file /usr/local/lib32/libv4l/v4l1compat.so
/usr/local/lib32/libv4l/v4l1compat.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, stripped
Back to top
View user's profile Send private message
Black
Apprentice
Apprentice


Joined: 10 Dec 2002
Posts: 158
Location: Québec, Canada

PostPosted: Sun Aug 16, 2009 5:54 pm    Post subject: Reply with quote

bartek wrote:
Mine looks the same


Hmmm... Do you have a multi-lib system or only pure 64bits? Mine is multi-lib.
Back to top
View user's profile Send private message
shabbychef
n00b
n00b


Joined: 08 Jun 2005
Posts: 43

PostPosted: Tue Aug 18, 2009 1:05 am    Post subject: does it work in 32bit chroot? Reply with quote

I am about to dive into the skype video call mess on my amd64 machine. (don't even have the webcam yet..) has anyone tried skype video conferencing under a 32bit chroot instead of downloading the library, untarring, etc?

thanks,
_________________
shabby
Back to top
View user's profile Send private message
bartek
Tux's lil' helper
Tux's lil' helper


Joined: 16 Mar 2004
Posts: 83
Location: Poland, Pysznica

PostPosted: Fri Aug 21, 2009 2:54 pm    Post subject: Reply with quote

Black wrote:
bartek wrote:
Mine looks the same


Hmmm... Do you have a multi-lib system or only pure 64bits? Mine is multi-lib.

At first I had multilib, after that I made it pure and now it is multilib again.
Back to top
View user's profile Send private message
MalleRIM
Guru
Guru


Joined: 23 Jul 2007
Posts: 563
Location: China

PostPosted: Tue Aug 25, 2009 11:31 am    Post subject: Reply with quote

Thanks for this guide, it also helped me to get my webcam working in skype!
But, for a more "gentoo-way":
don't use the rpm, instead emerge it from portage using the -B (--buildpkgonly) option:
Code:
ABI=x86 emerge -B libv4l
cd /usr/local/lib32
tar xvjfp /var/portage/packages/All/libv4l-0.5.3.tbz2
mv /usr/lib32/* .
rm -r /usr/lib32 # this could probably be done differently, but I couldn't be bothered to study the tar manpage


and then, dont mess around with /usr/bin/skype, use a cleaner way:
Code:
nano /usr/bin/local/skype
# paste the script code mentioned by ksp7498, save, exit #
chmod +x /usr/bin/local/skype


/usr/local/bin is preferred over /usr/bin, so anytime you run the command "skype" it will start /usr/local/bin/skype
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum