2008-06-05 03:33:05     compile XVID by Bfin-uclinux-gcc

Document created by Aaronwu Employee on Aug 6, 2013
Version 1Show Document
  • View in full screen mode

2008-06-05 03:33:05     compile XVID by Bfin-uclinux-gcc

Matthew Wang (CHINA)

Message: 56720   

 

I compile XVID with bfin-uclinux-gcc whose version is 4.1.2

 

++++++++++++++++++++++++++++

 

[root@localhost examples]# bfin-uclinux-gcc -v

Using built-in specs.

Target: bfin-uclinux

Configured with: /home/disk2/svn-root/toolchain/toolchain/gcc-4.1/configure --build=i686-pc-linux-gnu --host=i686-pc-linux-gnu --target=bfin-uclinux --prefix=/home/svn-toolchain/svn-root-uclinux --enable-threads=posix --with-sysroot=/home/svn-toolchain/svn-root-uclinux/bfin-uclinux/runtime --disable-libstdcxx-pch --disable-symvers --disable-libssp --enable-version-specific-runtime-libs --enable-__cxa_atexit

Thread model: posix

gcc version 4.1.2 (ADI svn)

[root@localhost examples]#

 

++++++++++++++++++++++++++++

 

here is my compile steps:

 

1)configure

 

./configure --host=bfin-uclinux CFLAGS="-Wall -O2 -fstrength-reduce -finline-functions -ffast-math -fomit-frame-pointer"

 

and I eliminated -freduce-all-givs which would be error in compling xvid.

 

2)make

 

++++++++++++++++++++++++++++

 

/home/seuic/h_SlaveH_CentOS5H2nd/ip_camera_bf536/toolchain/svn-root-uclinux/bin/../bfin-uclinux/runtime/usr/lib/crt1.o: In function `__start':

libc/sysdeps/linux/bfin/crt1.S:141: undefined reference to `_main'

libc/sysdeps/linux/bfin/crt1.S:142: undefined reference to `_main'

encoder.o: In function `_FrameCodeP':

../../src/encoder.c:(.text+0x1340): undefined reference to `_sqrtf'

image/image.o: In function `_sse_to_PSNR':

../../src/image/image.c:(.text+0x17b6): undefined reference to `_log10f'

image/image.o: In function `_image_psnr':

../../src/image/image.c:(.text+0x1868): undefined reference to `_log10f'

image/postprocessing.o: In function `_init_noise':

../../src/image/postprocessing.c:(.text+0x7338): undefined reference to `_log'

../../src/image/postprocessing.c:(.text+0x7354): undefined reference to `_sqrt'

collect2: ld returned 1 exit status

make: *** [libxvidcore.so] Error 1

[root@localhost generic]#

 

++++++++++++++++++++++++++++

 

my solution is: add the option -shared for $(CC) in xvid/build/generic/Makefile

 

3)make install

 

[root@localhost generic]# make install

  D: /usr/local/lib

  I: /usr/local/lib/libxvidcore.so

  I: /usr/local/lib/libxvidcore.a

  D: /usr/local/include

  I: /usr/local/include/xvid.h

 

this step has no problem.

 

4)compile example in Xvid source code

 

++++++++++++++++++++++++++++

 

[root@localhost examples]# make

bfin-uclinux-gcc -g -DARCH_IS_GENERIC -DARCH_IS_32BIT -DARCH_IS_LITTLE_ENDIAN   -I../src -c xvid_encraw.c

bfin-uclinux-gcc -o xvid_encraw xvid_encraw.o -lc -lm -lxvidcore

/home/seuic/h_SlaveH_CentOS5H2nd/ip_camera_bf536/toolchain/svn-root-uclinux/bin/../lib/gcc/bfin-uclinux/4.1.2/../../../../bfin-uclinux/bin/ld.real: cannot find -lxvidcore

collect2: ld returned 1 exit status

make: *** [xvid_encraw] Error 1

[root@localhost examples]#

 

++++++++++++++++++++++++++++

 

Obviously, bfin-uclinux-gcc CANNOT find xvidcore Shared Library xvidcore,

 

the relative Makefile is:

 

++++++++++++++++++++++++++++

 

include ../build/generic/platform.inc

 

HDIR    = -I../src

CFLAGS  = -g $(ARCHITECTURE) $(BUS) $(ENDIANNESS) $(FEATURES) $(SPECIFIC_CFLAGS)

LDFLAGS = -lc -lm -lxvidcore

 

SOURCES= xvid_encraw.c xvid_decraw.c xvid_bench.c

OBJECTS=$(SOURCES:.c=.o)

TESTS=$(SOURCES:.c=)

 

all: $(TESTS)

 

xvid_encraw: xvid_encraw.o

$(CC) -o $@ $< $(LDFLAGS)

 

xvid_encraw.o: xvid_encraw.c

$(CC) $(CFLAGS) $(HDIR) -c $<

 

++++++++++++++++++++++++++++

 

NOW, I cann't get further....any help will be appreciated!!!

 

I have some Questioins:

 

First one, -lxvidcore means Shared Library is xvidcore, but when I make install, the libxvidcore.a and libxvidcore.so copied to /usr/local/lib, I suspect the Name of xvidcore is wrong, if so , what's the name? I tried -llibxvidcore, but wrong too...

 

Second one, in Step 2 that I add the option -shared for $(CC), wether what I did is wrong or not?

 

Last one, it's not a question , only some info , I compile XVID by gcc, and follow the steps upon(configure, make, make install, make for xvid example),and there is no error, everything is pretty good!

TranslateQuoteReplyEditDelete

 

 

2008-06-05 04:43:48     Re: compile XVID by Bfin-uclinux-gcc

Yi Li (CHINA)

Message: 56725   

 

see: http://docs.blackfin.uclinux.org/doku.php?id=toolchain:creating_libraries

 

If you want to build shared library, you may use bfin-linux-uclibc toolchain, instead of bfin-uclinux.

QuoteReplyEditDelete

 

 

2008-06-05 07:41:37     Re: compile XVID by Bfin-uclinux-gcc

Matthew Wang (CHINA)

Message: 56730   

 

thank you very much

Attachments

    Outcomes