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:[EMAIL PROTECTED] Sent: Thursday, August 26, 1999 3:03 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] 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 [EMAIL PROTECTED] and [EMAIL PROTECTED] 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 [EMAIL PROTECTED] webmaster - http://www.mschess.org
Wierd compile error with libpthread.a
Hi, Please note to CC replies to [EMAIL PROTECTED] and [EMAIL PROTECTED] 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. I have tried doing this with just the helloworld type Cprogram and it still locks up. If I don't link that archive, then it works fine. CTRL-C will interrupt it. I have tried looking at it with GDB, but I couldn't figure out what it is doing. That is not surprising as I am not very good with gdb. I have upgraded my libc6, and libc6-dev, and gconv-modules to the latest versions. Thanks a million in advance Rupert Brooks More details: The prog that I am trying to compile is a ppp over ethernet prog. It acts as a little pipe to connect the usual pppd to the eth0. I need it because my ADSL provider (Bell Sympatico) is switching to this method in a few days. The source code is a few hundred lines of C. I will provide it to anyone who would like to compile it themselves. Or you can get it from http://ftp.davin.ottawa.on.ca/linux/sympatico/. Unfortunately its totally undocumented and uncommented. But, if you stick a little printf early in the program, and then see if it prints when you run it, that will determine if it is getting past this problem. If someone can produce a working binary out of it, that would solve my problem, at least for now. In the longer term, I'm toying with the idea of adding PPPOE to the PPP daemon. This little prog is supposed to be really inefficient. If anyone is interested let me know. I'm a lazy, lazy man and would rather not have to do it myself.
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 [EMAIL PROTECTED] and [EMAIL PROTECTED] 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 [EMAIL PROTECTED] webmaster - http://www.mschess.org