Mail Archives: cygwin/2004/02/18/12:31:35
I have written a small toy. and it runs well on GNU/Linux, but when I have it
configure on cygwin, problem occurs:
/bin/bash ../libtool --mode=link gcc -g -O2 -o libfoo1.la -rpath /usr/local/lib -no-undefined -version-info 1:0:0 foo1.lo
gcc -shared .libs/foo1.o -o .libs/cygfoo1-1.dll -Wl,--image-base=0x10000000
-Wl,--out-implib,.libs/libfoo1.dll.a
Creating library file: .libs/libfoo1.dll.a
.libs/foo1.o(.text+0x28): In function `foo1':
/home/Administrator/mydemo/lib/foo1.c:27: undefined reference to `_var_in_foo2'
collect2: ld returned 1 exit status
make[2]: *** [libfoo1.la] Error 1
What is I want to know is how the "_" in "_var_in_foo2" have resulted.
Thank you!
sources & sysinfos are as follows:
lib/foo1.h
================================================
#ifndef _FOO1_H_
#define _FOO1_H_ 1
#include "port_issue.h"
__BEGIN_DECLS
int foo1 PARAMS((void));
static void local_func_in_foo1 PARAMS((void));
extern double var_in_foo2;
__END_DECLS
#endif /* !_FOO1_H_ */
================================================
lib/foo1.c
================================================
#include <stdio.h>
#include "foo1.h"
int foo1()
{
printf("in foo1,var_in_foo2=%g\n",var_in_foo2);
local_func_in_foo1();
return 1;
}
static void local_func_in_foo1()
{
printf("in local_func_in_foo1\n");
}
=================================================
lib/foo2.h
=================================================
#ifndef _FOO2_H_
#define _FOO2_H_ 1
#include "port_issue.h"
__BEGIN_DECLS
int foo2 PARAMS((void));
static void local_func_in_foo2 PARAMS((void));
extern double var_in_foo2;
__END_DECLS
#endif /* !_FOO2_H_ */
=================================================
lib/foo2.c
=================================================
#include <stdio.h>
#include <config.h>
#ifdef HAVE_MATH_H
#include <math.h>
#endif
#include "foo2.h"
double var_in_foo2=1.8f;
int foo2()
{
printf("in foo2,cos of var_in_foo2=%g\n",cos(var_in_foo2));
local_func_in_foo2();
return 2;
}
static void local_func_in_foo2()
{
printf("in local_func_in_foo2\n");
}
==================================================
cygcheck -s reads:
==================================================
Cygwin Win95/NT Configuration Diagnostics
Current System Time: Thu Feb 19 01:21:42 2004
Windows 2000 Professional Ver 5.0 Build 2195 Service Pack 4
Path: C:\cygwin\usr\local\bin
C:\cygwin\bin
C:\cygwin\bin
C:\cygwin\usr\X11R6\bin
c:\WINNT\system32
c:\WINNT
c:\WINNT\System32\Wbem
Output from C:\cygwin\bin\id.exe (nontsec)
UID: 500(Administrator) GID: 513(None)
513(None)
Output from C:\cygwin\bin\id.exe (ntsec)
UID: 500(Administrator) GID: 513(None)
0(root) 513(None)
544(Administrators) 545(Users)
SysDir: C:\WINNT\system32
WinDir: C:\WINNT
HOME = `C:\cygwin\home\Administrator'
MAKE_MODE = `unix'
PWD = `/home/Administrator/mydemo'
USER = `Administrator'
Use `-r' to scan registry
c: hd FAT32 10148Mb 85% CP UN
d: cd N/A N/A
e: cd N/A N/A
C:\cygwin / system binmode
C:\cygwin/bin /usr/bin system binmode
C:\cygwin/lib /usr/lib system binmode
C:\cygwin\usr\X11R6\lib\X11\fonts /usr/X11R6/lib/X11/fonts system binmode
. /cygdrive system
binmode,cygdrive
Found: C:\cygwin\bin\awk.exe
Found: C:\cygwin\bin\bash.exe
Found: C:\cygwin\bin\cat.exe
Found: C:\cygwin\bin\cp.exe
Found: C:\cygwin\bin\cpp.exe
Found: C:\cygwin\bin\find.exe
Found: C:\cygwin\bin\gcc.exe
Not Found: gdb
Found: C:\cygwin\bin\grep.exe
Found: C:\cygwin\bin\ld.exe
Found: C:\cygwin\bin\ls.exe
Found: C:\cygwin\bin\make.exe
Found: C:\cygwin\bin\mv.exe
Found: C:\cygwin\bin\rm.exe
Found: C:\WINNT\sed.exe
Found: C:\cygwin\bin\sed.exe
Found: C:\cygwin\bin\sh.exe
Found: C:\cygwin\bin\tar.exe
37k 2003/08/10 C:\cygwin\bin\cygintl-2.dll
19k 2003/03/22 C:\cygwin\bin\cyggdbm.dll
28k 2003/07/20 C:\cygwin\bin\cyggdbm-3.dll
15k 2003/07/20 C:\cygwin\bin\cyggdbm_compat-3.dll
30k 2003/08/11 C:\cygwin\bin\cyggdbm-4.dll
15k 2003/08/11 C:\cygwin\bin\cyggdbm_compat-4.dll
12k 2003/08/10 C:\cygwin\bin\cyggettextpo-0.dll
69k 2003/08/10 C:\cygwin\bin\cyggettextlib-0-12-1.dll
134k 2003/08/10 C:\cygwin\bin\cyggettextsrc-0-12-1.dll
958k 2003/08/10 C:\cygwin\bin\cygiconv-2.dll
22k 2001/12/13 C:\cygwin\bin\cygintl-1.dll
45k 2001/04/25 C:\cygwin\bin\cygform5.dll
26k 2001/04/25 C:\cygwin\bin\cygmenu5.dll
156k 2001/04/25 C:\cygwin\bin\cygncurses++5.dll
226k 2001/04/25 C:\cygwin\bin\cygncurses5.dll
15k 2001/04/25 C:\cygwin\bin\cygpanel5.dll
35k 2002/01/09 C:\cygwin\bin\cygform6.dll
20k 2002/01/09 C:\cygwin\bin\cygmenu6.dll
175k 2002/01/09 C:\cygwin\bin\cygncurses++6.dll
202k 2002/01/09 C:\cygwin\bin\cygncurses6.dll
12k 2002/01/09 C:\cygwin\bin\cygpanel6.dll
48k 2003/08/09 C:\cygwin\bin\cygform7.dll
29k 2003/08/09 C:\cygwin\bin\cygmenu7.dll
224k 2003/08/09 C:\cygwin\bin\cygncurses7.dll
19k 2003/08/09 C:\cygwin\bin\cygpanel7.dll
63k 2003/04/11 C:\cygwin\bin\cygpcre.dll
61k 2003/04/11 C:\cygwin\bin\cygpcreposix.dll
62k 2003/12/11 C:\cygwin\bin\cygpcre-0.dll
9k 2003/12/11 C:\cygwin\bin\cygpcreposix-0.dll
22k 2002/06/09 C:\cygwin\bin\cygpopt-0.dll
17k 2001/06/28 C:\cygwin\bin\cyghistory4.dll
108k 2001/06/28 C:\cygwin\bin\cygreadline4.dll
29k 2003/08/10 C:\cygwin\bin\cyghistory5.dll
148k 2003/08/10 C:\cygwin\bin\cygreadline5.dll
842k 2003/09/30 C:\cygwin\bin\cygcrypto-0.9.7.dll
171k 2003/09/30 C:\cygwin\bin\cygssl-0.9.7.dll
61k 2003/12/04 C:\cygwin\bin\cygz.dll
7k 2003/10/19 C:\cygwin\bin\cygcrypt-0.dll
155k 2004/01/07 C:\cygwin\bin\cygexpat-0.dll
61k 2003/08/09 C:\cygwin\bin\cygbz2-1.dll
131k 2003/10/28 C:\cygwin\bin\cygfontconfig-1.dll
361k 2003/10/25 C:\cygwin\bin\cygfreetype-6.dll
21k 2001/06/20 C:\cygwin\bin\cygintl.dll
119k 2002/02/09 C:\cygwin\bin\cygjpeg6b.dll
173k 2003/08/10 C:\cygwin\bin\cygpng12.dll
281k 2003/02/24 C:\cygwin\bin\cygtiff3.dll
22k 2004/02/10 C:\cygwin\bin\cygcygipc-2.dll
12k 2003/02/17 C:\cygwin\bin\cygioperm-0.dll
831k 2003/09/20 C:\cygwin\bin\cygdb-4.1.dll
1080k 2003/09/20 C:\cygwin\bin\cygdb_cxx-4.1.dll
1049k 2003/11/07 C:\cygwin\bin\cygperl5_8_2.dll
32k 2003/08/18 C:\cygwin\bin\cygltdl-3.dll
1083k 2004/01/31 C:\cygwin\bin\cygwin1.dll
Cygwin DLL version info:
DLL version: 1.5.7
DLL epoch: 19
DLL bad signal mask: 19005
DLL old termios: 5
DLL malloc env: 28
API major: 0
API minor: 109
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: Fri Jan 30 19:32:04 EST 2004
CVS tag: cr-0x9e
Shared id: cygwin1S3
237k 2003/11/18 C:\cygwin\usr\X11R6\bin\cygdps-1.dll
121k 2003/11/18 C:\cygwin\usr\X11R6\bin\cygdpstk-1.dll
373k 2003/11/18 C:\cygwin\usr\X11R6\bin\cygGL-1.dll
439k 2003/11/18 C:\cygwin\usr\X11R6\bin\cygGLU-1.dll
74k 2003/11/18 C:\cygwin\usr\X11R6\bin\cygICE-6.dll
9k 2003/11/18 C:\cygwin\usr\X11R6\bin\cygoldX-6.dll
1271k 2003/11/18 C:\cygwin\usr\X11R6\bin\cygOSMesa-4.dll
20k 2003/11/18 C:\cygwin\usr\X11R6\bin\cygpsres-1.dll
30k 2003/11/18 C:\cygwin\usr\X11R6\bin\cygSM-6.dll
864k 2003/11/18 C:\cygwin\usr\X11R6\bin\cygX11-6.dll
253k 2003/11/18 C:\cygwin\usr\X11R6\bin\cygXaw-6.dll
355k 2003/11/18 C:\cygwin\usr\X11R6\bin\cygXaw-7.dll
36k 2003/11/18 C:\cygwin\usr\X11R6\bin\cygXcursor-1.dll
49k 2003/11/18 C:\cygwin\usr\X11R6\bin\cygXext-6.dll
56k 2003/11/18 C:\cygwin\usr\X11R6\bin\cygXft-1.dll
74k 2003/11/18 C:\cygwin\usr\X11R6\bin\cygXft-2.dll
27k 2003/11/18 C:\cygwin\usr\X11R6\bin\cygXi-6.dll
76k 2003/11/18 C:\cygwin\usr\X11R6\bin\cygXmu-6.dll
11k 2003/11/18 C:\cygwin\usr\X11R6\bin\cygXmuu-1.dll
26k 2003/11/18 C:\cygwin\usr\X11R6\bin\cygXp-6.dll
51k 2003/11/18 C:\cygwin\usr\X11R6\bin\cygXpm-4.dll
14k 2003/11/18 C:\cygwin\usr\X11R6\bin\cygXrandr-2.dll
26k 2003/11/18 C:\cygwin\usr\X11R6\bin\cygXrender-1.dll
282k 2003/11/18 C:\cygwin\usr\X11R6\bin\cygXt-6.dll
27k 2003/11/18 C:\cygwin\usr\X11R6\bin\cygXTrap-6.dll
17k 2003/11/18 C:\cygwin\usr\X11R6\bin\cygXtst-6.dll
15k 2003/11/18 C:\cygwin\usr\X11R6\bin\cygXv-1.dll
282k 2003/10/28 C:\cygwin\usr\X11R6\bin\cygfreetype-9.dll
Cygwin Package Information
Package Version
_update-info-dir 00226-1
agetty 2.1-1
ash 20040127-1
autoconf 2.59-1
autoconf-devel 2.59-1
autoconf-stable 2.13-5
automake 1.7.9-1
automake-devel 1.7.9-1
automake-stable 1.4p6-2
base-files 2.6-1
base-passwd 1.1-1
bash 2.05b-16
binutils 20030901-1
bzip2 1.0.2-5
chkconfig 1.2.24h-1
crypt 1.1-1
ctags 5.5-4
cygipc 2.03-2
cygrunsrv 0.98-1
cygutils 1.2.4-1
cygwin 1.5.7-1
cygwin-doc 1.3-6
diffutils 2.8.4-1
editrights 1.01-1
emacs 21.2-12
emacs-X11 21.2-12
expat 1.95.7-1
file 4.06-1
fileutils 4.1-2
findutils 4.1.7-4
fontconfig 2.2.0-1
freetype2 2.1.5-1
gawk 3.1.3-4
gcc 3.3.1-3
gcc-g++ 3.3.1-3
gcc-mingw 20030911-4
gcc-mingw-core 20031020-1
gcc-mingw-g++ 20031020-1
gdbm 1.8.3-7
gettext 0.12.1-3
grep 2.5-1
groff 1.18.1-2
gzip 1.3.5-1
initscripts 0.9-1
ioperm 0.4-1
less 381-1
lftp 2.6.10-1
libbz2_1 1.0.2-5
libdb4.1 4.1.25-1
libfontconfig1 2.2.0-1
libfreetype26 2.1.5-1
libgdbm 1.8.0-5
libgdbm-devel 1.8.3-7
libgdbm3 1.8.3-3
libgdbm4 1.8.3-7
libgettextpo0 0.12.1-3
libiconv2 1.9.1-3
libintl 0.10.38-3
libintl1 0.10.40-1
libintl2 0.12.1-3
libjpeg6b 6b-8
libltdl3 1.5-3
libncurses5 5.2-1
libncurses6 5.2-8
libncurses7 5.3-4
libpcre 4.1-1
libpcre0 4.5-1
libpng12 1.2.5-4
libpopt0 1.6.4-4
libreadline4 4.1-2
libreadline5 4.3-5
libtiff3 3.6.0-2
libtool 1.5b-1
libtool-devel 1.5-3
libtool-stable 1.4.3-2
links 0.99pre14-1
login 1.9-7
m4 1.4-1
make 3.80-1
man 1.5k-2
mingw-runtime 3.2-1
mktemp 1.5-3
mutt 1.4.1-2
ncurses 5.3-4
openssh 3.7.1p2-2
openssl 0.9.7c-1
pcre 4.5-1
pcre-doc 4.5-1
perl 5.8.2-1
perl-libwin32 0.191-1
procps 010801-2
readline 4.3-5
rebase 2.2-3
rxvt 2.7.10-3
sed 4.0.8-1
sh-utils 2.0.15-4
shutdown 1.4-1
ssmtp 2.60.4-2
sysvinit 2.84-4
tar 1.13.25-5
termcap 20021106-2
terminfo 5.3_20030726-1
texinfo 4.2-4
textutils 2.0.21-1
tzcode 2003d-1
unzip 5.50-5
vim 6.2.098-1
w32api 2.5-1
wget 1.9.1-1
which 1.5-2
XFree86-base 4.3.0-1
XFree86-bin 4.3.0-8
XFree86-etc 4.3.0-6
XFree86-fenc 4.2.0-3
XFree86-fnts 4.2.0-3
XFree86-lib 4.3.0-1
XFree86-lib-compat 4.3.0-2
XFree86-man 4.3.0-2
XFree86-startup-scripts 4.2.0-5
XFree86-xserv 4.3.0-44
xwinclip 1.2.0-1
zlib 1.2.1-1
--
Guanglei Xiong
Department of Automation
Tsinghua University
Beijing,P.R.China
100084
--=-=-=
Content-Type: application/pgp-signature
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
iD8DBQBAM6ENC2mzqsFtVowRAiPDAJ4/Erq+l6TBAXyNCGxMDlDNs9jjgACgm8/W
TLMShRQeBoGkG6D9i0iJ0UM=
=wpe2
-----END PGP SIGNATURE-----
--=-=-=--
- Raw text -