Creating safe extensions


Forum: myDSL Extensions (deprecated)
Topic: Creating safe extensions
started by: mikshaw

Posted by mikshaw on Aug. 15 2004,21:02
I've been trying to do the best I can at creating extensions which will cause as little trouble as possible.  From what I understand, the safest way to accomplish this is to try to install everything into /opt and $HOME.  This not only helps people with less RAM, but also prevents possible overwriting of files already installed on the system.  If a user has installed a certain lib which is required by a certain application, it could be harmful to reinstall that lib with a different version.  In some situations I've tried to install a link to an existing lib, and so far it seems to work....but this is not ideal...i'd like to be able to add these libs or symlinks to /opt instead of */lib.

I keep running into applications which require libs not included in DSL, and usually I trash the extension if I can't work around it...so what i'm hoping to do is get a better idea of how applications call for these libs, and try to find a way to incorporate them into the extension while leaving the system untouched.  I understand that wrappers can be used to point the application to certain libs, but is this specific to the application?

For example, today I'm attempting to make an extension for Audacity...the sources for most of the recommended libs are included, so I assumed that they'd be installed along with the application...particularly when some of the configure options are "--with-libsndfile=local".  However, after installing the program into /opt/audacity/, I discovered that the libs were installed into the system lib dirs instead of /opt/audacity/lib/.

I started thinking that perhaps copying the libs into /opt/audacity/lib/ would work if i made a wrapper including the line "sudo ldconfig /opt/audacity/lib"...but this seems kinda sloppy to do each time you run the program, and I'm not even sure it would work.

Does anyone have some suggestions on other ways to include libs into extensions, or how to make wrappers to point the application to specific lib directories?

thanks.

Posted by ke4nt1 on Aug. 15 2004,23:29
Search the forums for ways to export your paths..
roberts has some examples of this technique posted.

Begin by placing your startup commands in a script, to be used as a shell wrapper...
Add the commands "export PATH=/opt/audacity/lib, $PATH" etc...
Don't quote this , as I'm roughly doing this from memory...
Many other users here are much more gifted in wrappers than I ...

Sometimes, even this doesn't work, depending on how the program was written..  

Some of the other extensions I have moved to /opt had command-line options
to point to a dir for file support, like "--config-dir /opt/filename/path/ " ...

And some just can't be done...  without altering the sources of builds...
They simply ARE going to look in xyz directory, no matter what, regardless of path...

73
ke4nt

Posted by mikshaw on Aug. 16 2004,02:53
ok...so it is as i assumed....different ways for different applications.
I've got a fairly good understanding of how variables work, but I didn't know that $PATH had anything to do with libs.
One thing I found annoying with the current project is that audacity seems to have no command line options.  However, I see now that it does have an environmental variable $AUDACITY_PATH, which may be what I'm looking for =o)
Thanks, as always, for the input.

Posted by ke4nt1 on Aug. 16 2004,05:30
Yep,
I think you've got it..

73
ke4nt

Posted by nucpc on Aug. 16 2004,19:58
Hi Mikshaw,
                  You could try suggesting that a future version of DSL could
include a directory, /lib, in /opt (so /opt/lib) that is cited in /etc/ld.conf.so....
..... as you might guess, being me and a live user and having scant regard for
what others consider sacrosanct I use a tiny little .tar.gz to do exactly that
(i.e. creates the directory and overwrites ld.conf.so). Its read in before
the .dsl's and if I want any library then it can just go in /opt/lib from the
start........sweet as.....but not exactly inkeeping with the title of your post,
perhaps....

     All the best.

Posted by mikshaw on Aug. 16 2004,20:09
That's not a bad idea, but it still doesn't address the possibility of overwriting libs between extensions, because you're still using a shared lib directory.  What I hope to achieve is a way to point a specific application to a specific lib directory, i.e. $PREFIX/lib.
Additionally, my hope is to keep from making any chages to the base DSL system...writing to /etc/ld.conf.so is not an option for me.

It seems that one issue I'm trying to avoid stems from the way in which DSL extensions work as opposed to typical packages such as .deb, and to apt-get.  Apt-get, for example, checks for dependencies and downloads them if necessary.  With DSL extensions, the packager manually deals with dependency checking while putting together the package.  After this point, there is no checking...the package is simply installed, and if the user already has a particular file, whether it be the actual lib or a symlink, that file is overwritten automatically.  This could cause previously installed programs to fail.  I don't know what the chances of this are, but the fact remains that it is a possibility.

