-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathcheck.sh
More file actions
43 lines (35 loc) · 993 Bytes
/
Copy pathcheck.sh
File metadata and controls
43 lines (35 loc) · 993 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/bash
# Set the shared library file
LIBFILE="Rfast.so"
# Ensure the file exists
if [[ ! -f "$LIBFILE" ]]; then
echo "Error: File $LIBFILE not found!"
exit 1
fi
echo "Checking if $LIBFILE references R_lsInternal..."
nm -gU "$LIBFILE" | grep R_lsInternal
if [[ $? -eq 0 ]]; then
echo "✅ Found R_lsInternal in $LIBFILE!"
exit 0
else
echo "❌ R_lsInternal not found in $LIBFILE. Checking dependencies..."
fi
# Get the linked libraries
LIBS=$(ldd "$LIBFILE" | awk '{print $3}' | grep -v "(")
if [[ -z "$LIBS" ]]; then
echo "No dependencies found or ldd failed!"
exit 1
fi
# Check each linked library for R_lsInternal
for lib in $LIBS; do
if [[ -f "$lib" ]]; then
echo "🔍 Searching in $lib..."
nm -gU "$lib" 2>/dev/null | grep R_lsInternal
if [[ $? -eq 0 ]]; then
echo "✅ Found R_lsInternal in $lib!"
exit 0
fi
fi
done
echo "❌ R_lsInternal not found in any linked libraries."
exit 1