Subject: Re: Porting eggdrop 1.3.xx
From: [email-masked] (Kai Ruottu)

8 Dec 1998 17:24:18 -0800
Message-ID: <[email-masked]>
References: <[email-masked]>
Reply-To: [email-masked]
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7BIT
To: Hugo Leote <[email-masked]>
Cc: [email-masked]

Hugo Leote wrote:

> I'm one step away from compiling eggdrop1.3.22 sucessfully with cygwin32.
> Unfortunately I still get the following linking problem:
> 
> *****************************************
> 
> Linking eggdrop...(statically)
> 
> gcc -o ../eggdrop botcmd.o botmsg.o botnet.o chanprog.o cmds.o dcc.o dccutil.o f
> lags.o language.o main.o mem.o misc.o modules.o net.o tcl.o tcldcc.o tclhash.o t
> clmisc.o tcluser.o userent.o userrec.o users.o -L/cygnus/cygwin-b20/H-i586-cygwi
> n32/lib -ltcl80 -lm  mod/*.o
> mod/server.o: In function `tcl_eggserver':
> /cygnus/cygwin-b20/src/eggdrop1.3.22-pide/src/mod/server.mod/server.c:543:
>  undefined reference to `Tcl_DStringInit'
> /cygnus/cygwin-b20/src/eggdrop1.3.22-pide/src/mod/server.mod/server.c:548:
>  undefined reference to `Tcl_DStringAppendElement'
> /cygnus/cygwin-b20/src/eggdrop1.3.22-pide/src/mod/server.mod/server.c:552:
>  undefined reference to `Tcl_DStringFree'
> collect2: ld returned 1 exit status
> make[1]: *** [static] Error 1
> make: *** [static] Error 2
> 
> ******************************************
> 
> So far, I've been unable to find out why these three TCL functions are not
> recognized because they appear to be included in libtcl80.a .

 A 'generic' way to debug/solve problems in linking is to use the
'--verbose' option for the linker:

C:\users\default>ld --help

   <clip>

  -Tdata ADDRESS              Set address of .data section
  -Ttext ADDRESS              Set address of .text section
  -Ur                         Build global constructor/destructor tables
  --verbose                   Output lots of information during link
  --version-script FILE       Read version information script
  --warn-common               Warn about duplicate common symbols

   <clip>

It will then show all the objects, libraries etc. it tries to find, where
it tries, which it finds and so on...

The '-Wl,<options>' in the GCC command line (e.g. 'CFLAGS="-O -Wl,--verbose"')
will take the given <options> (separated with commas) to the linker.

Ok, in your case I would suspect the linking order, using:
     -ltcl80 -lm  mod/*.o
will fail if those 'mod/*.o' contain still unresolved symbols from the
'libtcl80.a' library. Putting the libs to be the last to search is the
common practice. Using the order :
     mod/*.o -ltcl80 -lm
could be much better... If you look at the source file names, like:
  /cygnus/cygwin-b20/src/eggdrop1.3.22-pide/src/mod/server.mod/server.c
from where you get these 'undefined reference to' errors, they seem to
be behind the 'mod/'...

Cheers, Kai
-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".