Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12589 Discussions

Toolchain compile problems on RHEL 6.3

Altera_Forum
Honored Contributor II
1,310 Views

I am having some problems compiling the Nios2 toolchain on RHEL 6.3 64bit and need some advice. In a nutshell, the gcc3 build in the tool chain produces a segmentation fault during the compile. 

 

Because I went to a lot of trouble getting Quartus and Eclipse/Nios2 working on RHEL 6.3 64 I hesitate to use another version. Also, once it works I can help others get it working, share the Parallels VM instance, etc. 

 

The main question is whether it is better to work on getting the toolchain to compile with the version of gcc on RHEL 6.3, which is gcc-4.4.6-4.el6.x86_64, try to work around the segmentation fault, just report a gcc bug and wait for help, or is the only practical approach to take the easy way out and use an existing VM. 

 

From my point of view, the best solution would seem to be to get the tool chain to build with gcc4 and completely sidestep the problem. However, having not worked on linux for the last 10 years, getting back up to speed might be painful. 

 

--------------- 

Gory Details 

--------------- 

 

Note, these are related to gcc3. I put them here so it is clear the nature of the obstacle. I don't expect anyone in this forum to try to solve a problem compiling gcc3. 

 

Note that bison can't process c-parse.y in gcc3. For example: 

 

structsp_attr: 

struct_head identifier '{' 

{ start_struct (RECORD_TYPE, $2); 

/* Start scope of tag before parsing components. */ 

component_decl_list '}' maybe_attribute 

{ $$ = finish_struct ($<ttype>4, nreverse ($5), 

chainon ($1, $7)); } 

 

processes, but  

 

structsp_attr: 

struct_head identifier '{' 

{ $$ = start_struct (RECORD_TYPE, $2); 

/* Start scope of tag before parsing components. */ 

component_decl_list '}' maybe_attribute 

{ $$ = finish_struct ($<ttype>4, nreverse ($5), 

chainon ($1, $7)); } 

 

does not. I had to remove the "$$ = " on the third line. I am not a bison expert, so I can't say if this works, as I have not be able to compile gcc3 yet, due to the segmentation fault. 

 

The fault results: 

 

In file included from /home/mike/Embedded/Altera/nios2-linux/toolchain-build/build/sysroot//usr/include/bits/pthreadtypes.h:23, 

from /home/mike/Embedded/Altera/nios2-linux/toolchain-build/build/sysroot//usr/include/bits/types.h:206, 

from /home/mike/Embedded/Altera/nios2-linux/toolchain-build/build/sysroot//usr/include/stdio.h:36, 

from /home/mike/Embedded/Altera/nios2-linux/toolchain-build/../gcc3/gcc/tsystem.h:79, 

from /home/mike/Embedded/Altera/nios2-linux/toolchain-build/../gcc3/gcc/crtstuff.c:62: 

/home/mike/Embedded/Altera/nios2-linux/toolchain-build/build/sysroot//usr/include/bits/sched.h:94: internal compiler error: Segmentation fault 

Please submit a full bug report, 

 

 

This will give you the nature of the error, which is not a nios2 specific issue.
0 Kudos
5 Replies
Altera_Forum
Honored Contributor II
335 Views

This problem comes up on 64-bit system, but you can compile it on a 32-bit system and copy the binaries.

0 Kudos
Altera_Forum
Honored Contributor II
335 Views

I suppose you also can install the 32 bit gcc (for PC) on the 64 bit system.  

 

-Michael
0 Kudos
Altera_Forum
Honored Contributor II
335 Views

If that is the host gcc faulting, then it is a bug in the installed gcc itself, not in gcc sources being built. 

That even just looks like a simple system header file include sequence. 

Possibly reducing the optimisation level (or removing some very specific optimisations) might help. 

 

You should be able to get gcc to generate 32bit code by just adding -m32, but I don't think linux distributions contain enough 'stuff' to let you compile and build 32bit programs on a 64bit system (NetBSD does!). 

 

If you are compiling gcc for nios, I'd consider applying the patches I put on the wiki - especially if you need to the code to run as fast as possible.
0 Kudos
Altera_Forum
Honored Contributor II
335 Views

 

--- Quote Start ---  

If that is the host gcc faulting, then it is a bug in the installed gcc itself, not in gcc sources being built. 

--- Quote End ---  

 

IIRC the crash comes up in the bootstrap compiler built and used as part of the toolchain build, not in the installed gcc. 

 

 

--- Quote Start ---  

If you are compiling gcc for nios, I'd consider applying the patches I put on the wiki - especially if you need to the code to run as fast as possible. 

--- Quote End ---  

 

Link please?
0 Kudos
Altera_Forum
Honored Contributor II
335 Views

I don't remember compiling a boostrap compiler, just directly compiling the toolchain. 

See: http://www.alterawiki.com/wiki/crossgcc 

 

The patches used to be subordinate to that page, but the wiki got changed from one that had a hierarchy of pages to a great flat tree - making it much harder to find! 

They seem to be at: http://www.alterawiki.com/wiki/gcc_patches
0 Kudos
Reply