Subject: perl -MO=CC and gcc problem
From: Pat Gilbert <[email-masked]>
To: [email-masked]
Date: Fri, 10 Aug 2001 01:41:47 -0700

I'm trying to convert a Perl script to C and compile it using gcc on NT4/SP6, 
but it ain't working out.  I must be doing something wrong.  This is my 
first experience with PC development (I'm a Unix kind of guy:) and I can't
recall the last time I used gcc, so bear with me.  I tried something similar 
with Perl 5.005 and Sun Workshop on Solaris, and it worked just fine.

So, here we go...

perl -MO=C junk.pl > junk.c

works fine.

However,

gcc junk.c -o junk.exe -I d:\cygwin\lib\perl5\5.6.1\cygwin\core -L
d:\cygwin\lib\perl5\5.6.1\cygwin\core -lperl5_6_1

results in many errors relating only to undefined refs to "PL_*" like symbols,
e.g.:
/cygdrive/c/TEMP/ccDElVwd.o(.text+0x2e8):junk.c undefined reference to
'PL_stack_sp'

If I use libperl5_6_1s.a instead (I don't know how this lib differs from the
other) I only get the following errors:

/cygdrive/c/TEMP/cceNchMj.o(.text+0x397c):junk.c: undefined reference to
'boot_DynaLoader'
d:\cygwin\lib\perl5\5.6.1\cygwin\core/libperl5_6_1s.a(pp.o)(.text+0x684f):pp.c:
undefined reference to 'crypt'

It would seem I'm missing a library or two.

What's the diff between libperl5_6_1.a and libperl5_6_1s.a?

Where is "crypt" defined (I couldn't find it using nm)?

I'd like this as a compiled entity (preferably without requiring any Cygwin
DLLs) so I can plop on any NT box and use it without having to install 
anything else.  Is this even realistic?

Help!

TIA,
	Pat

===============================================================
junk.pl:

#!perl

use Getopt::Std;

print "args = " . join('\n', @_) . "\n";

$x = getopts('C:l:u:');

print "opt_C = $opt_C\n";
print "opt_l = $opt_l\n";
print "opt_u = $opt_u\n";

===============================================================
cygcheck -s -v -r:

Cygnus Win95/NT Configuration Diagnostics
Current System Time: Fri Aug 10 00:57:35 2001

WinNT Ver 4.0 build 1381 Service Pack 6

Path:	/cygdrive/e/Perl/bin/
	/cygdrive/c/WINNT/system32
	/cygdrive/c/WINNT
	/cygdrive/c/Inoculan
	/cygdrive/c/Program Files/Perforce/2001.1
	/usr/bin
	/cygdrive/c/PAGEMGR/IMGFOLIO
	/cygdrive/c/PAGEMGR
	/cygdrive/d/vim/vim58

SysDir: C:\WINNT\System32
WinDir: C:\WINNT

!C: = `C:\'
!D: = `D:\cygwin'
!E: = `E:\PERL\lib'
!EXITCODE = `00000000'
CLASSPATH = `C:\Program Files\Exceed.nt\hcljrcsv.zip;C:\Program Files\Exceed.nt'
COMPUTERNAME = `GERBRA'
COMSPEC = `C:\WINNT\system32\cmd.exe'
HOMEDRIVE = `C:'
HOMEPATH = `\'
INOCULAN = `C:\Inoculan'
LOGONSERVER = `\\GERBRA'
MSINPUT = `C:\Msinput'
NUMBER_OF_PROCESSORS = `1'
OS = `Windows_NT'
OS2LIBPATH = `C:\WINNT\system32\os2\dll;'
PATHEXT = `.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH'
PROCESSOR_ARCHITECTURE = `x86'
PROCESSOR_IDENTIFIER = `x86 Family 6 Model 3 Stepping 3, GenuineIntel'
PROCESSOR_LEVEL = `6'
PROCESSOR_REVISION = `0303'
PROMPT = `$P$G'
SYSTEMDRIVE = `C:'
SYSTEMROOT = `C:\WINNT'
TEMP = `/cygdrive/c/TEMP'
TMP = `/cygdrive/c/TEMP'
TZ = `PST8PDT'
USERDOMAIN = `GERBRA'
USERNAME = `gilbert'
USERPROFILE = `C:\WINNT\Profiles\gilbert'
WINDIR = `C:\WINNT'
TERM = `cygwin'

HKEY_CURRENT_USER\Software\Cygnus Solutions
HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin
HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin\mounts v2
  (default) = `/cygdrive'
  cygdrive flags = 0x00000022
HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin\Program Options
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/
  (default) = `D:/cygwin'
  flags = 0x0000000a
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/usr/bin
  (default) = `D:/cygwin/bin'
  flags = 0x0000000a
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/usr/lib
  (default) = `D:/cygwin/lib'
  flags = 0x0000000a
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\Program Options

a:  fd           N/A    N/A                    
c:  hd  FAT     2047Mb  89% CP    UN           
d:  hd  FAT     1560Mb  96% CP    UN           
e:  hd  FAT      501Mb  34% CP    UN           
f:  cd           N/A    N/A                    

D:\cygwin\bin  /usr/bin  system  binmode
D:\cygwin\lib  /usr/lib  system  binmode
D:\cygwin  /        system  binmode
c:    /cygdrive/c  user    binmode,noumount
d:    /cygdrive/d  user    binmode,noumount
e:    /cygdrive/e  user    binmode,noumount

Found: D:\cygwin\bin\bash.exe
Found: D:\cygwin\bin\cat.exe
Found: D:\cygwin\bin\cpp.exe
Found: D:\cygwin\bin\find.exe
Found: D:\cygwin\bin\gcc.exe
Found: D:\cygwin\bin\gdb.exe
Found: D:\cygwin\bin\ld.exe
Found: D:\cygwin\bin\ls.exe
Found: D:\cygwin\bin\make.exe
Found: D:\cygwin\bin\sh.exe

   18k 2000/10/23 D:\cygwin\bin\cyggdbm.dll - os=4.0 img=1.0 sys=4.0
                  "cyggdbm.dll" v0.0 ts=2000/10/22 19:26
   81k 2000/12/05 D:\cygwin\bin\cygitcl30.dll - os=4.0 img=1.0 sys=4.0
                  "cygitcl30.dll" v0.0 ts=2000/11/25 17:43
   35k 2000/12/05 D:\cygwin\bin\cygitk30.dll - os=4.0 img=1.0 sys=4.0
                  "cygitk30.dll" v0.0 ts=2000/11/25 17:43
  623k 2000/12/05 D:\cygwin\bin\cygtk80.dll - os=4.0 img=1.0 sys=4.0
                  "cygtk80.dll" v0.0 ts=2000/11/25 17:43
   56k 2000/12/03 D:\cygwin\bin\cygbz21.0.dll - os=4.0 img=1.0 sys=4.0
                  "cygbz21.0.dll" v0.0 ts=2000/11/20 15:53
   45k 2001/04/25 D:\cygwin\bin\cygform5.dll - os=4.0 img=1.0 sys=4.0
                  "cygform5.dll" v0.0 ts=2001/4/24 22:28
   26k 2001/04/25 D:\cygwin\bin\cygmenu5.dll - os=4.0 img=1.0 sys=4.0
                  "cygmenu5.dll" v0.0 ts=2001/4/24 22:27
  156k 2001/04/25 D:\cygwin\bin\cygncurses++5.dll - os=4.0 img=1.0 sys=4.0
                  "cygncurses++5.dll" v0.0 ts=2001/4/24 22:29
  226k 2001/04/25 D:\cygwin\bin\cygncurses5.dll - os=4.0 img=1.0 sys=4.0
                  "cygncurses5.dll" v0.0 ts=2001/4/24 22:17
   15k 2001/04/25 D:\cygwin\bin\cygpanel5.dll - os=4.0 img=1.0 sys=4.0
                  "cygpanel5.dll" v0.0 ts=2001/4/24 22:27
  390k 2001/01/18 D:\cygwin\bin\cygtcl80.dll - os=4.0 img=1.0 sys=4.0
                  "cygtcl80.dll" v0.0 ts=2001/1/17 20:44
    5k 2001/01/18 D:\cygwin\bin\cygtclpip80.dll - os=4.0 img=1.0 sys=4.0
   10k 2001/01/18 D:\cygwin\bin\cygtclreg80.dll - os=4.0 img=1.0 sys=4.0
                  "cygtclreg80.dll" v0.0 ts=2001/1/17 20:44
   21k 2001/06/20 D:\cygwin\bin\cygintl.dll - os=4.0 img=1.0 sys=4.0
                  "cygintl.dll" v0.0 ts=2001/6/20 10:09
   45k 2001/07/04 D:\cygwin\bin\cygjbig1.dll - os=4.0 img=1.0 sys=4.0
                  "cygjbig1.dll" v0.0 ts=2001/7/3 20:25
  119k 2001/06/06 D:\cygwin\bin\cygjpeg6b.dll - os=4.0 img=1.0 sys=4.0
                  "cygjpeg6b.dll" v0.0 ts=2001/6/5 21:27
  163k 2001/05/06 D:\cygwin\bin\cygpng2.dll - os=4.0 img=1.0 sys=4.0
                  "cygpng2.dll" v0.0 ts=2001/5/5 21:05
   17k 2001/06/28 D:\cygwin\bin\cyghistory4.dll - os=4.0 img=1.0 sys=4.0
                  "cyghistory4.dll" v0.0 ts=2001/1/6 20:34
   21k 2001/06/28 D:\cygwin\bin\cyghistory5.dll - os=4.0 img=1.0 sys=4.0
                  "cyghistory5.dll" v0.0 ts=2001/6/27 19:27
  108k 2001/06/28 D:\cygwin\bin\cygreadline4.dll - os=4.0 img=1.0 sys=4.0
                  "cygreadline4.dll" v0.0 ts=2001/1/6 20:34
  135k 2001/06/28 D:\cygwin\bin\cygreadline5.dll - os=4.0 img=1.0 sys=4.0
                  "cygreadline5.dll" v0.0 ts=2001/6/27 19:27
  245k 2001/06/12 D:\cygwin\bin\cygtiff3.dll - os=4.0 img=1.0 sys=4.0
                  "cygtiff3.dll" v0.0 ts=2001/6/12 10:25
   41k 2001/07/04 D:\cygwin\bin\cygXpm-noX4.dll - os=4.0 img=1.0 sys=4.0
                  "cygXpm-noX4.dll" v0.0 ts=2001/7/3 18:21
   45k 2001/07/04 D:\cygwin\bin\cygXpm-X4.dll - os=4.0 img=1.0 sys=4.0
                  "cygXpm-X4.dll" v0.0 ts=2000/11/19 18:45
   49k 2001/02/03 D:\cygwin\bin\cygz.dll - os=4.0 img=1.0 sys=4.0
                  "cygz.dll" v0.0 ts=2001/2/3 12:35
  678k 2001/05/21 D:\cygwin\bin\cygwin1.dll - os=4.0 img=1.0 sys=4.0
                  "cygwin1.dll" v0.0 ts=2001/5/20 20:28
    Cygwin DLL version info:
        dll major: 1003
        dll minor: 2
        dll epoch: 19
        dll bad signal mask: 19005
        dll old termios: 5
        dll malloc env: 28
        api major: 0
        api minor: 39
        shared data: 3
        dll identifier: cygwin1
        mount registry: 2
        cygnus registry name: Cygnus Solutions
        cygwin registry name: Cygwin
        program options name: Program Options
        cygwin mount registry name: mounts v2
        cygdrive flags: cygdrive flags
        cygdrive prefix: cygdrive prefix
        cygdrive default prefix: 
        build date: Sun May 20 23:28:17 EDT 2001
        shared id: cygwin1S3

Use -h to see help about each section

-- 
Pat Gilbert                  [email-masked]
Acterna                      604.892.5040
Burnaby, B.C.  Canada        604.892.5117 (fax)

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/