3 # found on https://github.com/webosbrew/dev-utils/tree/main/scripts
7 if [ ! -f "${EXE}" ]; then
8 echo "Usage: $0 executable"
12 if [ ! -d "${WEBOS_ROOTFS}" ]; then
13 echo 'WEBOS_ROOTFS is not a directory'
17 lib_search_paths
="${WEBOS_ROOTFS}/lib:${WEBOS_ROOTFS}/usr/lib:${WEBOS_LD_LIBRARY_PATH}"
19 required_syms
=$
(nm
--dynamic --extern-only --undefined-only "${EXE}" |
grep ' [U] ' |
tr -s ' ' | cut
-d ' ' -f 3)
21 needed_libs
=$
(objdump
-p "${EXE}" |
grep NEEDED |
tr -s ' ' | cut
-d ' ' -f 3)
25 for lib
in ${needed_libs}; do
29 for path
in ${lib_search_paths}; do
30 lib_path
="${path}/${lib}"
31 if [ -f "${lib_path}" ]; then
33 found_libs
="${found_libs} ${lib_path}"
37 if [ ${lib_found} = 0 ]; then
39 echo "Missing library: ${lib}"
43 # shellcheck disable=SC2086
44 lib_syms
=$
(nm
--dynamic --extern-only --defined-only ${found_libs} |
grep ' [a-zA-Z] ' | cut
-d ' ' -f 3 |
tr -s '@')
46 for sym
in ${required_syms}; do
47 if ! echo "${lib_syms}" |
grep -q "${sym}"; then
49 sym_name
=$
(echo "${sym}" | cut
-d '@' -f 1 | c
++filt
)
50 if echo "${sym}" |
grep -q '@'; then
51 sym_ver
="@$(echo ${sym} | cut -d '@' -f 2)"
53 echo "Missing symbol: ${sym_name}${sym_ver}"
57 if [ ${has_missing} = 0 ]; then