[ntp:bugs] [Bug 1862] Compilation error, ntp_io.c:1678: undefined reference to `in6addr_any'

bugzilla-daemon at ntp.org bugzilla-daemon at ntp.org
Mon Mar 28 21:48:17 UTC 2011


http://bugs.ntp.org/show_bug.cgi?id=1862

--- Comment #10 from Stefan olsson <misca at hotmail.com> 2011-03-28 21:48:17 UTC ---
Hi


It seems to be the -O2 that optimize the code 


I took out the test code from ./configure and saved it in a separate file
in6addr_any.c

                #include <stdio.h>
                #include <string.h>
                #include <sys/types.h>
                #include <sys/socket.h>
                #include <netinet/in.h>



int
main ()
{

                struct in6_addr in6;
                in6 = in6addr_any;


  ;
  return 0;
}




#  gcc -o in6addr_any  -g   -L/ffp/lib in6addr_any.c

/ffp/tmp/ccqXgKyC.o: In function `main':
/ffp/install/ntp-4.2.7p142-bug1861/in6addr_any.c:308: undefined reference to
`in6addr_any'
collect2: ld returned 1 exit status


#  gcc -o in6addr_any  -g -O0  -L/ffp/lib in6addr_any.c

/ffp/tmp/ccMGypu2.o: In function `main':
/ffp/install/ntp-4.2.7p142-bug1861/in6addr_any.c:308: undefined reference to
`in6addr_any'
collect2: ld returned 1 exit status


#  gcc -o in6addr_any  -g -O2  -L/ffp/lib in6addr_any.c

                         <----- No error messages
#
# ./in6addr_any          <----- It is even possible to execute the result
#


./configure is setting CFLAGS to "-g -O2" on line 4403, if I print out the
labels in ./configure at line 4415 (after the if statement) they are 

ac_test_CFLAGS = 
ac_cv_prog_cc_g = yes
GCC = yes
CFLAGS = -g -O2



Also, if I run ./configure with the arguments -C 'CFLAGS=-g -O0' as you suggest
(along with my other flags) the ./configure will not use -O2 for the test and
will trap the linkage error for in6addr_any

I have added an attachment, a tar including the config.log and the stdout from
the execution of the ./configure with and without CFLAGS settings


/Stefan

-- 
Configure bugmail: http://bugs.ntp.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


More information about the bugs mailing list