On 06/04/2018 23:20, Lars Kruse wrote: >| [...] >> I am able to execute python script after creating below soft links. >> >> ln -s /mnt/usb/usr/lib/libz.so.1 /usr/lib/libz.so.1 >> ln -s /mnt/usb/lib/libpthread.so.0 /usr/lib/libpthread.so.0 >> ln -s /mnt/usb/usr/lib/libpython2.7.so.1.0 /usr/lib/libpython2.7.so.1.0 > > The fact that you need to create symlinks manually feels wrong to me. > > I am not used to installing packages to non-root locations, thus I cannot > tell, > whether this is normal or an indication of a problem. Can you tell?
I guess that the three symbolic links above are required 'cause: - some packages have been installed inside the USB storage (/mnt/usb) and, as such, some important libraries (libz.so.1, libpthread.so.0, libpython2.7.so.1.0) are stored under such folder; - some other application (Python 2.7, I guess) is "dinamically lynked" to such libraries. This means that to succesfully run python 2.7, those libraries needs to be "retrieved and read" (as they are part of python itself!). If they are NOT found, the application (python 2.7) cannot start; - the set of folder used by Linux (and OpenWRT) to search for dynamic libraries is quite fixed and, by default: - does _NOT_ include /mnt/usr/lib nor /mnt/usb/usr/lib - _DOES_ include /usr/lib So, by defining above symbolic links, Phani is simply offering to OpenWRT a chance to find the dinamic libraries in "default folder" (/usr/lib) even if they are really stored inside /mnt/usb/usr/lib. Anyway, the proper way to solve such a problem is a bit different. As mentioned in the guide pointed by Phani in his last message: http://nixorids.blogspot.com/2013/03/installing-packages-into-usb-on-tl.html some environment variable should be "updated" (when relying on USB storage). In detail: export USB=/mnt/usb export PATH=$PATH:$USB/usr/bin:$USB/usr/sbin # This PATH is dependent on existing $PATH export LD_LIBRARY_PATH=$USB/lib:$USB/usr/lib - The first one simply define the mount-point of the USB storage; - The second one simply tell that binaries stored inside the USB should be directly accessible, without specifying a full-path; - The first, and MOST IMPORTANT, line defines _TWO_ folders (/mnt/usb/lib AND /mnt/usb/usr/lib) to be used for searching of dynamic libraries, IN ADDITION to standard ones. Actually, the LD_LIBRARY_PATH environment variables has exactly such a purpose. Hence, instead of creating the three symbolic links (and, maybe, missing several others), it's much better to define such a LD_LIBRARY_PATH. It's important to note that such a LD_LIBRARY_PATH should be defined _BEFORE_ launching the program requiring related libraries. Exactly for this reason, the same already mentioned guide refers the /etc/profile file (where the three environment variables should be defined) and the command: # source /etc/profile that, when launched, "import" such variables inside the current environment. So, in the end: 1 - remove the symbolic links; 2 - create the /etc/profile taking care to define the three variables; 3 - before launching "python", ensure to "source /etc/profile" [it's required only once] In this way, not only the three libraries above, but also any other library stored inside /mnt/usb should be accessible with not problem. Hope this help! Cheers, DV -- Damiano Verzulli e-mail: dami...@verzulli.it --- possible?ok:while(!possible){open_mindedness++} --- "Technical people tend to fall into two categories: Specialists and Generalists. The Specialist learns more and more about a narrower and narrower field, until he eventually, in the limit, knows everything about nothing. The Generalist learns less and less about a wider and wider field, until eventually he knows nothing about everything." - William Stucke - AfrISPA http://elists.isoc.org/mailman/private/pubsoft/2007-December/001935.html
signature.asc
Description: OpenPGP digital signature
_______________________________________________ openwrt-users mailing list openwrt-users@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-users