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++
12604 Discussions

internal compiler error in Net-SNMP compilation

Altera_Forum
Honored Contributor II
1,836 Views

Did anyone run into that ? (build env is latest from GIT) 

 

 

../../net-snmp-5.2.1/snmplib/parse.c: In function 'unload_all_mibs': 

../../net-snmp-5.2.1/snmplib/parse.c:4057: error: unrecognizable insn: 

(insn 217 216 218 23 ../../net-snmp-5.2.1/snmplib/parse.c:3994 (set (reg:SI 50 [ D.13259 ]) 

(plus:SI (reg:SI 120) 

(const_int 114660 [0x1bfe4]))) -1 (nil) 

(expr_list:REG_EQUAL (const:SI (plus:SI (symbol_ref:SI ("tclist") <var_decl 0x40324d68 tclist>) 

(const_int 114660 [0x1bfe4]))) 

(nil))) 

../../net-snmp-5.2.1/snmplib/parse.c:4057: internal compiler error: in extract_insn, at recog.c:2093 

Please submit a full bug report, 

with preprocessed source if appropriate. 

See <URL:http://gcc.gnu.org/bugs.html> for instructions. 

make[5]: *** [parse.lo] Error 1 

 

any suggestion on how to continue from here ? if I unselect net-snmp and delete all build related directories and reselct it with different options set it sometimes work.. there is something inconsistent with building that application ... 

 

Thanks 

Lior
0 Kudos
13 Replies
Altera_Forum
Honored Contributor II
873 Views

Hi, 

 

I tested to compile 'net-snmp-5.2.1', and in may case, it succeeded. My compiler version is 

 

nios2-wrs-linux-gnu-gcc (Wind River Linux Sourcery G++ 4.1-176) 4.1.2 Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

 

I did it as 

 

PATH=$PATH:/home/***/nios2-linux/toolchain-mmu/x86-linux2/bin cd /home/***/nios2-linux/uClinux-dist/user/net-snmp/net-snmp-5.2.1/ export CC="nios2-wrs-linux-gnu-gcc -I/***/usr/include" export LDFLAGS="-L/***/usr/lib/ -g" export CFLAGS="-I/***/usr/include -g" export CPPFLAGS="-I/***/usr/include -g" export PKG_CONFIG_PATH=/***/usr/lib/pkgconfig/ ./configure --host=nios2-wrs-linux-gnu --prefix=/***/usr --with-endianness=little make -f Makefile -B

 

But I'd also experienced a compiler's internal error when I compiled the X Window. It sometimes goes well and sometimes reports the error. So I think this is a kind of bug like 

 

http://www.alteraforum.com/forum/showthread.php?t=26354 

 

Kazu.
0 Kudos
Altera_Forum
Honored Contributor II
873 Views

Hi Kazu, 

tried with wind-river compiler and got same problem (plz see below)... any idea ? 

 

lior@lior-linux-desktop:~/nios2-linux/uClinux-dist/user/net-snmp/build/snmplib$ ../../../../../toolchain-mmu/wrs-linux-4.1/bin/nios2-wrs-linux-gnu-gcc -I../include -I../../net-snmp-5.6/include -I. -I../snmplib -I../../net-snmp-5.6/snmplib -DEMBED -I/home/lior/nios2-linux/uClinux-dist -mhw-mul -mno-hw-mulx -pipe -Wall -g -O2 -mhw-mul -mno-hw-mulx -Ulinux -Dlinux=linux -c ../../net-snmp-5.6/snmplib/parse.c -fPIC -DPIC -o .libs/parse.o 

cs-license: error trying to exec 'get_feature': execvp: No such file or directory 

../../net-snmp-5.6/snmplib/parse.c: In function 'unload_all_mibs': 

../../net-snmp-5.6/snmplib/parse.c:4166: error: unrecognizable insn: 

(insn 217 216 218 23 ../../net-snmp-5.6/snmplib/parse.c:4103 (set (reg:SI 50 [ D.15025 ]) 

(plus:SI (reg:SI 120) 

(const_int 114660 [0x1bfe4]))) -1 (nil) 

(expr_list:REG_EQUAL (const:SI (plus:SI (symbol_ref:SI ("tclist") <var_decl 0xb74bf210 tclist>) 

(const_int 114660 [0x1bfe4]))) 

(nil))) 

