Forum Discussion
h264 for uclinux on cycloneIII 3C25
Hi,
I want to execute h264 code from (url: iphome.hhi.de/suehring/tml/download/old_jm/jm16.2.zip) into uclinux with a Xenomai patch. I used Nios2-ide for genrating the .elf file for the cycloneIII 3C25 platform but I had these error messages: --- Quote Start --- obj/win32.o(.text+0xf60): In function `down_scale': ../ifunctions.h:245: multiple definition of `down_scale' obj/annexb.o(.text+0xf60):../ifunctions.h:245: first defined here obj/win32.o(.text+0xfa8): In function `up_scale': ../ifunctions.h:256: multiple definition of `up_scale' obj/annexb.o(.text+0xfa8):../ifunctions.h:256: first defined here obj/win32.o(.text+0xff0): In function `dist_scale': ../ifunctions.h:267: multiple definition of `dist_scale' obj/annexb.o(.text+0xff0):../ifunctions.h:267: first defined here obj/win32.o(.text+0x103c): In function `dist_down': ../ifunctions.h:280: multiple definition of `dist_down' obj/annexb.o(.text+0x103c):../ifunctions.h:280: first defined here obj/win32.o(.sbss+0x0): In function `smin': ../ifunctions.h:29: multiple definition of `ProfileIDC' obj/annexb.o(.sbss+0x0):../ifunctions.h:29: first defined here obj/win32.o(.sbss+0x4): In function `smin': ../ifunctions.h:29: multiple definition of `MBModeTypes' obj/annexb.o(.sbss+0x4):../ifunctions.h:29: first defined here obj/win32.o(.sbss+0x8): In function `smin': ../ifunctions.h:29: multiple definition of `DirectModes' obj/annexb.o(.sbss+0x8):../ifunctions.h:29: first defined here obj/win32.o(.sbss+0xc): In function `smin': ../ifunctions.h:29: multiple definition of `CAVLCBlockTypes' obj/annexb.o(.sbss+0xc):../ifunctions.h:29: first defined here obj/win32.o(.sbss+0x10): In function `smin': ../ifunctions.h:29: multiple definition of `CABACBlockTypes' obj/annexb.o(.sbss+0x10):../ifunctions.h:29: first defined here obj/win32.o(.sbss+0x14): In function `smin': ../ifunctions.h:30: multiple definition of `I4x4PredModes' obj/annexb.o(.sbss+0x14):../ifunctions.h:30: first defined here obj/win32.o(.sbss+0x18): In function `smin': ../ifunctions.h:30: multiple definition of `I16x16PredModes' obj/annexb.o(.sbss+0x18):../ifunctions.h:30: first defined here obj/win32.o(.sbss+0x1c): In function `smin': ../ifunctions.h:30: multiple definition of `I8x8PredModes' obj/annexb.o(.sbss+0x1c):../ifunctions.h:30: first defined here obj/win32.o(.sbss+0x20): In function `smin': ... collect2: ld returned 1 exit status make: *** [hello_world_8.elf] Error 1 Build completed in 14.45 seconds --- Quote End --- for the complete error msg see this file errors.txt in the attachements I commented these lines from the ifonctions.h file: # if !defined(WIN32) && (__STDC_VERSION__ < 199901L) # define static # define inline # endif et # if !defined(WIN32) && (__STDC_VERSION__ < 199901L) # undef static # undef inline # endif you can find the ifunctions.h file in the attachements and i'm having always the same problems Could you pleeeeeeease help me? PS: I'm using the Nios2-ide Linux version on OpenSuse OS. THX :) :confused:9 Replies
- Altera_Forum
Honored Contributor
As you've probably guessed, those erros look like the "static" attribute is being ignored.
Commenting out those lines looks like a good ideia to me. In fact, I'd say that having them in first place looks pretty dumb to me. Since I don't have any better suggestions, so a couple of possibly dumb comments/questions. That code looks to have been written targeting a Win32 C99 compiler. Dumb question 1: Did you clean up all the .o files and tried to recompile everything? Dumb question 2: Maybe there's some obscure incompatibility with the GCC version you're using? - Altera_Forum
Honored Contributor
thanks rbugalho,
first, thx for your prompt response. I want to clarify something: yes the code is targeted to a Win32 compiler. but i'v compiled this code with gcc in linux (the only suspect thing is that the executable generated after the compilation was a .exe file ... is that normal??). the problem is only in cross compilation with Nios2-ide. any other suggestions? - Altera_Forum
Honored Contributor
Under gcc/linux, the executable can have any extension, so it's not a problem per se.
It's problably a side effect of the build script. However, maybe it's worth taking a look a it. I understood that you're using gcc in Linux. What I meant is that, by the looks of it, whoever wrote the code was targeting just WIN32 and that may be the origin of your obscure problems. From the __STDC_VERSION__ < 199901L condition, it also looks like the author was targeting C99. Yet another dumb suggestion: try using the "c99" command to compile, instead of "gcc" -- it's an alias to gcc which makes it behave as a strict C99 compiler. - Altera_Forum
Honored Contributor
I suppose that c99 is not usable as an alias to the NIOS cross compiler, but maybe there is a compiler option usable to make the NIOS C compiler run in C99 mode.
-Michael - Altera_Forum
Honored Contributor
Hi,
I changed the Nios-ide std parameter to have CFLAGS=-std=gnu99 in the make file. it was a good solution because the number of errors has decreased significally but i still have some errors: --- Quote Start --- Linking hello_world_8.elf... obj/configfile.o(.text+0x10): In function `JMHelpExit': ../configfile.c:93: undefined reference to `stderr' obj/configfile.o(.text+0x10):../configfile.c:93: Unable to reach stderr (at 0x00000000) from the global pointer (at 0x0017e198) because the offset (-1565080) is out of the allowed range, -32678 to 32767. collect2: ld returned 1 exit status make: *** [hello_world_8.elf] Error 1 Build completed in 4.475 seconds --- Quote End --- it looks like that the compiler does'nt know stderr depite that the <stdio.h> was included. I don't have a clue !!! but i wanted to join the makefile of linux were the code executed correctly and the current makefile of the nios2-ide . please help me to identify the possible source of error that could be in this makefile. thank you :) - Altera_Forum
Honored Contributor
Hello,
the NIOS Makefile refers to a $(SOPC_KIT_NIOS2)/components/altera_hal/build/app.mk It looks like you're compiling your application targeting NIOS' HAL and not uCLinux. IIRC, NIOS's HAL does not have a stderr. - Altera_Forum
Honored Contributor
Hi,
I successfully compiled the standard H264 encoder and I run it on the kit cycloneIII 3C25 platform but I had these error messages when typing this command: /bin> ./lencod -d encoder.cfg --- Quote Start --- Setting Default Parameters... Parsing Configfile encoder.cfg.............................................................................................................................................................................................................................................................................................................................................................................................. Warning: Hierarchical coding or Referenced B slices used. Make sure that you have allocated lencod invoked oom-killer: gfp_mask=0xd0, order=3, oomkilladj=0 Stack from 00aede50:enough r<0> <0> 0000000000000d0eferen<0> 00082e3cces <0> 00224ae0 <0> 0020a880 in r<0> 00000010efer<0> 00000003ence<0> 000000d0 buf<0> fer to a<0> 002227e8chiev<0> 00aede90e be<0> 004e20c0st p<0> 002227e8erfo<0> 002227e8r<0> 000000003b0ce. Ada<0> 001f3018ptiveRou<0> ndin<0> 000000e3g is dis<0> 000001f4abled wh<0> 0029068cen RDO Q<0> 00000000uantizat<0> 0022ce3cion is u<0> 00000000<0> 00000003sed <0> 00000003<0> <0> 000000d0<0> ffffe000<0> 00083668<0> 00000000<0> 00000003<0> 00000000<0> 000000d0<0> 00000000<0> <0> 004e20c0<0> 000864b8<0> 00000001<0> 00000048<0> 00000000<0> 00000000<0> 00000001<0> 00000000<0> <0> 000200d0<0> 0022ce40<0> 00000021<0> 00005000<0> 00000001<0> 01da5e5c<0> 01fa5ddc<0> 00000000<0> Call Trace:<0> <0> [<00000003>]<0> [<00000000>]<0> [<00092a4c>]<0> [<00000000>]<0> <0> [<00000004>]<0> [<00040f40>]<0> [<00005000>]<0> [<00000003>]<0> <0> [<00000000>]<0> [<00000021>]<0> [<00000003>]<0> [<00005000>]<0> <0> [<00000000>]<0> [<00000000>]<0> [<00000001>]<0> [<00003e2c>]<0> <0> [<00000021>]<0> [<00000000>]<0> [<00000000>]<0> [<00005000>]<0> <0> [<00000003>]<0> [<00000021>]<0> [<00000000>]<0> [<00000000>]<0> <0> [<00004204>]<0> [<0000000f>]<0> [<00005000>]<0> [<00000000>]<0> <0> [<00000000>]<0> [<0000078c>]<0> [<00000df8>]<0> [<00000000>]<0> <0> [<00000000>]<0> [<0000005a>]<0> [<00005000>]<0> [<00000003>]<0> <0> [<00000021>]<0> [<00000000>]<0> [<00000001>]<0> [<00000001>]<0> <0> [<00000000>]<0> Mem-Info: DMA per-cpu: CPU 0: hi: 0, btch: 1 usd: 0 Active_anon:0 active_file:45 inactive_anon:0 inactive_file:112 unevictable:1597 dirty:0 writeback:0 unstable:0 free:1758 slab:320 mapped:0 pagetables:0 bounce:0 DMA free:7032kB min:720kB low:900kB high:1080kB active_anon:0kB inactive_anon:0kB active_file:180kB inactive_file:448kB unevictable:6388kB present:32512kB pages_scanned:0 all_unreclaimable? no lowmem_reserve[]: 0 0 0 DMA: 558*4kB 574*8kB 1*16kB 0*32kB 1*64kB 1*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB0*8192kB 0*16384kB 0*32768kB = 7032kB 1754 total pagecache pages 8192 pages RAM 638 pages reserved 1730 pages shared 4048 pages non-shared Out of memory: kill process 27 (lencod) score 227 or a child Killed process 27 (lencod) --- Quote End --- Could you please help me? :confused: - Altera_Forum
Honored Contributor
It apears your encoder is consuming too much RAM and the Linux kernel decided to kill it.
Maybe you don't have enough system memory or maybe there's a bug/leak in the encoder. No clue about either. - Altera_Forum
Honored Contributor
I am not sure if this helps. I had a similar problem when using xpdf. The reason was that too much memory was allocated statically in a function. This memory is put on the heap where we have only about 4k default. eg "function(){buf[0x100000]}" will use 1M heap space. To avoid this make the memory static "function(){static buf[0x100000]}" or use malloc. In my case though uClinux crashed completely and I used nommu.