stubs: replace useless libs with headers - dbus, dbus-glib..
- technosaurus
- Posts: 4853
- Joined: Mon 19 May 2008, 01:24
- Location: Blue Springs, MO
- Contact:
stubs: replace useless libs with headers - dbus, dbus-glib..
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.
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.
- Attachments
-
- de-bus-0.0.pet
- (9.42 KiB) Downloaded 728 times
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].
- technosaurus
- Posts: 4853
- Joined: Mon 19 May 2008, 01:24
- Location: Blue Springs, MO
- Contact:
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
then made a symlink for dbus (see inside package for details)
Now to see if it works with prebuilt mozillas.
(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: Select all
cc -shared -Wl,-soname,libdbus-glib-1.so.2,-s -o libdbus-glib-1.so.2 stubs.o
Now to see if it works with prebuilt mozillas.
- Attachments
-
- nobus-0.2-i486.pet
- (5.18 KiB) Downloaded 960 times
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].
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.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.
Do you know a good gtkdialog program? Please post a link here
Classic Puppy quotes
ROOT FOREVER
GTK2 FOREVER
Classic Puppy quotes
ROOT FOREVER
GTK2 FOREVER
- technosaurus
- Posts: 4853
- Joined: Mon 19 May 2008, 01:24
- Location: Blue Springs, MO
- Contact:
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)
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)
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].
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...)
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...)
- technosaurus
- Posts: 4853
- Joined: Mon 19 May 2008, 01:24
- Location: Blue Springs, MO
- Contact:
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
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
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].
So does that create a "dummy" lib that can be renamed to temporarily replace the missing one?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
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 ... 846AAkiY7g
- technosaurus
- Posts: 4853
- Joined: Mon 19 May 2008, 01:24
- Location: Blue Springs, MO
- Contact:
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
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
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].
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...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.)
[color=green]Primary[/color] - Intel Pentium 4 2.40GHz, 571MB RAM, ATI Radeon 7000. Linux Mint 17 Qiana installed.
[color=blue]Secondary[/color] - Pentium 3 533MHz, 385MB RAM, ATI Rage 128 Pro ULTRA TF. Precise Puppy 5.7.1 Retro full install.
[color=blue]Secondary[/color] - Pentium 3 533MHz, 385MB RAM, ATI Rage 128 Pro ULTRA TF. Precise Puppy 5.7.1 Retro full install.