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++
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
12748 Discussions

built program in nios2 IDE 5.0

Altera_Forum
Honored Contributor II
1,769 Views

Hi all: 

 

I make ncurses 5.5 and cdk source code by RED HAT LINUX 8.0. After make I got 

 

the include files and the interrelated libcdk.a , libncurses.a .Then I edit my  

 

application program use Microtronix Nios II LINUX Application Project module in  

 

nios2 IDE 5.0. My source code as follows: 

# include "cdkscreen.h" 

 

int main(void) 

initCDKColor(); 

 

return 0; 

 

My makefile as follows: 

# # configurable options# - set DEBUG = 1 to turn on debugging support#  

DEBUG = 1 

PROJ_NAME = testcdkc 

LIBNETDIR := cdk_lib 

INSTALL_DIR =  

PROGS := $(PROJ_NAME).exe 

CFLAGS += 

# # You should not need to modify anything beyond this point#  

include Rules.mak 

 

ifeq '$(DEBUG)' '1' 

PROGS += $(PROGS:.exe=.gdb) 

endif 

 

CFLAGS += -I include -I ncurses_include -I$(LIBNETDIR) 

LDLIBS += $(LIBNETDIR)/libncurses.a $(LIBNETDIR)/libcdk.a  

 

all: $(PROGS) 

 

.PHONY: clean 

clean: 

-rm -f *.[oad] *.elf *.gdb *.bin *.exe 

 

.PHONY: install 

install: all 

ifeq "$(INSTALL_DIR)" "" 

$(error No installation directory specified) 

endif 

mkdir -p $(INSTALL_DIR)/bin 

install -v $(filter %.exe, $(PROGS)) $(INSTALL_DIR)/bin 

 

But I build the program fail. The fail information as follows: 

 

make -k all  

no emulation specific options. 

nios2-elf-gcc -nostdinc -D__linux__ -O0 -g -I"d:/altera/kits/nios2/bin/eclipse/plugins/com.microtronix.nios2linux.uClibc_1.4.0"/include -I/cygdrive/d/altera/kits/nios2/bin/nios2-gnutools/H-i686-pc-cygwin/bin/../lib/gcc/nios2-elf/3.4.1//include -fno-optimize-sibling-calls -mhw-mul -mhw-mulx -I include -I ncurses_include -Icdk_lib -Wall -c -o testcdkc.o testcdkc.c 

nios2-elf-gcc -msys-crt0="d:/altera/kits/nios2/bin/eclipse/plugins/com.microtronix.nios2linux.uClibc_1.4.0"/lib/crt0.o -r -d -L"d:/altera/kits/nios2/bin/eclipse/plugins/com.microtronix.nios2linux.uClibc_1.4.0"/lib -o testcdkc.bin testcdkc.o /cygdrive/d/altera/kits/nios2/bin/nios2-gnutools/H-i686-pc-cygwin/bin/../lib/gcc/nios2-elf/3.4.1/../../../../nios2-elf/lib/libm.a /cygdrive/d/altera/kits/nios2/bin/nios2-gnutools/H-i686-pc-cygwin/bin/../lib/gcc/nios2-elf/3.4.1/libgcc.a "d:/altera/kits/nios2/bin/eclipse/plugins/com.microtronix.nios2linux.uClibc_1.4.0"/lib/libc.a cdk_lib/libncurses.a cdk_lib/libcdk.a cdk_lib/libnet.a  

/cygdrive/d/altera/kits/nios2/bin/nios2-gnutools/H-i686-pc-cygwin/bin/../lib/gcc/nios2-elf/3.4.1/../../../../nios2-elf/bin/ld: cdk_lib/libcdk.a(draw.o): Relocations in generic ELF (EM: 3) 

cdk_lib/libcdk.a: could not read symbols: File in wrong format 

collect2: ld returned 1 exit status 

make: *** [testcdkc.bin] Error 1 

make: Target `all' not remade because of errors. 

rm testcdkc.o 

 

I think the reason of my failure is 

 

cygwin/bin/../lib/gcc/nios2-elf/3.4.1/../../../../nios2-elf/bin/ld: cdk_lib/libcdk.a(draw.o): Relocations in generic ELF (EM: 3) 

cdk_lib/libcdk.a: could not read symbols: File in wrong format 

collect2: ld returned 1 exit status 

make: *** [testcdkc.bin] Error 1 

 

 

Who can tell me resolvent? I think it cause to libcdk.a through RAD HAT LINUCX turn into, it is fail to compile to lead to the fact. 

 

Thanks a lot
0 Kudos
5 Replies
Altera_Forum
Honored Contributor II
671 Views

up

0 Kudos
Altera_Forum
Honored Contributor II
671 Views

 

--- Quote Start ---  

originally posted by alex824@Nov 10 2005, 09:50 PM 

hi all: 

i make ncurses 5.5 and cdk source code by red hat linux 8.0. after make i got 

the include files and  the interrelated libcdk.a , libncurses.a .then i edit my  

application program use microtronix nios ii linux application project module in  

nios2 ide 5.0.  

[...] 

--- Quote End ---  

 

 

It looks like you compiled i386(intel) binaries with your RedHat machine. You need to crosscompile ncurses for the nios2 platform in order to use the libraries on your nios2 system. The fact that you get: 

"could not read symbols: File in wrong format" 

Is most likely because it's a i386 lib and not a nios2 lib.
0 Kudos
Altera_Forum
Honored Contributor II
671 Views

 

--- Quote End ---  

 

 

It looks like you compiled i386(intel) binaries with your RedHat machine. You need to crosscompile ncurses for the nios2 platform in order to use the libraries on your nios2 system. The fact that you get: 

"could not read symbols: File in wrong format" 

Is most likely because it's a i386 lib and not a nios2 lib. 

<div align='right'><{post_snapback}> (index.php?act=findpost&pid=10966)</div> 

 

--- Quote End ---  

 

 

Hi wqossens, thanks for you reply. I think you are right. 

 

But I dont&#39;t know how to rework the ncurses configure file. 

 

In the nios sdk shell, I type ./configure to crosscompile ncurses. 

but fail. The error information as follow: 

 

egrep: not found 

egrep: not found 

egrep: not found 

Configuring NCURSES . ABI <Tue Nov 15 10:18:48 2005> 

configure: error: Release major-version value is empty 

 

What can I do?Should I must use microtronix Nios II Cross Development Kit to  

crosscompile the whole GNU opensource code?
0 Kudos
Altera_Forum
Honored Contributor II
671 Views

 

--- Quote Start ---  

originally posted by alex824@Nov 14 2005, 09:31 PM 

what can i do?should i must use microtronix nios ii cross development kit to  

crosscompile the whole gnu opensource code? 

<div align='right'><{post_snapback}> (index.php?act=findpost&pid=10973) 

--- quote end ---  

 

--- Quote End ---  

 

 

Since you have a RedHat machine I&#39;d recommend you using the crosscompiler as shown discussed in the this (http://www.niosforum.com/forum/index.php?showtopic=2007#) thread which links to marc&#39;s crosscompiler (http://scorpius.homelinux.org/~marc/nios2.html) which I use for all my crosscompiling.  

 

You can configure with ./configure --target=nios2-linux but you (probably) have to add "nios2" to the list of machines in the config.sub file in the section starting with: 

case $basic_machine in: 

Or something like that. I&#39;m currently on Windows so I&#39;m afraid I can&#39;t check. 

 

Hope this helps.
0 Kudos
Altera_Forum
Honored Contributor II
671 Views

Hi wqoossens ,thanks for you reply. 

 

I will try my best effort till success.
0 Kudos
Reply