Comment 6 for bug 2035094

Revision history for this message
Dave Jones (waveform) wrote :

This is a case of it mattering where the "-l" option is specified (and it's not -raspi or arm64 specific; you can reproduce the error on a PC too):

$ gcc -O2 $(pkg-config --cflags --libs sdl2) program.c -o program && echo $?
/usr/bin/ld: /tmp/cciGcVIh.o: in function `main':
program.c:(.text.startup+0xa): undefined reference to `SDL_Init'
collect2: error: ld returned 1 exit status

$ gcc -O2 program.c -o program $(pkg-config --cflags --libs sdl2) && echo $?
0

Why gold is less fussy than bfd about the ordering when invoked from gcc, I'm not sure, but I don't think it's a bug necessarily (the gcc man page is fairly explicit that the ordering of "-l" options matters, which is what pkg-config is producing here.