[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cannot see CFLAGS

From: Benoit SIGOURE
Subject: Re: Cannot see CFLAGS
Date: Mon, 22 Oct 2007 18:56:22 +0200

On Oct 22, 2007, at 5:07 PM, Hongliang Wang wrote:

Hello, all.

I built two libraries in two directories (gen and ora) respectively and now are building the executable program in "util" directory linked against the previous libraries. However, errors arise when compling.

address@hidden> make
make  all-recursive
make[1]: Entering directory `/export/guam/jigsaw/dev/jhwgu/src/jz'
Making all in gen
make[2]: Entering directory `/export/guam/jigsaw/dev/jhwgu/src/jz/gen'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/export/guam/jigsaw/dev/jhwgu/src/jz/gen'
Making all in ora
make[2]: Entering directory `/export/guam/jigsaw/dev/jhwgu/src/jz/ora'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/export/guam/jigsaw/dev/jhwgu/src/jz/ora'
Making all in util
make[2]: Entering directory `/export/guam/jigsaw/dev/jhwgu/src/jz/ util' gcc -g -O2 -o zizzy -ggdb `pkg-config --libs glib-2.0` zizzy- main.o zizzy-dictionary.o zizzy-dump.o zizzy-zop.o ../gen/ libzizzy.a ../ora/libzizora.a -lm ../ora/libzizora.a(zizoraread.o)(.text+0x50): In function `ZOraLogFileClose': /home/jigsaw/dev/jhwgu/src/jz/ora/zizoraread.c:197: undefined reference to `ZFClose'

[more undefined references]
Your undefined references come from the libzizora.a, are you sure you're linking the libraries in the right order? The most dependent libraries have to go first. So if, say, libzizora.a use things from libzizzy.a, it must appear beforehand on the link command. If the problem is not related to linking order, then can you tell us where are defined the various missing symbols?

collect2: ld returned 1 exit status
make[2]: *** [zizzy] Error 1
make[2]: Leaving directory `/export/guam/jigsaw/dev/jhwgu/src/jz/util'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/export/guam/jigsaw/dev/jhwgu/src/jz'
make: *** [all] Error 2

This is my in util
---------------------------------------------------------------------- ----------
# util/

bin_PROGRAMS = zizzy

zizzy_SOURCES = main.c dictionary.c dictionary.h dump.c dump.h zop.c zop.h hl.env

zizzy_LDADD = ../gen/libzizzy.a ../ora/libzizora.a
zizzy_CFLAGS = -Wall -Werror `pkg-config --cflags glib-2.0`
zizzy_LDFLAGS = -ggdb `pkg-config --libs glib-2.0`



So I have  two questions:

1, why cannot I see zizzy_CFLAGS in the output message? I can only find zizzy_LDFLAGS.

Because `CFLAGS' means ``Compilation FLAGS'' and as such they do not need to be used when linking. So they're not used when linking. Similarily, `LDFLAGS' aren't used during the compilation, they're only passed to the ``Link eDitor'' (I guess that's where `LD' comes from).

2, why does the compiler trying to re-compile the library file (gen/ libzizzy.a ora/libzizora.a), but not to use them directly?

I don't see where it's trying to re-compile the library.

Benoit Sigoure aka Tsuna
EPITA Research and Development Laboratory

Attachment: PGP.sig
Description: This is a digitally signed message part

reply via email to

[Prev in Thread] Current Thread [Next in Thread]