Home page logo
/

nmap-dev logo Nmap Development mailing list archives

Re: FC4 compilation issue
From: "Duilio Protti" <dprotti () fceia unr edu ar>
Date: Sat, 21 Jan 2006 15:52:23 -0300 (ART)

That raises the question of why HAVE___ATTRIBUTE__ is not being
defined on your FC4 box (it is defined on my FC3). The definition is
made as part of this rather simple AC_C___ATTRIBUTE__ macro in
nbase/aclocal.m4:

dnl
dnl Test for __attribute__
dnl

AC_DEFUN(AC_C___ATTRIBUTE__, [
AC_MSG_CHECKING(for __attribute__)
AC_CACHE_VAL(ac_cv___attribute__, [
AC_TRY_COMPILE([
#include <stdlib.h>
],
[
static void foo(void) __attribute__ ((noreturn));

static void
foo(void)
{
 exit(1);
}
],
ac_cv___attribute__=yes,
ac_cv___attribute__=no)])
if test "$ac_cv___attribute__" = "yes"; then
 AC_DEFINE(HAVE___ATTRIBUTE__, 1, [define if your compiler has
 __attribute__])
fi
AC_MSG_RESULT($ac_cv___attribute__)
])

If you, or someone else with a system that can reproduce the problem,
can figure out what is wrong, I'd be happy to apply the patch. Maybe
you could check your config.log to determine why this test seems to be
failing.

Cheers,
Fyodor


This is the relevant part of nbase/config.log file on FC4:

configure:3528: checking for __attribute__
configure:3560: gcc -c -g -O2 -Wall   conftest.c >&5
conftest.c: In function 'main':
conftest.c:52: error: invalid storage class for function 'foo'
conftest.c:56: error: invalid storage class for function 'foo'
configure:3566: $? = 1
configure: failed program was:
| /* confdefs.h.  */
|
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define LINUX 1
| #define PCAP_TIMEOUT_IGNORED 1
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_STRING_H 1
| #define HAVE_GETOPT_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_SYS_PARAM_H 1
| #define HAVE_SYS_TIME_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_ERRNO_H 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_SOCKET_H 1
| #define HAVE_NETINET_IN_H 1
| #define HAVE_RPC_TYPES_H 1
| #define HAVE_NETDB_H 1
| #define HAVE_PWD_H 1
| #define HAVE_ARPA_INET_H 1
| #define HAVE_SYS_RESOURCE_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_SYS_WAIT_H 1
| #define HAVE_NET_IF_H 1
| #define HAVE_LIBIBERTY_H 1
| #define HAVE_FCNTL_H 1
| #define HAVE_NET_IF_H 1
| #define HAVE_NETINET_IF_ETHER_H 1
| #define TIME_WITH_SYS_TIME 1
| /* end confdefs.h.  */
|
| #include <stdlib.h>
|
| int
| main ()
| {
|
| static void foo(void) __attribute__ ((noreturn));
|
| static void
| foo(void)
| {
|   exit(1);
| }
|
|   ;
|   return 0;
| }


Trying to compile the above C program with FC4's default gcc (4.0.2):

$ gcc -c -O2 -Wall test2.c
test2.c: In function 'main':
test2.c:7: error: invalid storage class for function 'foo'
test2.c:11: error: invalid storage class for function 'foo'

But with the old gcc on the same FC4 it works good:

$ gcc32 -c -O2 -Wall test2.c
$ gcc32 --version
gcc32 (GCC) 3.2.3 20030502 (Red Hat Linux 3.2.3-47.fc4)

and the attribute test pass Ok.

I think the fastest way to fix the problem, is doing the
AC_C___ATTRIBUTE__ test by ourself, modifying nbase/configure.ac to move
the foo() declaration outside the main() body. A patch for this is
attached. I have tested successfully on FC4 with both gcc 4.x and gcc 3.x.


Cheers,
Duilio Protti.

Attachment: attribute-test.patch
Description:



_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev

  By Date           By Thread  

Current thread:
[ Nmap | Sec Tools | Mailing Lists | Site News | About/Contact | Advertising | Privacy ]