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

RE: Wierd compile error with libpthread.a



Sorry for the slow response.

This worked.  Actually I had to include in netlib.a and pcap.a and only link
in libpthread.  Nevertheless the problem is fixed

My only excuse is that I didn't write that mess, it was distributed by my
ISP.

Thanks much for the help

Rupe

	----------
	From:  Stephen Pitts [SMTP:smpitts@midsouth.rr.com]
	Sent:  Thursday, August 26, 1999 3:03 AM
	To:  brooks@nrcan.gc.ca; kirstin@i.am
	Cc:  debian-user@lists.debian.org
	Subject:  Re: Wierd compile error with libpthread.a

	On Thu, Aug 26, 1999 at 12:13:34AM -0400, Rupert Brooks wrote:
	> Hi,
	> 
	> Please note to CC replies to brooks@nrcan.gc.ca and kirstin@i.am.
I
	> don't follow this list all that regularly - thanks
	> 
	> I am having problems compiling a c program under Debian-Potato.  I
have
	> traced it this far:  If I compile any C program, and link in the
library
	> /usr/lib/libpthread.a then an executable will be produced, but
when
	> executed will simply lock up.
	Not quite. From what I can tell, you aren't linking pthread to your
	program, you are including it as one of the object files in your
	program. So, gcc is shoving the whole libpthread.a in your binary. 
	This works better:
	cc -funroll-loops -fomit-frame-pointer -pipe -Wall -g main.o
	pppoe-discover.o -L. -lpcap -lnet -lpthread -o pppoe

	Instead of directly specifying the path of libraries, the best way
is to
	link to them with '-l'. The linker looks first for a shared (.so)
	library (because the -shared option is implied), and then for a
static
	(.a) library. '-L.' tells the linker to also look for library files
in
	the current directory.

	The resulting executable is dynamically linked with pthread (a
standard
	libc component..no need to statically link this) and libc, and
	statically linked with everything else, per 'ldd pppoe'.


	-- 
	Stephen Pitts
	smpitts@midsouth.rr.com
	webmaster - http://www.mschess.org


Reply to: