Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Mon 01 Sep 2014, 07:19
All times are UTC - 4
 Forum index » Advanced Topics » Cutting edge
stubs: replace useless libs with headers - dbus, dbus-glib..
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [11 Posts]  
Author Message
technosaurus


Joined: 18 May 2008
Posts: 4348

PostPosted: Sun 12 Aug 2012, 23:25    Post subject:  stubs: replace useless libs with headers - dbus, dbus-glib..
Subject description: maybe gconf and others down the line
 

It is common practice to make stub functions that return acceptable values to replace dependencies, but it is also possible in C to use macros to define functions as constants. This allows us to replace entire libraries with just a header (.h) file. I have done a bit of work on dbus and dbus-glib (the pre-alpha headers compress to <10kb and should be much less when compiled) I have an eye on gconf for the future, possibly others as I get annoyed with them.

The general idea is to look through the functions for return values and just define each function as a constant from a working return value... mostly TRUE, FALSE, 0, NULL or ""

Edit: this de-bus pet is only for packagers/developers to build against - it does not replace a runtime of dbus/dbus-glib, for that there is another project called "nobus" ...still needs testing - let me know if you try it.
de-bus-0.0.pet
Description 
pet

 Download 
Filename  de-bus-0.0.pet 
Filesize  9.42 KB 
Downloaded  411 Time(s) 

_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
technosaurus


Joined: 18 May 2008
Posts: 4348

PostPosted: Thu 13 Sep 2012, 11:36    Post subject:  

here is a small pet package of the nobus project for non-dev-types
(I built it as a shared library for use with prebuilt binaries)

I won't be updating the package, so here are the url and extra build instructions for a shared library.
https://github.com/clbr/nobus
Code:
cc -shared -Wl,-soname,libdbus-glib-1.so.2,-s -o libdbus-glib-1.so.2  stubs.o

then made a symlink for dbus (see inside package for details)

Now to see if it works with prebuilt mozillas.
nobus-0.2-i486.pet
Description 
pet

 Download 
Filename  nobus-0.2-i486.pet 
Filesize  5.18 KB 
Downloaded  471 Time(s) 

_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
disciple

Joined: 20 May 2006
Posts: 6430
Location: Auckland, New Zealand

PostPosted: Thu 13 Sep 2012, 19:58    Post subject:  

Quote:
Edit: this de-bus pet is only for packagers/developers to build against - it does not replace a runtime of dbus/dbus-glib, for that there is another project called "nobus" ...still needs testing - let me know if you try it.

I'm confused - from reading the nobus readme I thought that it did the same thing, i.e. it does not replace a runtime, it is a compile-time solution to remove the dbus dependency.

_________________
DEATH TO SPREADSHEETS
- - -
Classic Puppy quotes
- - -
Beware the demented serfers!
Back to top
View user's profile Send private message 
technosaurus


Joined: 18 May 2008
Posts: 4348

PostPosted: Thu 13 Sep 2012, 22:09    Post subject:  

It _was_ before I got a hold of it. I built it as a shared lib - which nobus lends itself to, since it uses function stubs. Mine couldn't do that, since I use macros to replace the code with constants that compile away (mostly)... it has no functions.

Edit: the reason it probably says that is that it only builds a static lib. Gcc is good at inlining small, constant functions, so it would build the same as mine with the right compiler options (de-bus minimizes the build size regardless of optimization). Note, I may need to add extern to some functions for it to work (if you get a missing symbol for a function that is in the library, it usually just needs extern before the function type declaration)

_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
Dewbie

Joined: 15 Apr 2010
Posts: 1783

PostPosted: Tue 25 Sep 2012, 20:35    Post subject:  

technosaurus wrote:
Quote:
Now to see if it works with prebuilt mozillas.

Tested SeaMonkey 2.12.1 official build and nobus-0.2-i486.pet with:
Puppy Linux 4.1.2
Puppy Linux 4.3.1
Wary 5.1.4.1.
Works with all of em! Smile
Back to top
View user's profile Send private message 
greengeek

Joined: 20 Jul 2010
Posts: 2509
Location: New Zealand

PostPosted: Wed 26 Sep 2012, 17:36    Post subject:  

I was recently trialling Gray's WaryNOP 5.1.1 which comes with Opera but I wanted to install Firefox, however FF would not run because the system did not have /usr/lib/libhunspell.so.0 available.

Is this the sort of problem that "nobus" is designed to alleviate?

(I renamed a totally different lib as the missing one and then FF ran ok, so obviously the structure of the lib is not that critical...)
Back to top
View user's profile Send private message 
technosaurus


Joined: 18 May 2008
Posts: 4348

PostPosted: Wed 26 Sep 2012, 18:04    Post subject:  

the official ff has the hunspell lib builtin iirc, but no you would get no spell checking at best, and at worst it would segfault when it tried (unless maybe you turned it off in settings, then you could just symlink some random lib to where it is looking) - hunspell is useful in other apps too - I recommend just installing it. dbus otoh doesn't do much of anything useful.

or you can make a fake anything in case it looks for the SONAME

gcc -shared -o libdummy.so.3 -Wl,-soname,libdummy.so.3 -s

_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
greengeek

Joined: 20 Jul 2010
Posts: 2509
Location: New Zealand

PostPosted: Wed 26 Sep 2012, 18:27    Post subject:  

technosaurus wrote:
or you can make a fake anything in case it looks for the SONAME

gcc -shared -o libdummy.so.3 -Wl,-soname,libdummy.so.3 -s

So does that create a "dummy" lib that can be renamed to temporarily replace the missing one?

I had wondered if it might be possible to make a generic lib (lets say called "safelib"), which, when called by some programme, would bring up a dialog saying "Library safelib has been called by programme xxx" so that there would be some indication that the missing lib had actually been accessed, whether or not the outcome was problematic.

(I have often been concerned about just adding in missing libs, because there's no easy way for me to know if it is guaranteed to be the correct lib for my system - there are so many with similar names.)

The reason for my question about nobus was that I found a forum that had pinpointed the lack of dbus and dbus-glib as being the reason for the missing hunspell
http://answers.yahoo.com/question/index?qid=20100308095846AAkiY7g
Back to top
View user's profile Send private message 
technosaurus


Joined: 18 May 2008
Posts: 4348

PostPosted: Wed 26 Sep 2012, 19:12    Post subject:  

oops:
gcc -shared blankfile.c -o libdummy.so.3 -Wl,-soname,libdummy.so.3 -s

IIRC, Barry now includes hunspell in puppy by default because you can compile mozilla products --with-system-hunspell (thus it won't work on older pups without it unless you get the hunspell package) official builds have hunspell inside their directory structure and you may have to futz around with LD_LIBRARY_PATH to find it (the included script should do it for you but puppy haz its own mozilla wrapper that may not) ... same goes for lib{z,png,jpeg,cairo,...} anyhow mozilla's source looks like someone crossed the streams or I would have contributed some fixes long ago

_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
session


Joined: 07 Feb 2011
Posts: 89
Location: Valley of the Sun

PostPosted: Thu 25 Apr 2013, 00:11    Post subject:  

greengeek wrote:
I had wondered if it might be possible to make a generic lib (lets say called "safelib"), which, when called by some programme, would bring up a dialog saying "Library safelib has been called by programme xxx" so that there would be some indication that the missing lib had actually been accessed, whether or not the outcome was problematic.

(I have often been concerned about just adding in missing libs, because there's no easy way for me to know if it is guaranteed to be the correct lib for my system - there are so many with similar names.)

Library identification would be nice; using nobus, recent versions of vanilla Seamonkey would crash on a few sites (ex. Chase Logon) and it was really through trial-and-error and chance that I discovered it was because of missing dbus(-glib) libs...

_________________
Primary - Intel Celeron 1.80GHz, 579MB RAM, ATI Rage 128 Pro ULTRA TF. Precise Puppy 5.7.1 Retro full install.
Secondary - Pentium 3 533MHz, 385MB RAM, Matrox MGA-G200 AGP. Precise Puppy 5.7.1 Retro frugal install. (IDE HD is 428 MB!)
Back to top
View user's profile Send private message 
darry1966

Joined: 26 Feb 2012
Posts: 421
Location: New Zealand

PostPosted: Fri 07 Jun 2013, 16:13    Post subject: Thankyou  

Thankyou for this handy No Bus .pet I owe you a Virtual Beer. Works well on my modified 4.12 system.
Very Happy










t
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [11 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Cutting edge
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
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0813s ][ Queries: 13 (0.0096s) ][ GZIP on ]