This is the mail archive of the cygwin@sources.redhat.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

libm.a linking errork


I remember seeing some posts regarding libm, libc and libcygwin over the
last few months, but I can't find anything in the archives that refers
to the error message I'm seeing.  But I did find some questions asked
about why changing the current handling of the library names should
change.  Either this is a reason or I have somehow misconfigured things,
though I can't see where.  So I'm also attaching the output of cygcheck
-v -r -s below, just in case;)

I have Cygwin 1.0 from the CD, updated to net release 1.1.4 installed on
a WinNT 4.0, SP5 system.

This C program illustrates my problem:

  #include <math.h>
  main()
  {
      printf("%f\n", log10(1000.0));
  }

If I try to include the libm library explicitly (which I did when I
first tried to compile):

   gcc -o pgm -lm pgm.c

I get the following error from the linker:

/tmp/ccDHKdkM.o(.text+0x10):pgm.c: multiple definition of `main'
/usr/lib/libm.a(libcmain.o)(.text+0x0):libcmain.c: first defined here
/usr/lib/libm.a(libcmain.o)(.text+0x6a):libcmain.c: undefined reference
to `WinMain@16'
collect2: ld returned 1 exit status

If I compile as:

  gcc -o pgm pgm.c

everything is fine and pgm executes with the expected output.

The libm.a file is a symlink to the libcygwin.a library.

===cygcheck:


Cygnus Win95/NT Configuration Diagnostics
Current System Time: Thu Sep 21 15:30:15 2000

WinNT Ver 4.0 build 1381 Service Pack 5

Path:	/usr/bob/bin
	/usr/bin
	/contrib/bin
	/usr/X11R6/bin
	/usr/local/bin
	/drv/c/winnt
	/drv/c/winnt/system32
	.

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

