×× error while loading shared libraries ××

××: error while loading shared libraries: ××.so.19: cannot open shared object file: No such file or directory

启动某些程序时,对应的链接库找不到解决方案

[root@feng1 build]# ttyd --help
ttyd: error while loading shared libraries: libwebsockets.so.19: cannot open shared object file: No such file or directory
[root@feng1 build]# ttyd --help
ttyd: error while loading shared libraries: libjson-c.so.5: cannot open shared object file: No such file or directory

这里表示程序运行需要libwebsockets.so.19libjson-c.so.5两个动态链接库里的函数,但在对应的目录下又找不到,linux下的动态链接库由ld.so负责加载,而他的配置文件在etc/ld.so.conf中,发现其中配置的/usr/local/lib下确实没有我们要的××.so文件,我们可以手动添加指定路径来解决这个报错问题

/environment/libwebsockets/build/lib		## libwebsockets.so.19 所在的目录
/cpack/json-c/build					## libjson-c.so.5 所在的目录

然后刷新一下缓存,再次运行就成功了

[root@feng1 build]# sudo ldconfig		## 以防万一加个sudo就完了

[root@feng1 build]# ttyd --help
ttyd is a tool for sharing terminal over the web

USAGE:
    ttyd [options] <command> [<arguments...>]

VERSION:
    1.6.3-3e37e33

OPTIONS:
    -p, --port              Port to listen (default: 7681, use `0` for random port)
    -i, --interface         Network interface to bind (eg: eth0), or UNIX domain socket path (eg: /var/run/ttyd.sock)
    -c, --credential        Credential for basic authentication (format: username:password)
    -H, --auth-header       HTTP Header name for auth proxy, this will configure ttyd to let a HTTP reverse proxy handle authentication
    -u, --uid               User id to run with
    -g, --gid               Group id to run with
    -s, --signal            Signal to send to the command when exit it (default: 1, SIGHUP)
    -w, --cwd               Working directory to be set for the child program
    -a, --url-arg           Allow client to send command line arguments in URL (eg: http://localhost:7681?arg=foo&arg=bar)
    -R, --readonly          Do not allow clients to write to the TTY
    -t, --client-option     Send option to client (format: key=value), repeat to add more options
    -T, --terminal-type     Terminal type to report, default: xterm-256color
    -O, --check-origin      Do not allow websocket connection from different origin
    -m, --max-clients       Maximum clients to support (default: 0, no limit)
    -o, --once              Accept only one client and exit on disconnection
    -B, --browser           Open terminal with the default system browser
    -I, --index             Custom index.html path
    -b, --base-path         Expected base path for requests coming from a reverse proxy (eg: /mounted/here, max length: 128)
    -P, --ping-interval     Websocket ping interval(sec) (default: 5)
    -S, --ssl               Enable SSL
    -C, --ssl-cert          SSL certificate file path
    -K, --ssl-key           SSL key file path
    -A, --ssl-ca            SSL CA file path for client certificate verification
    -d, --debug             Set log level (default: 7)
    -v, --version           Print the version and exit
    -h, --help              Print this text and exit

Visit https://github.com/tsl0922/ttyd to get more information and report bugs.
[root@feng1 build]#

你可能感兴趣的:(Bug遭遇解决记录,linux,linux,运维,服务器)