Helpful ReplyLockedTrouble building XC32 v1.40 compiler tool chain from source, missing file: resource_info.h

Author
mjarabek
New Member
  • Total Posts : 5
  • Reward points : 0
  • Joined: 2015/11/11 14:39:43
  • Location: 0
  • Status: offline
2015/11/11 15:05:50 (permalink)
0

Trouble building XC32 v1.40 compiler tool chain from source, missing file: resource_info.h

Hi,
  I downloaded the XC32 source code, and have been building the various parts one at a time.  Gmp, ppl, cloog, libelf, zlib all build without error, and install fine in my staging directory.  Building binutils fails while compiling binutils/bfd/cpu-pic32.c with the following error message:
 
In file included from ../../../binutils/bfd/init.c:33:0:
../../../binutils/bfd/cpu-pic32.c:32:55: fatal error: ../../c30_resource/src/xc32/resource_info.h: No such file or directory
 #include "../../c30_resource/src/xc32/resource_info.h"
                                                       ^
compilation terminated.
Makefile:1576: recipe for target 'init.lo' failed


The error appears because in cpu-pic32.c, at line 32, it #includes the above named file.  This makes this file, and any files it references an inextricable part of the GNU code.  As such, it should be provided in the source code archives.  From digging around, it seems that similar files have been included in the release for the XC32 v1.34 compiler, but they seem to have been omitted for this v1.40 release of the XC32 compiler.
 
Can you provide a patch with updated versions of these files?
Thanks, In advance,
Mike Jarabek
#1
JasonK
Moderator
  • Total Posts : 3381
  • Reward points : 0
  • Joined: 2003/11/14 09:49:40
  • Location: Microchip Technology in Arizona, USA
  • Status: offline
Re: Trouble building XC32 v1.40 compiler tool chain from source, missing file: resource_in 2015/11/11 17:43:44 (permalink)
+2 (2)
Hi Mike,
Thanks for the report. The attached zip should have the files that you need. Let us know if you run into any other issues building.
Best Regards,
Jason Kajita
 

Attachment(s)

Attachments are not available: Download requirements not met

Jason Kajita
 Follow me on Twitter
http://support.microchip.com for urgent questions
#2
mjarabek
New Member
  • Total Posts : 5
  • Reward points : 0
  • Joined: 2015/11/11 14:39:43
  • Location: 0
  • Status: offline
Re: Trouble building XC32 v1.40 compiler tool chain from source, missing file: resource_in 2015/11/11 18:29:30 (permalink)
+1 (1)
Thanks,
Those files allow me to get further.
Now, it looks like there are issues with binutils/bfd/cpu-pic32.c.  Here there are several problems due to my use of gcc-4.8.5 to compile the source.
The first error is a bug:
 
In file included from ../../../binutils/bfd/init.c:33:0:
../../../binutils/bfd/cpu-pic32.c:114:4: error: missing initializer for field 'next' of 'bfd_arch_info_type' [-Werror=missing-field-initializers]
    ARCH ( 0, "32MXGENERIC", TRUE, 0, P32MX | HAS_MIPS32R2 | HAS_MIPS16);
    ^
In file included from ../../../binutils/bfd/init.c:24:0:
./bfd.h:2239:31: note: 'next' declared here
   const struct bfd_arch_info *next;
                               ^
This is because the structure element ' void *(*fill) (bfd_size_type count, bfd_boolean is_bigendian, bfd_boolean code);' is missing from the macro ARCH() defined at line 74 of binutils/bfd/cpu-pic32.c.  Likely this was a compilation warning that was ignored previously. (V1.34 source code has the same issue with it.) I'll put some time into finding out what that function should do, and either point the definition at the standard one, or implement the one that should be implemented.  Note that leaving this element out of the structure, in the way the macro does, having the 'next' field in it's place, could result in the bfd backend crashing (maybe). 
 
The remaining errors are from missing prototypes, incorrect usage of const, local variables shadowing global variables, and unused parameters for functions defined in this file.  In general these warnings come from the newer gcc 4.8.5 compiler being more picky, but could be hiding bugs, and should be fixed.  Note too, that most of these are also present in the V1.34 release. If this was my code, I certainly would be correcting the code to remove the warnings before subsequent releases.
 
I'll dig in some, and publish some patches, unless you know already of fixes originating internally to Microchip.
 
Thanks,
Mike
#3
ErkiA
New Member
  • Total Posts : 1
  • Reward points : 0
  • Joined: 2015/11/12 07:13:34
  • Location: 0
  • Status: offline
