[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <0C18FE92A7765D4EB9EE5D38D86A563A0629F2@SHSMSX101.ccr.corp.intel.com>
Date: Mon, 14 May 2012 03:17:42 +0000
From: "Du, ChangbinX" <changbinx.du@...el.com>
To: "'gregkh@...uxfoundation.org'" <gregkh@...uxfoundation.org>
CC: "'mina86@...a86.com'" <mina86@...a86.com>,
"Fleming, Matt" <matt.fleming@...el.com>,
"'balbi@...com'" <balbi@...com>, "'hpa@...or.com'" <hpa@...or.com>,
"'linux-kernel@...r.kernel.org'" <linux-kernel@...r.kernel.org>,
"'linux-usb@...r.kernel.org'" <linux-usb@...r.kernel.org>
Subject: [Resend PATCH] tools/usb: fix a makefile bug
I try to compile tools/usb foler, but got below error(gcc version
4.6.3):
tools/usb/testusb.c:516: undefined reference to `pthread_create'
tools/usb/testusb.c:541: undefined reference to `pthread_join'
The reason is the makefile puts source files behind of compiler option
"-l". For gcc(and clang), it reads compiler options in order from left
to right. When compiler gets a source file, it starts parsing it and try
to resolve all symbols invoked. If compiler can not resolve a symbol, it
will read --remain-- options and try get a definition of the symbol. So,
if we put source file behind of "-l" option, the specified library will
not work.
Signed-off-by: Du Changbin <changbinx.du@...el.com>
---
tools/usb/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/usb/Makefile b/tools/usb/Makefile
index 396d6c4..e1cfd19 100644
--- a/tools/usb/Makefile
+++ b/tools/usb/Makefile
@@ -7,7 +7,7 @@ CFLAGS = $(WARNINGS) -g $(PTHREAD_LIBS) -I../include
all: testusb ffs-test
%: %.c
- $(CC) $(CFLAGS) -o $@ $^
+ $(CC) $^ $(CFLAGS) -o $@
clean:
$(RM) testusb ffs-test
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists