Seu usuário LD_LIBRARY_PATH
não será, por padrão, herdado pelo ambiente sudo. De acordo com a página man sudoers ( man sudoers
):
By default, the env_reset option is enabled. This causes commands to be
executed with a new, minimal environment. On AIX (and Linux systems
without PAM), the environment is initialized with the contents of the
/etc/environment file. The new environment contains the TERM, PATH,
HOME, MAIL, SHELL, LOGNAME, USER, USERNAME and SUDO_* variables in addi‐
tion to variables from the invoking process permitted by the env_check
and env_keep options. This is effectively a whitelist for environment
variables.
Observe que é improvável que env_keep
funcione para LD_LIBRARY_PATH
pelo motivo anotado posteriormente na seção:
Note that the dynamic linker on most operating systems will remove vari‐
ables that can control dynamic linking from the environment of setuid
executables, including sudo. Depending on the operating system this may
include _RLD*, DYLD_*, LD_*, LDR_*, LIBPATH, SHLIB_PATH, and others.
These type of variables are removed from the environment before sudo even
begins execution and, as such, it is not possible for sudo to preserve
them.
Você deve encontrar uma maneira de fazer seu aplicativo ser executado sem o sudo ou instalar as bibliotecas necessárias em um dos locais de biblioteca padrão.