This discussion is archived
4 Replies Latest reply: Nov 14, 2013 10:07 AM by 919271 RSS

SS 12.3 CC doesn't like /usr/include/net-snmp/net-snmp-config.h in RHEL 6.4

919271 Newbie
Currently Being Moderated

Hello all,

 

I'm working on a project to migrate from a RHEL 5.9/SS12.1 build environment to a RHEL 6.4/SS12.3 build environment.

 

There have been minor issues here and there that I resolved on my own, but this one I need some help with. The preprocessor is choking on net-snmp-config.h with the following errors:

 

$ /export/software/spro12.3_linux/bin/CC -c test.c

"/usr/include/net-snmp/net-snmp-config.h", line 7: Error: There is extra text on this line.

"/usr/include/net-snmp/net-snmp-config.h", line 36: Error: There is extra text on this line.

2 Error(s) detected.

 

The program I am trying to compile is a C++ program, but I am able to replicate this in a new program called "test.c". I found that the CC (the C++ compiler) has the problem but cc (the C compiler) does not and compiles the code just fine. I have also tried CC with "compat=g" and this didn't help. Unfortunately the program I am compiling (not this test program, but the real program I need to compile) is a C++ program.

 

Is the net-snmp.config.h file in violation of some C++ standard, or is the pre-processor complaining about something it shouldn't?


Test program is here: http://pastebin.ca/raw/2475899

net-snmp-config.h is here: http://pastebin.ca/raw/2475900

 

$ rpm -qa | grep -i snmp

net-snmp-devel-5.5-44.el6.x86_64

net-snmp-devel-5.5-44.el6.i686

net-snmp-libs-5.5-44.el6.x86_64

net-snmp-libs-5.5-44.el6.i686

 

Thanks!

  • 1. Re: SS 12.3 CC doesn't like /usr/include/net-snmp/net-snmp-config.h in RHEL 6.4
    Steve_Clamage Pro
    Currently Being Moderated

    The header as you posted it contains invalid code.

    Line 7:

        #ifdef net-snmp-config_multilib_redirection_h

    The #ifdef must be followed by a single identifier, and an identifier cannot contain a '-' character. The line is equivalent to

        #ifdef net - snmp - config_multilib_redirection_h

    Line 34 has the same problem. I suspect the program that generated the header naively uses a file name as a macro. A file name can contain characters that are not valid in an identifer, so that generating program needs to be more clever -- or else the file name used in this way needs to be more restrictive in the character set it uses.


    Presumably the 'cc' command you use is gcc. I tried gcc 4.1.2 and 4.8.1, and both issued the same errors as Studio CC. Studio cc also complains in the same way.


    My best guess is that this header is not actually included (due to macro guards) when compiled by gcc, but does get included when using CC (because different macros are predefined).

  • 2. Re: SS 12.3 CC doesn't like /usr/include/net-snmp/net-snmp-config.h in RHEL 6.4
    919271 Newbie
    Currently Being Moderated

    Steve,

     

    Thanks for the reply. To clarify things a bit, SS 12.3 cc is okay with this header. It is SS 12.3 CC that is not okay. GCC and G++ are also happy - at least at the versions provided by Red Hat. Versions/patch levels below.

     

    Since you believe this is not valid C code, can you provide any reference to the C language standard that says what acceptable characters are for preprocessor macro definitions? I'm not a compiler nerd so I'm not exactly sure what to show Red Hat as proof that you're right - otherwise if I have to go to Red Hat and ask them to fix their header, they're going to point their fingers back at Oracle and the SS compiler without supporting evidence that they're wrong.

     

    Test Cases:

     

    $ /export/software/spro12.3_linux/bin/CC -c test.c

    "/usr/include/net-snmp/net-snmp-config.h", line 7: Error: There is extra text on this line.

    "/usr/include/net-snmp/net-snmp-config.h", line 36: Error: There is extra text on this line.

    2 Error(s) detected.

    $ ls -l test.o

    ls: cannot access test.o: No such file or directory

     

     

     

    $ /export/software/spro12.3_linux/bin/cc -c test.c

    $ ls -l test.o

    -rw-r--r-- 1 user user 5616 Nov 13 16:08 test.o

    $ rm test.o

     

     

     

    $ gcc -c test.c

    $ ls -l test.o

    -rw-r--r-- 1 user user 1232 Nov 13 16:09 test.o

    $ rm test.o

     

     

     

    $ g++ -c test.c

    $ ls -l test.o

    -rw-r--r-- 1 user user 1312 Nov 13 16:09 test.o

    $ rm test.o

     

     

     

    Compiler versions (should all be on the latest patch sets):

     

     

     

    $ /export/software/spro12.3_linux/bin/CC -V

    CC: Sun C++ 5.12 Linux_i386 Patch 148510-14 2013/09/24

     

    $ /export/software/spro12.3_linux/bin/cc -V

    cc: Sun C 5.12 Linux_i386 Patch 148919-08 2013/10/18

     

     

     

     

     

    $ gcc -v

    Using built-in specs.

    Target: x86_64-redhat-linux

    Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux

    Thread model: posix

    gcc version 4.4.7 20120313 (Red Hat 4.4.7-3) (GCC)

     

    $ g++ -v

    Using built-in specs.

    Target: x86_64-redhat-linux

    Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux

    Thread model: posix

    gcc version 4.4.7 20120313 (Red Hat 4.4.7-3) (GCC)

  • 3. Re: SS 12.3 CC doesn't like /usr/include/net-snmp/net-snmp-config.h in RHEL 6.4
    Steve_Clamage Pro
    Currently Being Moderated

    I don't have a system exactly the same as yours. The effect of a system header usually depends on a number of pre-defined macros. I don't dispute that you can compile your test case. I am only pointing out the invalid code in file /usr/include/net-snmp/net-snmp-config.h.

     

    Here is a better experiment. Try compiling just this code extracted from the header:

    #ifdef net-snmp-config_multilib_redirection_h

    #endif

    You should find that no compiler accepts it. That means that when compiling with CC, the config header is included, but not with other compilers, and that explains the different result. Differences in predefined macros should explain why the header is sometimes included.

  • 4. Re: SS 12.3 CC doesn't like /usr/include/net-snmp/net-snmp-config.h in RHEL 6.4
    919271 Newbie
    Currently Being Moderated

    You're right. That's really all I need to go yell at Red Hat now - I'll open a case with them so that they can fix it in future updates.

     

    Thanks for the advice.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points