I am following an install procedure and it indicates downloading a .so file and creating a link to it:

sudo ln -s $(DynamsoftBarcodeReader)/lib/libDynamsoftBarcodeReader.so /usr/lib/libDynamsoftBarcodeReader.so

Why not just copy the .so file to the directory /usr/lib? Is there an advantage or penalty to using a hard link over copying the file to /usr/lib?

1 Answer 1


Far from a Pi specific question but:

  • First, -s is not a hard link. It's a symbolic, aka. soft one.

Is there an advantage or penalty?

Neither. However, doing this in /usr/lib (either copying or linking) is not a good practice. That's where distro stuff goes, and at some point something may get overwritten one way or another.

User installed libs should go into /usr/local/lib. An advantage to this, besides the aforementioned not having any toes get stepped on, is that if there does end up being a distro version installed, the /usr/local version will take precedence, which is usually what people want when they go to the trouble of manually installing something.

Further, you should run sudo ldconfig after you do this, otherwise the system linker will not find it no matter where it is.

The fact that these two bases aren't properly covered implies to me the person who wrote that page does not understand "best practices" in this context, so there's no much point in pondering the motive for using a symlink instead of a copy.

One situation I can see it as advantageous in though is if the package is getting occasionally upgraded via a means where re-installing isn't necessarily done. The link will always point to the new version.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.