2
# autopkgtest check: Build and link against a simple shared library, to test
3
# basic binutils compile-time and run-time linking functionality.
5
# (C) 2012 Canonical Ltd.
6
# Author: Martin Pitt <martin.pitt@ubuntu.com>
11
trap "rm -rf $WORKDIR" 0 INT QUIT ABRT PIPE TERM
21
gcc -Wall -Werror -shared -o libultimate.so testlib.c
22
echo "library build: OK"
24
# should export the symbol
25
nm -D libultimate.so | grep -q 'T ultimate_answer'
27
# link it against a program
28
cat <<EOF > testprog.c
31
int ultimate_answer();
35
assert (ultimate_answer() == 42);
40
gcc -Wall -Werror -L . -o testprog testprog.c -lultimate
41
echo "program build: OK"
43
LD_LIBRARY_PATH=. ./testprog