../../net-snmp-5.6/snmplib/parse.c:4166: internal compiler error: in extract_insn, at recog.c:2093 

Please submit a full bug report, 

with preprocessed source if appropriate. 

See <URL:support@windriver.com> for instructions.
0 Kudos
Altera_Forum
Honored Contributor II
873 Views

Hi, 

 

OK, I could also generate the internal error by your command. In my system, the file 'parse.c' is compiled as 

 

nios2-wrs-linux-gnu-gcc -I/mnt/usr/include -I../include -I. -I../snmplib -I/mnt/usr/include -g -I/mnt/usr/include -g -Dlinux -c parse.c -fPIC -DPIC -o .libs/parse.lo nios2-wrs-linux-gnu-gcc -I/mnt/usr/include -I../include -I. -I../snmplib -I/mnt/usr/include -g -I/mnt/usr/include -g -Dlinux -c parse.c -o parse.o >/dev/null 2>&1

 

It seems that some compile switches will evoke the error. So let me investigate for a while. 

 

Kazu
0 Kudos
Altera_Forum
Honored Contributor II
873 Views

Hi Lior, 

 

Did you follow the setting in 

http://www.alterawiki.com/wiki/netsnmp 

 

Hippo
0 Kudos
Altera_Forum
Honored Contributor II
873 Views

Hi Hippo, 

 

There is nothing to follow there actually than not choosing static linking (which I indeed didn't choose since I'm working with MMU). The tutorial there doesn't build the applications (snmpget etc..) and that's why it succeed (it also works fine for me when not building the applications)... 

I managed to compile snmpd and the application in one of the trials and kept the executables. Since I'm in a tight deadline I decided to install the applications manually (i.e. place them in the romfs dir) and remove the net-snmp flag from compilation. 

 

I have confirmed that indeed without the -DPIC -FPIC flags, the compilation (at least the files it complains about) is successful but I have no idea what are this flags and where to remove them from... 

 

Did you try to compile it (the whole net-snmp application) without this flags ?  

 

Thanks 

Lior
0 Kudos
Altera_Forum
Honored Contributor II
873 Views

Hi, 

 

This internal error is caused by the gcc's loop optimization, -fPIC switch and incomplete implementation of Nios code generation. 

If we compile the next source 

 

/* test.c for nios2-wrs-linux-gnu-gcc internal error */ # define MAXST 1024*8 + 1 struct st { int i; } st; void test() { struct st *pst = st; int i; /* * Loop Optimization: eliminating of the loop valiable i with -O1,2,3. * You can disable this optimization with -fno-tree-loop-optimize. */ for (i = 0; i < MAXST; i++) { if (pst->i == 0) { break; } pst++; } } with  

nios2-wrs-linux-gnu-gcc -O2 -fPIC -S test.c -o test.s gcc will eliminate the loop variable 'i', use the pointer 'pst' instead of it and try to calculate the address for 'pst' when the loop is ended. But Nios code generator does not have the instruction like 

 

addi reg, reg, 32bits_immediate_data so the internal error is evoked. If you set the size of st[MAXST] within 1024*8, the immediate data is reduced within 16bits, so you can avoid the internal error. 

 

To use the compiler switch -fno-tree-loop-optimize is one method for work-around. Also next modification for the loop inside the function 'unload_all_mibs()' 

/* * tree nodes are cleared */ for (i = 0, ptc = tclist; i < MAXTC; i++/*, ptc++*/) { if (ptc->type == 0) { ptc++; continue; } free_enums(&ptc->enums); free_ranges(&ptc->ranges); free(ptc->descriptor); if (ptc->hint) free(ptc->hint); ptc++; } led me to the success of its compilation. 

 

Kazu 

 

P.S. Hi, Hippo, 

 

I think that the most important main maintainer's work is to show the direction of projects and gather many experts for its promotion rather than to answer FAQs in this forum. What is the project's main direction now?
0 Kudos
Altera_Forum
Honored Contributor II
873 Views