It would help if I understood better about modifying sources...i know a decent amount about bash, but next to nothing about programming.

Posted by nucpc on Aug. 16 2004,20:39
Yep I think I know exactly your problem.....and I'm also, afraid, not skilled enough to
help you. For random order loaded extensions you need exactly what you suggest
but I guess most of them will be constructed to use shared libraries......tricky.

An /opt/lib with it's citation up first might at least provide you a `one at a time' check,
while keeping you off the base system. Whilst on the subject an /opt/bin, already
cited in /etc/profile, might also help you recover from an extension clash.......i.e.
clean out /opt/bin and /opt/lib and start again.....and yep.... my .tar.gz does this as
well (bye bye old /etc/profile)

Cheers.

Posted by nucpc on Aug. 16 2004,20:42
Oh yes, just to confirm I'm not suggesting that you use my .tar.gz approach (that's
pure personal use)  just that if the directories and their citations were already there then
things might be a bit cleaner..........

Posted by roberts on Aug. 16 2004,20:52
mikshaw,

A good example of a wrapper concerning the separation of the apps libs is provided in the abiword.dsl

The approach you are talking about is a good one and follows the approach used in the construction of abiword.

I have pasted it here. But best to try abiword and the look in /opt/abiword

export PATH=/opt/abiword/bin:$PATH
export LD_LIBRARY_PATH=/opt/abiword/lib
abiword

Posted by mikshaw on Aug. 20 2004,04:16
Thank you, robert...$LD_LIBRARY_PATH is exactly what I needed to get this working!

$AUDACITY_PATH is apparently just for configs and maybe plugins.
The extension seems to be working now...I tested a few of the builtin effects and some random edits on an mp3 file, and had no troubles.  Playback seems to be a lot smoother than with Sweep, too.
I just wish the interface was a little slimmer, though...it would probably be a much smaller package if it just used text menus instead of those big candy icons.

Posted by ke4nt1 on Aug. 20 2004,04:25
Oh Boy! Oh Boy! Oh Boy! Oh Boy!
( foaming mouth, glazed eyes, slight drool escaping from face )
:p
73
ke4nt

Posted by mikshaw on Aug. 20 2004,04:40
I'm sending it to you now, but I'm on a pots line, so 5mb is gonna take a few minutes.

BTW...I was contemplating adding an icon to this one, even though I don't use them myself....but I can't figure out how xtdesktop handles duplicate coordinates.  It seems that if you have two icons with the same coordinates, they overlap instead of the second one getting nudged to an open spot.  This isn't so bad, but I noticed that when I edited the icon file manually and then re-displayed the icons, I ended up with two copies of that icon.  This seems really messy, with no apparent way to fix it.

Posted by mikshaw on Aug. 20 2004,21:05
poop....
I just noticed that I compiled it without ID3 tag support.  That won't break it, but I'd like this to be as useful as possible.  I just downloaded the source for libid3tag, and I'll recompile.  However, I think I'm going to wait a bit to see if there are any other changes necessary.  So....please feed me some backs! :p

Posted by adraker on Aug. 20 2004,21:41
I once had a hd install of damnsmall,and installed
audacity from stable with synaptic.
It seemed ok,but would segfault after about
30 seconds of recording.
I just tried Henriques dsl pack of audy,
but found it did the same thing,segfaulting
after a short period of actual recording.
This was live cd.
Just wanted to say look out for that!

Regards,

Adraker

Posted by mikshaw on Aug. 20 2004,23:29
Thanks!  I'll check that out.
What was the recording source you used?
I wasn't aware that there was already an Audacity extension ???

I want to take back my statement about the configure script being stupid...the source is actually quite brilliant.  It includes a lib-src directory into which you can add sources for various libraries, and the makefile will add those libs to your program....pretty sweet.

Posted by adraker on Aug. 21 2004,01:41
Mikshaw-

On the hd install,I was using a turntable with
a line amp I built into line in of sound card.

On the live cd example with Henriques
Audacity, I was using Winfast TV2000 TV/FM
card with fmtools.deb and wmtune.deb.
I probably messed something up installing
deb packages.

