http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58900
Bug ID: 58900
Summary: parsing bug: undefined reference for libraries,
specified before source files
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Severity: major
Priority: P3
Component: other
Assignee: unassigned at gcc dot gnu.org
Reporter: nick87720z at gmail dot com
Just an example. I have simple hand-written makefile, which builds executable
with one line. These commands will fail:
$ gcc ${common_flags} ${GTK_FLAGS} -o file_loader file_loader.c
file_loader_callbacks.c
$ gcc -o file_loader ${common_flags} ${GTK_FLAGS} file_loader.c
file_loader_callbacks.c
And only this works:
$ gcc -o file_loader file_loader.c file_loader_callbacks.c ${common_flags}
${GTK_FLAGS}
Strongest trick is that it breaks automatic rules from working (when you just
specify standard things like CC,CFLAGS,LDFLAGS and specify targets with
requirements, not specifying exact commands for each target).
Versions.
OS - ubuntu 12.04. Specified version is gcc-4.8 (Ubuntu 4.8.1-2ubuntu1~12.04)
4.8.1. But it also happens with
* gcc-4.6 (Ubuntu/Linaro 4.6.4-1ubuntu1~12.04) 4.6.4
* gcc-4.7 (Ubuntu/Linaro 4.7.3-2ubuntu1~12.04) 4.7.3 (this i have set default
for now)