Re: Trouble building XC32 v1.40 compiler tool chain from source, missing file: resource_in 2015/11/13 03:37:36 (permalink)
+1 (1)
Hi guys!
 
I'm am also trying to compile the XC32 from source under Linux and running into the same problems. I've noticed, that under Windows, GCC outputs the following information:
GNU C (Microchip Technology) version 4.8.3 MPLAB XC32 Compiler v1.40 (pic32mx) compiled by GNU C version 4.8.0, GMP version 4.3.2, MPFR version 3.0.1-p4, MPC version 0.9
 
While under Linux, the output is:
GNU C (Microchip Technology) version 4.8.3 MPLAB XC32 Compiler v1.40 (pic32mx) compiled by GNU C version 4.1.1, GMP version 4.3.2, MPFR version 3.0.1-p4, MPC version 0.9
 
As I understand, XC32 is compiled using GCC version 4.8.0 under Windows, but 4.1.1 under Linux. Which makes me wonder, if there already exist some patches that make XC32 to compile using newer GCC?
 
The reason why I'm investigating this, is that I get some weird code optimization failures when using XC32 under Linux, while under Windows everything seems to be OK. And the main difference I see is the GCC version used to compile XC32 (besides having different OS, of course :) )
 
BR,
Erki
#4
mjarabek
New Member
  • Total Posts : 5
  • Reward points : 0
  • Joined: 2015/11/11 14:39:43
  • Location: 0
  • Status: offline
Re: Trouble building XC32 v1.40 compiler tool chain from source, missing file: resource_in 2015/11/13 09:05:17 (permalink)
0
Hi,
I've been making progress here, one bit at a time.  As I work through the code, there are many places where basic C best practices have been ignored.  Much of the code generates warnings, and the 'fixes' I see for the warnings are surface patches to quell the compiler, but that don't address the underlying issues. e.g. the compiler says it should be 'const' so let's make it 'const' without regard to why.
So far, with my patches, I seem to be able to compile the bfd library, and gas, I'm working on ld now.
I seriously don't understand how this compiles at all in the production build environment, unless during configure '-Wall' and '-Werror' are being omitted from the build flags.  In which case, it's pretty obvious to me that many real bugs are being hidden simply because the warnings are being ignored.
Most of the warnings are from what looks like cut and paste of code into other sections of code.  Relatively easy to clean up.
Once I get a successful build of binutils, I'll upload a patch set against the 1.40 source release here. (Assuming I can do that.)
#5
mjarabek
New Member
  • Total Posts : 5
  • Reward points : 0
  • Joined: 2015/11/11 14:39:43
  • Location: 0
  • Status: offline
Re: Trouble building XC32 v1.40 compiler tool chain from source, missing file: resource_in 2015/11/13 09:51:37 (permalink)
0
Hi,
   I have binutils compiling now.  I created a set of patches with the following command:
diff -r -2u xc32-tools-xc32-XC32_v1_40_branch-src.orig/binutils xc32-tools-xc32-XC32_v1_40_branch-src/binutils >xc32-tools-xc32-XC32_v1_40_branch-src_patch.txt


   They should apply with 'patch' or 'patch -p1' against the v1.40 source zip file distributed from the website.  Remember that you will also need the file for the c30_support directory posted above. 
 
   I think I did okay on the patches, but in  gldelf32pic32mx_place_orphan(), I had to create an invalid pointer to return as 'true'... nowhere does it actually dereference the pointer, so this _might_ be okay.
 
Mike

Attachment(s)

Attachments are not available: Download requirements not met
#6
mjarabek
New Member
  • Total Posts : 5
  • Reward points : 0
  • Joined: 2015/11/11 14:39:43
  • Location: 0
  • Status: offline
Re: Trouble building XC32 v1.40 compiler tool chain from source, missing file: resource_in 2015/11/13 21:25:59 (permalink) ☄ Helpfulby mickael9 2016/02/29 12:36:50
0
I got the rest of gcc to build.  My only issue was that there were a couple of places that #include <alloca.h>, which is deprecated, now it should #include <stdlib.h> instead.
 
I've been able to link against the Microchip supplied C libraries, and the resulting binary appears to work.
 
I am also looking to see if I can get a recent version of newlib targeted to this processor.  (After reading about the problems with file descriptors getting re-used on the other thread, and the absence of source code to be able to find out why that is happening.)  I found a couple of projects that got started in 2012, but nothing more recent.  I'd rather not start from scratch and do all the port work on newlib, if someone has patches hiding somewhere...  I'd appreciate a pointer.
 
Mike Jarabek
#7
Jump to:
© 2018 APG vNext Commercial Version 4.5