Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Message-ID: <002301c31c38$7d9c56d0$2180a8c0@toshiba> From: "Campbell" To: References: Subject: Re: Porting - link error Date: Sat, 17 May 2003 15:52:09 +1000 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Scanned-By: MIMEDefang 1.4 (www dot roaringpenguin dot com slash mimedefang) I wrote: > > > Trying to port heyu2. (Command line interface for x10 home automation. See > > http://heyu.tanj.com/heyu2/. Basically, it just sends commands to a serial > > port, and spawns a daemon to listen for responses.) > > > > Achieved clean compile after adding a few #include<>'s and changing timezone > > to _timezone. > > > > When attempting to link: > > > > gcc -o heyu2 date.o erase.o info.o message.o relay.o monitor.o reset.o setclock.o stop.o tty.o turn.o x10.o xread.o xwrite.o status.o cm11a.o eeprom.o preset.o process.o sun.o -lm -lc > > fu000001.o(.idata$3+0xc): undefined reference to `__cygnus_netrel_build_cygwin_1_3_22_1_i686_pc_cygwin_winsup_cygwin_libc_a_i name' > > fu000002.o(.idata$3+0xc): undefined reference to `__cygnus_netrel_build_cygwin_1_3_22_1_i686_pc_cygwin_winsup_cygwin_libc_a_i name' > > fu000005.o(.idata$3+0xc): undefined reference to `__cygnus_netrel_build_cygwin_1_3_22_1_i686_pc_cygwin_winsup_cygwin_libc_a_i name' > > fu000006.o(.idata$3+0xc): undefined reference to `__cygnus_netrel_build_cygwin_1_3_22_1_i686_pc_cygwin_winsup_cygwin_libc_a_i name' > > nmth000000.o(.idata$4+0x0): undefined reference to `__nm___tzname' > > Info: resolving __tzname by linking to __imp___tzname (auto-import) > > collect2: ld returned 1 exit status > > make: *** [heyu2] Error 1 > > > > nm lists a symbol > > ___cygnus_netrel_build_cygwin_1_3_22_1_i686_pc_cygwin_winsup_cygwin_libc_a_i name > > in /lib/libc.a with three leading underscores. > > I looked in man ld, but couldn't find anything to help. > > Igor wrote: > The fact that you had to change timezone to _timezone should have been > your first clue. There is something wrong with the name mangling (perhaps > a wrong calling convention declared?) for that particular project. You > might want to look into gcc's "-fleading-underscore" option ("info gcc"). > Igor Thank you, Igor. Good suggestion. Tried adding -fleading-underscore to the compile flags. No change. Tried adding -fno-leading-underscore to the compile flags. Squillions of link errors. Not really surprising. My understanding is that under cygwin, timezone is a function, not a global variable. _timezone is the equivalent global variable. See https://www.zend.com/lists/php-dev/200203/msg00119.html and http://www.cygwin.com/ml/cygwin/2001-12/msg01324.html. I can't find anything in the makefile that would upset name mangling. CC = gcc CFLAGS = -g -O $(DFLAGS) -Wall DFLAGS = -DSYSV -DHAS_ITIMER -DHASSELECT LIBS = -lm -lc It's really strange that there is a problem with only one symbol, and that one symbol is defined in libc.a. Campbell. -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/