public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug other/58900] New: parsing bug: undefined reference for libraries, specified before source files
@ 2013-10-28  4:24 nick87720z at gmail dot com
  2013-10-28  4:38 ` [Bug other/58900] " nick87720z at gmail dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: nick87720z at gmail dot com @ 2013-10-28  4:24 UTC (permalink / raw)
  To: gcc-bugs

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)


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug other/58900] parsing bug: undefined reference for libraries, specified before source files
  2013-10-28  4:24 [Bug other/58900] New: parsing bug: undefined reference for libraries, specified before source files nick87720z at gmail dot com
@ 2013-10-28  4:38 ` nick87720z at gmail dot com
  2013-10-28  4:46 ` nick87720z at gmail dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: nick87720z at gmail dot com @ 2013-10-28  4:38 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58900

--- Comment #1 from nick87720z at gmail dot com ---
Posting exact makefile, which leads to this error:

/======== Makefile =======\
include_flags = "../misc"
common_flags = -O0 -g3 -ggdb3 -std=gnu99 -I${include_flags}

CFLAGS = ${common_flags} `pkg-config --cflags gtk+-2.0`
LDFLAGS = ${common_flags} `pkg-config --libs gtk+-2.0`

all: file_loader

file_loader: file_loader.c file_loader_callbacks.c
\======== Makefile =======/

$ make
cc -O0 -g3 -ggdb3 -std=gnu99 -I `pkg-config --cflags gtk+-2.0`  -O0 -g3 -ggdb3
-std=gnu99 -I `pkg-config --libs gtk+-2.0`  file_loader.c
file_loader_callbacks.c   -o file_loader
/tmp/cchQVCEN.o: In function `setup_menu':
/home/nick87720z/dev/lfhde/file_loader.c:15: undefined reference to
`gtk_menu_shell_get_type'
/home/nick87720z/dev/lfhde/file_loader.c:15: undefined reference to
`gtk_menu_bar_new'
/home/nick87720z/dev/lfhde/file_loader.c:15: undefined reference to
`g_type_check_instance_cast'
................................................................everything from
gtk2-related stuff


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug other/58900] parsing bug: undefined reference for libraries, specified before source files
  2013-10-28  4:24 [Bug other/58900] New: parsing bug: undefined reference for libraries, specified before source files nick87720z at gmail dot com
  2013-10-28  4:38 ` [Bug other/58900] " nick87720z at gmail dot com
@ 2013-10-28  4:46 ` nick87720z at gmail dot com
  2013-10-31  7:17 ` nick87720z at gmail dot com
  2013-10-31  7:36 ` nick87720z at gmail dot com
  3 siblings, 0 replies; 5+ messages in thread
From: nick87720z at gmail dot com @ 2013-10-28  4:46 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58900

--- Comment #2 from nick87720z at gmail dot com ---
Changing file_loader dependencies to object files doesn't solve problem. After
two successful compilation commands final gcc command, linking executable,
gives same error.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug other/58900] parsing bug: undefined reference for libraries, specified before source files
  2013-10-28  4:24 [Bug other/58900] New: parsing bug: undefined reference for libraries, specified before source files nick87720z at gmail dot com
  2013-10-28  4:38 ` [Bug other/58900] " nick87720z at gmail dot com
  2013-10-28  4:46 ` nick87720z at gmail dot com
@ 2013-10-31  7:17 ` nick87720z at gmail dot com
  2013-10-31  7:36 ` nick87720z at gmail dot com
  3 siblings, 0 replies; 5+ messages in thread
From: nick87720z at gmail dot com @ 2013-10-31  7:17 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58900

--- Comment #3 from nick87720z at gmail dot com ---
Looks like i just did not get something from gcc info book. After short search
for topics about gcc for possible describing of such error i found one
(russian), explicating it by feature to specify some libraries only for some
object/source files, specified for linker (or gcc command with same effect):
http://pyviy.blogspot.ru/2010/12/gcc.html

I got totally >3 topics, dedicated to gcc compilation process, from search (not
google - nigma), but only this describes, what happens in such case.

So, is it make's issue? (GNU Make 3.81)
I'm in a maze.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug other/58900] parsing bug: undefined reference for libraries, specified before source files
  2013-10-28  4:24 [Bug other/58900] New: parsing bug: undefined reference for libraries, specified before source files nick87720z at gmail dot com
                   ` (2 preceding siblings ...)
  2013-10-31  7:17 ` nick87720z at gmail dot com
@ 2013-10-31  7:36 ` nick87720z at gmail dot com
  3 siblings, 0 replies; 5+ messages in thread
From: nick87720z at gmail dot com @ 2013-10-31  7:36 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58900

nick87720z at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #4 from nick87720z at gmail dot com ---
Finally found it in info book, in description for -l option. Sorry for wasting
your time.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-10-31  7:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-28  4:24 [Bug other/58900] New: parsing bug: undefined reference for libraries, specified before source files nick87720z at gmail dot com
2013-10-28  4:38 ` [Bug other/58900] " nick87720z at gmail dot com
2013-10-28  4:46 ` nick87720z at gmail dot com
2013-10-31  7:17 ` nick87720z at gmail dot com
2013-10-31  7:36 ` nick87720z at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).