Pity there's nothing worth listening to on
FM around these parts.
BTW, your sweep works fine.
I wish you the best of luck with your Audacity
build, for much like ke4nt1, my eyes are glazing over
and saliva glands are in overdrive with the thought
of your package being available!
I've just never had any luck with Audacity except
under windows- and we all know what thats like,
don't we kids !?!  

                             
Adraker

PS  libmp3lame.so is poised and at the ready!
     ..... but no pressure from this end.......! :D

Posted by mikshaw on Aug. 21 2004,15:49
What version of Audacity were you using?
I was just going through the changelog for 1.2.1, and one fix is:
"Fix a crash when the temporary directory is not available at startup"
This sounds suspiciously like it could cause a crash during recording.

Posted by mikshaw on Aug. 21 2004,22:10
Rebuilding the Audacity package is going okay so far.

I've added id3 tag support and a desktop icon.
After a little search both here and at xtdesktop site, it seems there's not much to be said about overlapping icons, so I just threw in a couple of numbers for coordinates.

Removing the help file doesn't seem to work, even after compiling with "--with-help=no" and again with "--without-help".  Either way the help still gets included.  If it's removed after compiling, Audacity will ask for the help file's location.  If it's removed before compiling, the compile fails.  So there's 100k that I guess will be remaining in the package.

rebuilding with a different interface (I really don't care for those big buttons) is something I'm either not going to do, or I'll put it off for a future release.  I was hoping to find some replacements online because I don't enjoy editing such tiny images (one example is included with the source, but I don't like those icons either :laugh:).  I didn't find anything.

Posted by adraker on Aug. 21 2004,23:22
FB for mikshaw-

just tried Audacity,took it for a
4 minute run,works goodly.
I knew you wouldn't do a
half-assed job!
This was your 1.21, I think I had previously
used 0.98 on HD install and I dont remember
what Henriques dsl package was,I no longer have it.
I put libmp3lame.so in dsl home and exported mp3.
I was using FMtools.deb and WMtune.deb also.
This is great!- thankyou!
I also loaded the Flux package,but I don't know what
it's features are,so I don't know what changes I'm
looking for...yet...
Anyhoo, just wanted to give some feedback.


Adraker      :D

Posted by mikshaw on Aug. 22 2004,00:46
Thank you for the feedback.  I'll probably put together the new package with icon+libid3tag tonight...but I want to go through it a little more carefully first and see if there is anything else I can do to cut down the filesize.  5mb isn't too bad, but i'd like to at least try to crunch it a bit more.

On another subject, I just downloaded something called "TinyQ", which is apparently a stripped-down version of QT.  
< http://www.uwyn.com/projects/tinyq/ >
If I can get that into a DSL extension, it may open up more possibilities for other applications.  I've been wanting to do Hydrogen, but being QT-based I didn't want all that overhead...this may be the ticket.  The source archive is around 1mb, so that's really decent compared to the original 17mb QT

Posted by ke4nt1 on Aug. 22 2004,05:49
The new audacity package works great for my box..
I used several effects, edited both wavs and mp3's,
Recorded some sounds via a small mic, no problems...

Ended up with a chopped and screwed version of
"It's Been Awhile" by Staind - cool  :)

73
ke4nt

Posted by melange8272 on Sep. 03 2004,13:45
Quote (adraker @ Aug. 21 2004,19:22)
I put libmp3lame.so in dsl home and exported mp3.

Where can I find libmp3lame.so? I am having problems exporting to mp3. Other than that, I have had no trouble with the dsl package..

SWEETNESS..

:cool:

Posted by mikshaw on Sep. 03 2004,14:06
It's part of < Lame >
If you have a system upon which to compile, you can download the source above.  Otherwise, do a search for lame debian packages.

I'm not sure exactly why I didn't include it with the package, but there seems to be some patent problems with mpeg encoders...which may just possibly cause legal battles.  I haven't heard of anything serious yet, but a lot of software developers avoid including mp3 encoders just to avoid all possible trouble.
< http://web.media.mit.edu/~eds/mpeg-patents-faq >

Powered by Ikonboard 3.1.2a
Ikonboard © 2001 Jarvis Entertainment Group, Inc.