hi Kazuyasu, 

it works fine now! thanks.  

Lior
0 Kudos
Altera_Forum
Honored Contributor II
873 Views

Hi Kazu, 

 

Thanks for the questions. And I really need your help. 

 

I have very limited spare time to do real work on nios2 linux. I can no longer do it at home as the early years since my family wanted me to spend more time with them instead of sitting in front of the PC. I could use only break/lunch time between my work. >< 

 

It would be nice if you can work as the chief maintainer. You surely know much better than I do. Please help the community. 

 

Best regards, 

Hippo
0 Kudos
Altera_Forum
Honored Contributor II
873 Views

Hi, Hippo, 

 

 

--- Quote Start ---  

 

It would be nice if you can work as the chief maintainer. You surely know much better than I do. Please help the community. 

 

--- Quote End ---  

 

 

At first, we must consider the next three points. 

 

1) How can we maintain the Nios Linux distribution and its community? 

2) Why must we maintain the Nios Linux distri. and its community? 

3) What does Altera consider about the Nios Linux distri. and its community? 

 

To maintain a Linux distri., we need at least 5~8 experts who can contribute continuously (3 experts for Linux kernel itself, 2~3 experts for tool-chains, and 1 or more for its applications). Especially we only have incomplete tool-chains, so we must repair it, but I don't want to treat the 'Stallman's Black Magic' without some financial reward, because it's a quite hard and time-eating task. Moreover, Linux kernel is only 'a kernel' and we need some attractive and practical applications which run on the Nios Linux system. Present Nios Linux distri. is a 'cannon without shells'. How many experts can you prepare? 

 

Second question deeply relates to 3). These source codes are the products of 'Open Source' communities, and such communities are maintained by many volunteers. Altera once used the products for their commercial benefit and threw back those to volunteers again. I think it's a little bit irresponsible and selfish behavior. What is the benefit for volunteers and customers of Altera to maintain this community? Moreover, we should consider that Altera is now planning to introduce the ARM and MIPS core into their FPGA. How does Altera treat the Nios after those? Anyway we must consider that we are all dancing on the stage of Open Source communities, and Altera must load those products into their ARM cores etc. So I think that Altera should read the famous paper 'The Cathedral and the Bazaar' 

 

http://www.catb.org/~esr/writings/cathedral-bazaar/ (http://www.catb.org/%7eesr/writings/cathedral-bazaar/

 

to succeed in the open source communities, because it has been proved that the qualities of their products which they spent a lot of money are quite low as they need the debugging of Sunday programmers. 

 

Kazu
0 Kudos
Altera_Forum
Honored Contributor II
873 Views

Dear Kazu, 

 

I couldn't get the response of question 3) from Altera yet after weeks. I will poke them again after the holidays. 

 

For question 1), Tobias and I are working on kernel. We don't have people actively working on the toolchain, except you. The application mostly relies on Mike Frysinger's Blackfin uClinux-dist port. Other people help from time to time. 

 

For question 2), my personal answer is "just for fun". I am a newbie in any ways. It is great to share and learn with people all over the world. 

 

I don't really want to rely on Altera. They would rather tell their customers turn to commercial support when they want Linux. The community should find its own way. 

 

Cheers, 

Hippo
0 Kudos
Altera_Forum
Honored Contributor II
873 Views

 

--- Quote Start ---  

Hi, 

 

I tested to compile 'net-snmp-5.2.1', and in may case, it succeeded. My compiler version is 

 

nios2-wrs-linux-gnu-gcc (Wind River Linux Sourcery G++ 4.1-176) 4.1.2 Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

 

I did it as 

 

Kazu. 

--- Quote End ---  

 

 

Hi, Mr Kazu 

Could you do me a favor? 

Why did I Build the gcc4 toolchain with the method of this url http://www.alterawiki.com/wiki/build_the_gcc4_toolchain 

I can't find neither the nios2-wrs-linux-gnu file nor folder,even not use the command 'nios2-wrs-linux-gnu-gcc -v' 

