"cc" compiler not supported by <cc> task

Help
2008-03-19
2013-04-24
  • Hi,

    I am new to ANT.
    We are using cc compiler to compile the c source code.
    I am trying use it and it gives me an error "cc" compiler is not supported.
    "cc is not a legal value"

    Can anyone please let me know whether <cc> task support "cc" compiler?

     
    • Hello,

      Did you try CC instead of cc ?

      MAT.

       
      • Hi MAT,

        Thanks for your reply.

        I tried CC & gcc instead of cc but it gives lot of compilation errors.
        Our current compilation uses cc(5.1) compiler & I will have to use cc compiler only for compiling available source code.

        Because of error I think that ANT does not support "cc" compiler and just want to make sure that whatever I have investigated is right.

         
        • Supported compilers are listed here : http://ant-contrib.sourceforge.net/cc.html

          So cc and CC are different compilers then ?

          MAT.

           
          • Yes they are different.

             
            • sunilscr
              sunilscr
              2008-03-19

              on Solaris to compile C I used suncc

               
              • Unfortunately I have to use "cc" only. I am also compiling on solaris but need to do that using cc in ANT which is not supported by ANT.

                 
                • sunilscr
                  sunilscr
                  2008-03-19

                  add following to have cc

                          <taskdef name="cc"
                                  classname="net.sf.antcontrib.cpptasks.CCTask" />

                   
                  • Hi,

                    Thanks, but it is still not working.
                    Here is my build.xml to compile a hello.c using cc compiler

                    <project name="ABC" default="compile"  basedir=".">
                      <taskdef resource="net/sf/antcontrib/antcontrib.properties">
                        <classpath>
                          <pathelement location="/apps/concdev/concANT/1.5.1/solaris/lib/ant-contrib-0.3.jar"/>
                        </classpath>
                      </taskdef>
                            <taskdef name="cc"
                                    classname="net.sf.antcontrib.cpptasks.CCTask" />

                      <taskdef resource="cpptasks.tasks"/>
                      <typedef resource="cpptasks.types"/>
                      <target name="compile" depends="">
                          <cc name="cc" debug="true" outfile="./build/">
                            <fileset dir="src" includes="*.c"/>
                          </cc>
                    </target>
                    </project>

                    I get the following error:
                    cc is not a legal value for this attribute

                     
                    • sunilscr
                      sunilscr
                      2008-03-19

                      check the follwoing link for correct option

                       
    • sunilscr
      sunilscr
      2008-03-19

      check the follwoing link for correct option
      http://ant-contrib.sourceforge.net/cc.html

       
    • sunilscr
      sunilscr
      2008-03-19

      Also have you tried "suncc" for name attribute

       
    • The list of compilers "http://ant-contrib.sourceforge.net/cc.html" does not include "cc" compiler. So does that mean that ANT cc task does not support cc compiler and there is no way to compile c source code using cc compiler?

      I cannot try suncc compiler because it is not present on my machine.

       
      • Curt Arnold
        Curt Arnold
        2008-03-19

        I'm not familiar with that compiler and I don't see a "suncc" option in my current source code.  Could you provide:

        1. The name of the compiler vendor
        2. The full product name of the compiler
        3. The particular version that you are interested in
        4. Operating systems that the compiler runs on
        5. Links to any online documentation for the command line or the output from something like "cc --help".
        Also similar info for the linker if not the platform linker.
        6. Whether the compiler can be obtained at little or no cost at least for evaluation?

        That should be enough to add at least a skeletal compiler adapter for your compiler.  Writing a compiler adapter can be fairly straight-forward.  If you'd like to take it on and attach it to a bug report, I can commit it in fairly short order.