7 Replies Latest reply: Sep 5, 2012 5:50 AM by JanArneSobania RSS

    Cross-Compiler Update

    Edward

      Hi,

       

      Are there any plans to update the cross compilers in the repository to newer versions, namely gcc to 4.0+? There are various compilation issues I'm experiencing that are supposed to be fixed in the newer versions.

       

      Thanks,

       

      Edward

        • 1. Re: Cross-Compiler Update
          Hayder

          Hi Edward,

           

          You have two options to use new version of gcc on SCC:

          1) You should be able to build a custom linux that has new version of gcc, or using sccKit 1.4.2.2 which uses buildroot 2011.11 and comes with kernel 3.1.4 that its default cross-gcc seems to be gcc-4.4.6.

          2) You could generate a new version of gcc by using crosstool-ng.

           

          Hopefully, this reply help you.

          • 2. Re: Cross-Compiler Update
            Edward

            Hi Hayder,

             

            I am new to cross-compilation. Can you (or anyone else) give me a few starters as how to generate a new gcc for the SCC via crosstool-ng?

             

            Thanks a lot,

             

            Edward

            • 3. Re: Cross-Compiler Update
              Hayder

              Hi Edward,

               

              First of all, you need to install Crosstool-ng, and you could download from this website:

              http://crosstool-ng.org/.

              You could tracking those instructions which found in this tutorials to understand how to build cross-compiler:

              http://www.aclevername.com/articles/linux-xilinx-tutorial/crosstool-ng-1.3.2.html

              http://getglitched.com/?page_id=253

              Other way, I attached the configuration file (I got it from Isaías and modified it) for crosstool-ng 1.11.3, that will build a 4.4.6 toolchain with C/C++ and fortran. It works and you could just download it and copy the contents of file and place it in the .config file under your crosstool-ng working directory and instruct crosstool-ng to build the compiler by using ./ct-ng build.

              BTY, the .config file is already existing in crosstool directory, just you need modified it.

               

              Do not hesitate to ask more questions.

               

              Regards!

               

              Hayder

              • 4. Re: Cross-Compiler Update
                Edward

                Hi Hayder,

                 

                Thanks again for your very helpful post. I was able to run crosstool-ng and generate a new 4.4.6 gcc. However, I run into the peculiar problem of gcc not being able to locate the libraries and supporting programs it generated. When I type './gcc -print-search-dirs', the listed search directories include the generated library directories from crosstool-ng. However, it still seems unable to find these files. To test, when I run gcc on a Hello World program hello.c, I get the error:

                 

                gcc: error trying to exec 'cc1': execvp: No such file or directory

                 

                even though cc1 is reported as being searched for by gcc with that previous command. When I do a gcc hello.c -v, it does not show that it's looking for includes in the right directories. Strangely enough, adding the location to PATH doesn't help either.

                 

                Is there an easy or proper way to get the location associations right, or do I have to do everything manually?

                 

                Thanks again,

                 

                Edward

                • 5. Re: Cross-Compiler Update
                  Hayder

                  Hi Edward,

                   

                  I don't know exactly why you got at this error, but I think there is mistake when you use this compiler.

                  If you could posting the procedure of compile your code and the message error.

                  Any way, I attached picture that contained the procedure of test the compiler and you could follow it and check your code.

                  1. Add your new compiler to your Path by using:

                  export PATH=$PATH:/(directory of cross compiler)/build/install/i586-unknown-linux-gnu/bin

                  2. To be sure the compiler in your Path:

                  which i586-unknown-linux-gnu-gcc

                  3. to compile your code use i586-unknown-linux-gnu-gcc or i586-unknown-linux-gnu-g++

                  4. You could also find in attached file the output of run hello world program.

                  BTY, the program run in MCPC and SCC.

                   

                  Regards!

                   

                  Hayder

                  • 6. Re: Cross-Compiler Update
                    Edward

                    Hi Hayder,

                     

                    Thanks for the reply, but I figured it out! I was simply using the wrong binary, located a deep build directory in crosstool-ng. I now realize that I'm supposed to use i586-unknown-linux-gnu-gcc. Everything works perfectly now.

                     

                    Thanks for all of your help! I'll let you know if I have more questions.

                     

                    Best Regards,

                     

                    Edward

                    • 7. Re: Cross-Compiler Update
                      JanArneSobania

                      Hi Edward,

                       

                      just as an addition, I posted a HOWTO on building gcc 4.6.1 as part of the sccKit build process here: (Bug #436, Comment #30): http://marcbug.scc-dc.com/bugzilla3/show_bug.cgi?id=436#c30

                       

                      Regards,

                      Jan-Arne