# cd /opt/nios2gcc4/ # ls build.sh install logs obj pkg src # cd /opt/nios2gcc4/src/ # ls binutils-2.17.50 gcc-4.1 glibc-2.5 glibc-ports-2.5 expat-mirror gdb-wrs glibc_localedef-2.5 linux-2.6.21-wrs-nios2 # ls 0001-kbuild-fix-C-libary-confusion-in-unifdef.c-due-to-g.patch lib arch ltt block MAINTAINERS COPYING Makefile CREDITS mm crypto net Documentation README drivers REPORTING-BUGS fs scripts include security init sound ipc usr Kbuild WRLINUX_PATCHES kernel #  

So, I can't make EP3C120_config with the nios2-wrs-linux-gnu-gcc. 

# make EP3C120_config make: nios2-wrs-linux-gnu-gcc&#65306;command not found Generating include/autoconf.mk.dep /bin/sh: line 3: nios2-wrs-linux-gnu-gcc: command not found Configuring for EP3C120 board... Thanks!
0 Kudos
Altera_Forum
Honored Contributor II
873 Views

Hi, 

 

 

--- Quote Start ---  

 

Why did I Build the gcc4 toolchain with the method of this url http://www.alterawiki.com/wiki/build_the_gcc4_toolchain 

I can't find neither the nios2-wrs-linux-gnu file nor folder,even not use the command 'nios2-wrs-linux-gnu-gcc -v' 

 

So, I can't make EP3C120_config with the nios2-wrs-linux-gnu-gcc. 

 

--- Quote End ---  

 

 

?? The word "wrs" means the version which is compiled by 'Wind River Systems". If you build tools from these sources, the compiler's names will be "nios2-linux-gnu-***". 

And you may also get the compiled tools from the ftp site, 

 

ftp://sopc.et.ntust.edu.tw/pub/gnutools/ 

 

Kazu
0 Kudos
Altera_Forum
Honored Contributor II
873 Views

Hi, How did you build this nios2-wrs-linux-gnu-gcc (Wind River Linux Sourcery G++ 4.1-176) 4.1.2 

tools&#65311; Could you give me some a clue ? 

Although I have build these tools,but the toolchain-build still remind me  

/bin/sh: nios2-wrs-linux-gnu-gcc: command not found Which step do I lost ? 

# nios2-linux-gnu-gcc -vUsing built-in specs. Target: nios2-linux-gnu Configured with: /opt/nios2gcc4/src/gcc-4.1/configure --build=i686-pc-linux-gnu --host=i686-pc-linux-gnu --target=nios2-linux-gnu --enable-threads --disable-libmudflap --disable-libssp --disable-libstdcxx-pch --with-gnu-as --with-gnu-ld --enable-languages=c,c++ --enable-shared --enable-symvers=gnu --enable-__cxa_atexit --disable-nls --prefix=/opt/nios2 --with-sysroot=/opt/nios2/nios2-linux-gnu/libc --with-build-sysroot=/opt/nios2gcc4/install/nios2-linux-gnu/libc --disable-libgomp --enable-poison-system-directories Thread model: posix gcc version 4.1.2 # nios2-linux-uclibc-gcc -v Reading specs from /opt/nios2/lib/gcc/nios2-linux-uclibc/3.4.6/specs Configured with: /root/buildroot/toolchain_build_nios2/gcc-3.4.6/configure --prefix=/opt/nios2 --build=i386-pc-linux-gnu --host=i386-pc-linux-gnu --target=nios2-linux-uclibc --enable-languages=c,c++ --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-shared --disable-nls --enable-threads --enable-multilib Thread model: posix gcc version 3.4.6 # nios2-linux-gcc -v Reading specs from /opt/nios2/lib/gcc/nios2-linux-uclibc/3.4.6/specs Configured with: /root/buildroot/toolchain_build_nios2/gcc-3.4.6/configure --prefix=/opt/nios2 --build=i386-pc-linux-gnu --host=i386-pc-linux-gnu --target=nios2-linux-uclibc --enable-languages=c,c++ --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-shared --disable-nls --enable-threads --enable-multilib Thread model: posix gcc version 3.4.6 Thanks!
0 Kudos
Reply