Linux – Is it safe to just copy shared libraries onto embedded Linux device

cross-compilationdynamic-linkingembeddedlinux

The following is contained in the vendor user manual for its embedded Linux distro on the hardward board they supply

Developers can put their program onto X-Linux device via FTP or NFS.
Before running it, use ldd command on development workstation to check
dependency files. Also put relative files onto X-Linux to ensure
program can run properly. Here is an example when we put “syslinux”
onto X-Linux:

  [root@X-Linux]:/sbin # ldd syslinux 
          linux-gate.so.1 => (0xb80a0000)
          libc.so.6 => /lib/libc.so.6 (0xb7f60000) 
          /lib/ld-linux.so.2 (0xb80a1000) 
  [root@X-Linux]:/sbin # 

From above messages, /lib/libc.so.6 and /lib/ld-linux.so.2 are needed by syslinux. Put those two files onto X-Linux to ensure syslinux can work properly.

I will have to write software to run on this device and a lot of advice I have received on stack exchange points me in directions that contradict this advice (suggesting setting up specific embedded development environment, linking to older versions of libc, static linking etc). Is the above information given by the vendor a safe and reliable way to do things???

Best Answer

You can copy libraries to your embedded device provided that it's running the same operating system on the same processor architecture family. Your device has an x86 processor, which is the same family as 32-bit PCs. So if you have a 32-bit Linux system on your desktop machine, you can copy libraries and executables from your desktop machine to your device.

On the other hand, I do not recommend doing things that way. You'll end up with a jumble of files of unknown origin, with no way to manage dependencies, upgrade, or uninstall software. From what I gather from a quick glance at the manual, X-Linux is a small Linux system that is not designed to be extensible. My recommendation is to instead install another Linux distribution alongside or instead of X-Linux. If the other distribution is alongside X-Linux, run programs from that distribution in a chroot (you'll still be constrained by the X-Linux kernel).