Dependency overview

Share your compiler knowledge

Moderators: Joyce, Laura, Eminent-Admin

Dependency overview

Postby MartinHerrman » 21 Jan 2011, 14:48

does anyone have a dependency overview of packages installed in the official firmware? E.g. a tree that shows that transmission depends on curl, which depends on zlib, but that also gives inside in the fact that package Y also depends on zlib? (consequence: when I update transmission, I update zlib, and I also have to recompile and/or update package Y)

Would be very helpfull.. (or is there a linux command to create such a view?)
User avatar
MartinHerrman
Forum Supporter
 
Posts: 99
Joined: 08 May 2010, 11:24

Re: Dependency overview

Postby Alex » 21 Jan 2011, 15:35

For Transmission, i used these versions. Higher is better, lower is a bad idea :)

Code: Select all
http://www.zlib.net/zlib-1.2.2.tar.gz
http://www.openssl.org/source/openssl-0.9.8k.tar.gz


You can figure out dependencies with 'readelf -d <program>' This will show at least a pointer to libcrypto.so and libz.so
- Find in /lib: libcrypto.so.0.9.8
- same for zlib: libz.so.1.2.2
- Symlinks handle the rest.

Best practice, pull the /lib folder from the player itself, link against that. Only lib i added was libxml2 of which 2.7.3 is in the /opt/lib folder.

Dependencies can become troublesome on embedded systems. I guess you learn to keep track of things and of source code. Plus i documented most of the work on the wiki :)
Forum rules: viewtopic.php?t=4
Using Mediainfo: viewtopic.php?t=1110
Telnet: viewtopic.php?t=1873
Alex
Forum Goddess
 
Posts: 1799
Joined: 12 Nov 2009, 13:05

Re: Dependency overview

Postby Alex » 21 Jan 2011, 15:40

Also, this isn't entirely true:

(consequence: when I update transmission, I update zlib, and I also have to recompile and/or update package Y)


Libnose.so has say, snort() and itch() functions
Lets say, my program "blowyernose 1.0" monitors by polling itch() and acting by calling snort().

Lets, say, Later in life, Libnose.so is updated with the nostril_hair_growth() function. itch() and snort() remain.

Package Y just keeps using its old functions and working fine.
Package Z will demand a higher function, and fail to link.

Programmers almost never remove old functions. And offcourse, all software is tested in production environments before we publish it :)
Forum rules: viewtopic.php?t=4
Using Mediainfo: viewtopic.php?t=1110
Telnet: viewtopic.php?t=1873
Alex
Forum Goddess
 
Posts: 1799
Joined: 12 Nov 2009, 13:05

Re: Dependency overview

Postby MartinHerrman » 22 Jan 2011, 13:55

I follow your reasoning, but I do not fully agree.

First, as I gentoo user, I always rebuild reverse dependencies. And that's not because I like to recompile openoffice after each tiny libxml update :-)

Second, there is the issue with the limited amount of storage on the device. When I know which package uses a certain library, I can make an optimal choice between shared or static libs, plus I can configure the library such that only the functionality required by the packages that use it are build.

Yesterday I managed to compile the latest stable release of transmission, but while copying files to the unpacked firmware, I noticed that my openssl binary is huge (2 MB vs. 450kb) and I only have a libcrypto.a but not a libcrypto.so (which is in the official firmware).
User avatar
MartinHerrman
Forum Supporter
 
Posts: 99
Joined: 08 May 2010, 11:24

Re: Dependency overview

Postby Alex » 22 Jan 2011, 16:50

You don't need the openssl binary on the platform

Libcrypto seems to be linked static in your application. If you only have the .a file, the shared object was not built, and the compiler took what it needed from the .a file :)

Code: Select all
readelf -d ./your-new-transmission-binary

And tell me what the output is please.

(Kindly note that libcrypto.so is used inside other things os well.)

As a side note, i won't go debating why we chose to do things a certain way in production firmware, that's beyond the scope of this forum. I will help you with compiling stuff, offcourse :)
Forum rules: viewtopic.php?t=4
Using Mediainfo: viewtopic.php?t=1110
Telnet: viewtopic.php?t=1873
Alex
Forum Goddess
 
Posts: 1799
Joined: 12 Nov 2009, 13:05

Re: Dependency overview

Postby MartinHerrman » 23 Jan 2011, 00:11

Hehe, yes, I understand that we should not debate on that subject :-)

I'm quite sure that libcrypto is linked static in transmission, but I could check. Of course I could link to the /lib directory and use the existing openssl libraries, but I thought it would be nice to update openssl as well and use dynamic linking.

In the mean time I found this site:

http://cblfs.cross-lfs.org/index.php/OpenSSL

which provides a patch for dynamic linking. The patch for 0.9.8k (which is also on the device in the official firmware) works, but the patch for 1.0.0c doesn't work:

make[2]: Entering directory `/root/EM7075/workdir/openssl-1.0.0c/crypto/ts'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/root/EM7075/workdir/openssl-1.0.0c/crypto/ts'
if [ -n "libcrypto libssl" ]; then \
(cd ..; make libcrypto); \
fi
make[2]: Entering directory `/root/EM7075/workdir/openssl-1.0.0c'
make[3]: Entering directory `/root/EM7075/workdir/openssl-1.0.0c'
make[4]: Entering directory `/root/EM7075/workdir/openssl-1.0.0c'
make[4]: *** No rule to make target `link_a..so.1.0.0'. Stop.
make[4]: Leaving directory `/root/EM7075/workdir/openssl-1.0.0c'
make[3]: *** [do_.so.1.0.0] Error 2
make[3]: Leaving directory `/root/EM7075/workdir/openssl-1.0.0c'
make[2]: *** [libcrypto] Error 2
make[2]: Leaving directory `/root/EM7075/workdir/openssl-1.0.0c'
make[1]: *** [shared] Error 2
make[1]: Leaving directory `/root/EM7075/workdir/openssl-1.0.0c/crypto'
make: *** [build_crypto] Error 1

To me, the double . in link_a..so.1.0.0 and the missing 'c' are suspicious.

I'm not the only one having this error message:

http://www.mail-archive.com/openembedde ... 05826.html

But I don't understand the note about the 'colon'.. maybe it is not applicable to my case at all.

Any help is appreciated!

P.S. I believe that it must be possible to create a shell script that inventorizes all dependencies?
User avatar
MartinHerrman
Forum Supporter
 
Posts: 99
Joined: 08 May 2010, 11:24

Re: Dependency overview

Postby Alex » 24 Jan 2011, 11:00

I'm unsure why your openssl build fails.

Keep in mind, when building new versions, they usually contain new stuff, and as a result, are bigger than the original.
Any external libs needed, are usually in /opt/lib, i set the rpath there.

Other than that, you will run into problems sooner or later and cannot update "all" dependancies.. 'DMAOSD' and and other binary programs are closed-source for example.
Updating SAMBA and its brother NMBD will bring your problems as well, with the later binaries growing +5MB without adding anything new.

If you feel like it, you can document your build of the latest Transmission version and things you ran into, on our Wiki:
http://opensource.eminent-online.com/wi ... ompilation

You could see the -EL trick i told you before there as wel, in the examples for NZBget (uses a lot more external libs & stuff..)
Forum rules: viewtopic.php?t=4
Using Mediainfo: viewtopic.php?t=1110
Telnet: viewtopic.php?t=1873
Alex
Forum Goddess
 
Posts: 1799
Joined: 12 Nov 2009, 13:05


Return to EM7075 - Cross-compiling issues & tips

Who is online

Users browsing this forum: No registered users and 1 guest

cron