b) I'm trying to build and link against a static library: gcc -g -Wall -o libdog.o libdog.c ar rcs libdog.a libdog.o
ranlib libdog.a Not really needed for a lib with just the one function, but will save pain later...
gcc -g -Wall -o sll.o sll.c ld -L. -ldog -o sll sll.o
I'd do: gcc -o sll -L. sll.o -ldog or gcc -o sll sll.o libdog.a
gcc -v indicates that "collect2" is being used rather than ld, but the *exact same* arguments can drive ld. Go figure.
ld -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o sll /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/gcc-lib/i386-linux/2.95.2/crtbegin.o -L. -L/usr/lib/gcc-lib/i386-linux/2.95.2 sll.o -ldog -lgcc -lc -lgcc /usr/lib/gcc-lib/i386-linux/2.95.2/crtend.o /usr/lib/crtn.o
The standard initialization/exit modules are now linked in.