Forum Discussion
Altera_Forum
Honored Contributor
15 years agointernal compiler error in Net-SNMP compilation
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 Lior13 Replies
- Altera_Forum
Honored Contributor
Hi,
I tested to compile 'net-snmp-5.2.1', and in may case, it succeeded. My compiler version is
. I did it asnios2-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.
. 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.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 - Altera_Forum
Honored Contributor
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:[email protected]> for instructions. - Altera_Forum
Honored Contributor
Hi,
OK, I could also generate the internal error by your command. In my system, the file 'parse.c' is compiled as
. It seems that some compile switches will evoke the error. So let me investigate for a while. Kazunios2-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 - Altera_Forum
Honored Contributor
Hi Lior,
Did you follow the setting in http://www.alterawiki.com/wiki/netsnmp Hippo - Altera_Forum
Honored Contributor
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 - Altera_Forum
Honored Contributor
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
with/* 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++; } }
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 likenios2-wrs-linux-gnu-gcc -O2 -fPIC -S test.c -o test.s
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()'addi reg, reg, 32bits_immediate_data
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?/* * 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++; } - Altera_Forum
Honored Contributor
hi Kazuyasu,
it works fine now! thanks. Lior - Altera_Forum
Honored Contributor
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 - Altera_Forum
Honored Contributor
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 - Altera_Forum
Honored Contributor
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