Is it OK to sort /etc/ld.so.conf
The entries in /etc/ld.so.conf
are searched in order. Therefore, order matters.
This only matters if the same library name (precisely speaking, the same SONAME) is present in multiple directories. If there are directories that you are absolutely sure will never contain the same library then you can put them in the order you prefer.
In particular this means that directories in /usr/local
should come before directories outside /usr/local
, since the point of these directories is to have priority over the default system files. Among distribution-managed directories, it probably doesn't matter.