CYGWIN = `binmode tty'
HOME = `/usr/bob'
PWD = `/usr/bob/megami/src/c/utils'

APPATH = `C:\Program Files\Sunbelt Software\AutoPilot'
BASEMAKE = `D:\Program Files\Microsoft Platform
SDK\Include\BKOffice.Mak'
BC_ENV_ARGS = `-q'
BKOFFICE = `D:\Program Files\Microsoft Platform SDK\'
CDPATH = `.:/usr/bob:/'
CLASSPATH = `C:\Program Files\ExceedNT\hcljrcsv.zip;C:\Program
Files\ExceedNT'
COMPUTERNAME = `RAMJR'
COMSPEC = `C:\WINNT\system32\cmd.exe'
DISPLAY = `ramjr:0.0'
DXSDKROOT = `D:\Program Files\Microsoft Platform SDK\'
EDITOR = `vi'
EXINIT = `set ai sm sw=4 tabstop=4'
HOMEDRIVE = `C:'
HOMEPATH = `\usr\bob'
HOSTNAME = `ramjr'
HOSTTYPE = `i586'
INCLUDE = `C:\Program Files\Microsoft Visual
Studio\VC98\atl\include;C:\Program Files\Microsoft Visual
Studio\VC98\mfc\include;C:\Program Files\Microsoft Visual
Studio\VC98\include;D:\Program Files\Microsoft Platform
SDK\Include\;D:\Program Files\Microsoft Platform SDK\Include\Atl30\'
INETSDK = `D:\Program Files\Microsoft Platform SDK\'
LIB = `C:\Program Files\Microsoft Visual Studio\VC98\mfc\lib;C:\Program
Files\Microsoft Visual Studio\VC98\lib;D:\Program Files\Microsoft
Platform SDK\Lib\'
LOGNAME = `########'
LOGONSERVER = `\\#######'
MACHTYPE = `i586-pc-cygwin'
MSDEVDIR = `C:\Program Files\Microsoft Visual Studio\Common\MSDev98'
MSSDK = `D:\Program Files\Microsoft Platform SDK\'
MSTOOLS = `D:\Program Files\Microsoft Platform SDK\'
NTRESKIT = `C:\Program Files\NTReskit'
NUMBER_OF_PROCESSORS = `1'
OLDPWD = `/usr/bob/src/c/utils'
OS2LIBPATH = `C:\WINNT\system32\os2\dll;'
OS = `Windows_NT'
OSTYPE = `cygwin'
PROCESSOR_ARCHITECTURE = `x86'
PROCESSOR_IDENTIFIER = `x86 Family 6 Model 7 Stepping 3, GenuineIntel'
PROCESSOR_LEVEL = `6'
PROCESSOR_REVISION = `0703'
PROMPT_COMMAND = `xtitle "rmcgowan@ramjr    " "$PWD"'
PS1 = `[ramjr]$ '
SHELL = `/bin/bash'
SHLVL = `1'
SYSTEMDRIVE = `C:'
SYSTEMROOT = `C:\WINNT'
TEMP = `/drv/d/TMP'
TERM = `cygwin'
TMP = `/drv/d/TMP'
TMPDIR = `/tmp'
USERDOMAIN = `###'
USERNAME = `########'
USERPROFILE = `C:\WINNT\Profiles\############'
WINDIR = `C:\WINNT'
WINDOWID = `8388622'
_ = `/bin/cygcheck'
TZ = `PST8PDT7,M4.1.0/2,M10.5.0/2'

HKEY_CURRENT_USER\Software\Cygnus Solutions
HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin
HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin\mounts v2
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\1.00.000
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2
  (default) = `/drv'
  cygdrive flags = 0x0000002a
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/
  (default) = `c:/cygwin'
  flags = 0x0000000a
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/dev/fd0
  (default) = `\\.\a:'
  flags = 0x0000000a
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/mnt/cdrom
  (default) = `e:'
  flags = 0x0000000a
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts
v2\/mnt/floppy
  (default) = `a:'
  flags = 0x0000000a
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts
v2\/ms/vc98/include
  (default) = `c:\Program Files\Microsoft Visual Studio\VC98\include'
  flags = 0x0000000a
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/usr/bin
  (default) = `c:/cygwin/bin'
  flags = 0x0000000a
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/usr/bob
  (default) = `c:\usr\bob'
  flags = 0x0000000a
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts
v2\/usr/bob/megami
  (default) = `\\megami\homes'
  flags = 0x0000000a
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts
v2\/usr/cd-image/debian-potato
  (default) = `d:\debian-potato'
  flags = 0x0000000a
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts
v2\/usr/cygwin-xwin
  (default) = `d:\cygwin-xwin'
  flags = 0x0000000a
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/usr/lib
  (default) = `c:/cygwin/lib'
  flags = 0x0000000a
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup

a:  fd           N/A    N/A                    
c:  hd  NTFS    4086Mb  97% CP CS UN PA FC     RAMJR Boot Disk
d:  hd  NTFS    4659Mb  95% CP CS UN PA FC     RAMJR Data Disk
e:  cd           N/A    N/A                    
h:  net NTFS   14660Mb  67% CP CS UN PA FC     Engr1
i:  net NTFS    8675Mb  66% CP CS UN PA FC     
p:  net NTFS   17358Mb 100% CP CS UN PA FC     test1
u:  net NTFS    5188Mb  67% CP CS    PA        rmcgowan
w:  net NTFS   225746Mb  21% CP CS UN PA FC     
x:  net NTFS    4094Mb  91% CP CS UN PA FC     Apps

c:\Program Files\Microsoft Visual Studio\VC98\include  /ms/vc98/include 
system  binmode
d:\debian-potato  /usr/cd-image/debian-potato  system  binmode
\\megami\homes  /usr/bob/megami  system  binmode
d:\cygwin-xwin  /usr/cygwin-xwin  system  binmode
c:\cygwin\bin  /usr/bin  system  binmode
c:\cygwin\lib  /usr/lib  system  binmode
c:\usr\bob  /usr/bob  system  binmode
c:\cygwin  /        system  binmode
\\.\a:  /dev/fd0  system  binmode
a:    /mnt/floppy  system  binmode
e:    /mnt/cdrom  system  binmode

Found: c:\cygwin\bin\bash.exe
Found: c:\cygwin\usr\local\bin\bash.exe
Warning: c:\cygwin\bin\bash.exe hides c:\cygwin\usr\local\bin\bash.exe
Found: c:\cygwin\bin\cat.exe
Found: c:\cygwin\bin\cpp.exe
Found: c:\cygwin\bin\find.exe
Found: c:\cygwin\bin\gcc.exe
Found: c:\cygwin\bin\gdb.exe
Found: c:\cygwin\bin\ld.exe
Found: c:\cygwin\bin\ls.exe
Found: c:\cygwin\bin\make.exe
Found: c:\cygwin\bin\sh.exe

   83k 2000/06/11 c:\cygwin\bin\cygitcl30.dll - os=4.0 img=1.0 sys=4.0
                  "cygitcl30.dll" v0.0 ts=2000/6/10 20:34
   35k 2000/06/11 c:\cygwin\bin\cygitk30.dll - os=4.0 img=1.0 sys=4.0
                  "cygitk30.dll" v0.0 ts=2000/6/10 20:34
  402k 2000/06/11 c:\cygwin\bin\cygtcl80.dll - os=4.0 img=1.0 sys=4.0
                  "cygtcl80.dll" v0.0 ts=2000/6/10 20:30
    5k 2000/06/11 c:\cygwin\bin\cygtclpip80.dll - os=4.0 img=1.0 sys=4.0
   10k 2000/06/11 c:\cygwin\bin\cygtclreg80.dll - os=4.0 img=1.0 sys=4.0
                  "cygtclreg80.dll" v0.0 ts=2000/6/10 20:30
  639k 2000/06/11 c:\cygwin\bin\cygtk80.dll - os=4.0 img=1.0 sys=4.0
                  "cygtk80.dll" v0.0 ts=2000/6/10 20:34
  586k 2000/08/04 c:\cygwin\bin\cygwin1.dll - os=4.0 img=1.0 sys=4.0
                  "cygwin1.dll" v0.0 ts=2000/8/3 17:53
    Cygwin DLL version info:
        dll major: 1001
        dll minor: 4
        dll epoch: 19
        dll bad signal mask: 19005
        dll old termios: 5
        api major: 0
        api minor: 26
        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
        build date: Thu Aug 3 20:53:46 EDT 2000
        CVS tag: cygwin-1-1-4
        shared id: cygwin1S3

Use -h to see help about each section

-- 
Bob McGowan
Staff Software Quality Engineer
VERITAS Software
rmcgowan@veritas.com

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]