4 Replies Latest reply on Aug 12, 2011 11:17 AM by wbrozas

    Problem compiling C++ for SCC: could not open source file "cstdio"

    ally

      Hi

       

      I'm trying to compile a large C++ application to run on the SCC cores.

       

      I have sourced "crosscompile.sh", and have set my Makefile to use icpc instead of g++.  When I type: which icpc, I get:

       

      /opt/icc-8.1.038/bin/icpc

       

      which I believe is correct.

       

      However, compilation fails with this error:

       

      main.cc(2): catastrophic error: could not open source file "cstdio"
        #include <cstdio>

       

      Doing "locate cstdio" gives me this:

       

      /opt/i386-unknown-linux-gnu/include/c++/3.4.5/cstdio
      /opt/icc-8.1.038/include/c++/cstdio
      /usr/include/c++/4.4/cstdio
      /usr/include/c++/4.4/tr1/cstdio
      /usr/include/c++/4.4/tr1_impl/cstdio

       

      My understanding is that, having source crosscompile, I should be interested in one of the first two "cstdio" options, not the other three.

       

      Since I am running icpc, I figured the second one, /opt/icc-8.1.038/include/c++/cstdio, should be right.  So I add:

       

      -I/opt/icc-8.1.038/include/c++/cstdio

       

      to my compile command.

       

      My questions are:

       

      1) is this the right thing to do?

      2) why do I have to add this, when icpc was able to successfully pick up lots of other C++ headers?

        • 1. Re: Problem compiling C++ for SCC: could not open source file "cstdio"
          wbrozas

          I saw in the documentation programs being compiled with these flags. This will probably not fix your current problem but may fix later ones.

           

          icpc -DCOPPERRIDGE -static -mcpu=pentium -gcc-version=340

           

          As for your current problem -I should be followed by a directory and you probably need -L as well for libraries

           

          Try adding -I/opt/intel_cc_80/include -L/opt/intel_cc_80/lib

           

          instead of -L you can also set your LD_LIBRARY_PATH, I don't know what the equivalent is for include but the compiler will search through the directories listed in your LD_LIBRARY_PATH, it may have found some files there. When you source that script it probably changes your LD_LIBRARY_PATH

          • 2. Re: Problem compiling C++ for SCC: could not open source file "cstdio"
            tedk

            Please don't use -DCOPPERRIDGE ... it's now -DSCC. Copperridge is a legacy name and the docs are behind rev.

             

            Did you look at http://marcbug.scc-dc.com/bugzilla3/show_bug.cgi?id=74

            • 3. Re: Problem compiling C++ for SCC: could not open source file "cstdio"
              ally

              Thanks for the tips regarding those flags.

               

              But in relation to the problem finding "cstdio", can anyone comment as to why this standard file isn't found by icpc, and confirm which is the correct version to direct it to?

               

              Thanks

               

              Ally

              • 4. Re: Problem compiling C++ for SCC: could not open source file "cstdio"
                wbrozas

                When the binaries are created, you configure the compiler to search for include files in a specific path as well as library files. If you would like to search somewhere else (in this case you do) you can use the arguments -I and -L.

                 

                Use this command to see where gcc will search (This is how gcc was configured)

                 

                gcc -print-search-dirs

                 

                I do not know the equivalent for icpc, but I'm sure there is one

                 

                As for where icpc should be looking, it should be searching in /opt/intel_cc_80/include and /opt/intel_cc_80/lib

                 

                Those are the c and c++ header files that go with intel version 8 c and c++ compilers

                 

                The files in /usr/include are GNU c standard header files, which may or may not be compatible

                 

                #EDIT#

                Sorry I did not realize my directories are different. When I said /opt/intel_cc_80 it should be /opt/icc-8.1.038