Forum Discussion
Altera_Forum
Honored Contributor
20 years agoProblem with libpng
Hi,
I compiled the kernel with building libpng (Kernel/library/defaul tselection->Customize Vendor /User Settings->Library Configuration->Build libpng).I have selected Building libZ which was needed by libpng. But it failed.the error as follow: ....... make[2]: Entering directory `/home/leewood/uClinux-dist-test/include' find . -depth -type l -a ! -name Makefile | xargs rm > /dev/null 2>&1 || exit 0 find . -depth -type d | xargs rmdir > /dev/null 2>&1 || exit 0 Making symlinks in include/ Making include/c++ symlink to compiler c++ includes make[2]: Leaving directory `/home/leewood/uClinux-dist-test/include' make[2]: Entering directory `/home/leewood/uClinux-dist-test/lib' Making symlinks in lib/ make[2]: Leaving directory `/home/leewood/uClinux-dist-test/lib' make[2]: Entering directory `/home/leewood/uClinux-dist-test/include' find . -depth -type l -a ! -name Makefile | xargs rm > /dev/null 2>&1 || exit 0 find . -depth -type d | xargs rmdir > /dev/null 2>&1 || exit 0 Making symlinks in include/ Making include/c++ symlink to compiler c++ includes make[2]: Leaving directory `/home/leewood/uClinux-dist-test/include' make[2]: Entering directory `/home/leewood/uClinux-dist-test/lib' Making symlinks in lib/ make[2]: Leaving directory `/home/leewood/uClinux-dist-test/lib' make[2]: Entering directory `/home/leewood/uClinux-dist-test/lib/zlib' make[2]: Nothing to be done for `all'. make[2]: Leaving directory `/home/leewood/uClinux-dist-test/lib/zlib' make[2]: Entering directory `/home/leewood/uClinux-dist-test/lib' Making symlinks in lib/ make[2]: Leaving directory `/home/leewood/uClinux-dist-test/lib' make[2]: Entering directory `/home/leewood/uClinux-dist-test/lib/libpng' nios2-linux-uclibc-gcc -shared -Wl,-soname,libpng.so.2 -o libpng.so.2.1.0.12 png.pic.o pngset.pic.o pngget.pic.o pngrutil.pic.o pngtrans.pic.o pngwutil.pic.o pngread.pic.o pngrio.pic.o pngwio.pic.o pngwrite.pic.o pngrtran.pic.o pngwtran.pic.o pngmem.pic.o pngerror.pic.o pngpread.pic.o -L../zlib -lz -lm -lc nios2-linux-uclibc-gcc: unrecognized option `-shared' /opt/nios2/lib/gcc/nios2-linux-uclibc/3.4.6/../../../../nios2-linux-uclibc/lib/crt1.o(.text+0x10): In function `_start': : undefined reference to `main' /opt/nios2/lib/gcc/nios2-linux-uclibc/3.4.6/../../../../nios2-linux-uclibc/lib/crt1.o(.text+0x14): In function `_start': : undefined reference to `main' collect2: ld returned 1 exit status make[2]: *** [libpng.so.2.1.0.12] 错误 1 make[2]: Leaving directory `/home/leewood/uClinux-dist-test/lib/libpng' make[1]: *** [all] 错误 2 make[1]: Leaving directory `/home/leewood/uClinux-dist-test/lib' make: *** [subdirs] 错误 1 [leewood@localhost uClinux-dist-test]$ Pls help.Thanks!6 Replies
- Altera_Forum
Honored Contributor
--- Quote Start --- originally posted by leewood@Jul 31 2006, 02:27 AM hi,i compiled the kernel with building libpng (kernel/library/defaul tselection->customize vendor /user settings->library configuration->build libpng).i have selected building libz which was needed by libpng.
but it failed.the error as follow:
.......
make[2]: entering directory `/home/leewood/uclinux-dist-test/include'
find . -depth -type l -a ! -name makefile | xargs rm > /dev/null 2>&1 || exit 0
find . -depth -type d | xargs rmdir > /dev/null 2>&1 || exit 0
making symlinks in include/
making include/c++ symlink to compiler c++ includes
make[2]: leaving directory `/home/leewood/uclinux-dist-test/include'
make[2]: entering directory `/home/leewood/uclinux-dist-test/lib'
making symlinks in lib/
make[2]: leaving directory `/home/leewood/uclinux-dist-test/lib'
make[2]: entering directory `/home/leewood/uclinux-dist-test/include'
find . -depth -type l -a ! -name makefile | xargs rm > /dev/null 2>&1 || exit 0
find . -depth -type d | xargs rmdir > /dev/null 2>&1 || exit 0
making symlinks in include/
making include/c++ symlink to compiler c++ includes
make[2]: leaving directory `/home/leewood/uclinux-dist-test/include'
make[2]: entering directory `/home/leewood/uclinux-dist-test/lib'
making symlinks in lib/
make[2]: leaving directory `/home/leewood/uclinux-dist-test/lib'
make[2]: entering directory `/home/leewood/uclinux-dist-test/lib/zlib'
make[2]: nothing to be done for `all'.
make[2]: leaving directory `/home/leewood/uclinux-dist-test/lib/zlib'
make[2]: entering directory `/home/leewood/uclinux-dist-test/lib'
making symlinks in lib/
make[2]: leaving directory `/home/leewood/uclinux-dist-test/lib'
make[2]: entering directory `/home/leewood/uclinux-dist-test/lib/libpng'
nios2-linux-uclibc-gcc -shared -wl,-soname,libpng.so.2 -o libpng.so.2.1.0.12
png.pic.o pngset.pic.o pngget.pic.o pngrutil.pic.o pngtrans.pic.o pngwutil.pic.o pngread.pic.o pngrio.pic.o pngwio.pic.o pngwrite.pic.o pngrtran.pic.o pngwtran.pic.o pngmem.pic.o pngerror.pic.o pngpread.pic.o -l../zlib -lz -lm -lc
nios2-linux-uclibc-gcc: unrecognized option `-shared'
/opt/nios2/lib/gcc/nios2-linux-uclibc/3.4.6/../../../../nios2-linux-uclibc/lib/crt1.o(.text+0x10): in function `_start':
: undefined reference to `main'
/opt/nios2/lib/gcc/nios2-linux-uclibc/3.4.6/../../../../nios2-linux-uclibc/lib/crt1.o(.text+0x14): in function `_start':
: undefined reference to `main'
collect2: ld returned 1 exit status
make[2]: *** [libpng.so.2.1.0.12] 错误 1
make[2]: leaving directory `/home/leewood/uclinux-dist-test/lib/libpng'
make[1]: *** [all] 错误 2
make[1]: leaving directory `/home/leewood/uclinux-dist-test/lib'
make: *** [subdirs] 错误 1
[leewood@localhost uclinux-dist-test]$
pls help.thanks!
<div align='right'><{post_snapback}> (index.php?act=findpost&pid=17277)
--- quote end ---
--- Quote End --- hi leewood, You might have solved problem by your self, but if not, then here is the reason......
nios2-linux-uclibc-gcc does not compile shared libraries, you need to compile libpng lib as static. nios2-linux-uclibc-gcc will not take "-g", "-shared" options. What you need to do is ..... in configure script either give "static" option or either remove "-shared" from your all Makefiles. Do remember to make distclean your code : ). thanks, Ankurnios2-linux-uclibc-gcc: unrecognized option `-shared' - Altera_Forum
Honored Contributor
Hi, Ankur
I have done what you told me......"in configure script either give "static" option or either remove "-shared" from your all Makefiles." But the result is ....... make[2]: Entering directory `/home/leewood/uClinux-dist-test/lib/libpng' nios2-linux-uclibc-gcc -static -Wl,-soname,libpng.so.2 -o libpng.so.2.1.0.12 png.pic.o pngset.pic.o pngget.pic.o pngrutil.pic.o pngtrans.pic.o pngwutil.pic. o pngread.pic.o pngrio.pic.o pngwio.pic.o pngwrite.pic.o pngrtran.pic.o pngwtran .pic.o pngmem.pic.o pngerror.pic.o pngpread.pic.o -L../zlib -lz -lm -lc /opt/nios2/lib/gcc/nios2-linux-uclibc/3.4.6/../../../../nios2-linux-uclibc/lib/c rt1.o(.text+0x10): In function `_start': : undefined reference to `main' /opt/nios2/lib/gcc/nios2-linux-uclibc/3.4.6/../../../../nios2-linux-uclibc/lib/c rt1.o(.text+0x14): In function `_start': : undefined reference to `main' collect2: ld returned 1 exit status make[2]: *** [libpng.so.2.1.0.12] 错误 1 make[2]: Leaving directory `/home/leewood/uClinux-dist-test/lib/libpng' make[1]: *** [all] 错误 2 make[1]: Leaving directory `/home/leewood/uClinux-dist-test/lib' make: *** [subdirs] 错误 1 [leewood@localhost uClinux-dist-test]$ In fact,I want to add the application "vidcat" (Miscellaneous Application->Video tools->vidcat) into my kernel. It needs libz,libpng and libjpeg builded before. The libz and libjpeg have been builded, but libpng always failed. Pls help.Thanks! - Altera_Forum
Honored Contributor
--- Quote Start --- originally posted by leewood@Jul 31 2006, 05:16 PM in fact,i want to add the application "vidcat" (miscellaneous application->video tools->vidcat) into my kernel. it needs libz,libpng and libjpeg builded before. the libz and libjpeg have been builded, but libpng always failed.pls help.thanks!
<div align='right'><{post_snapback}> (index.php?act=findpost&pid=17296)
--- quote end ---
--- Quote End --- Take a look at your two successful library builds and find out what command was used to create the static library. (something like libpng.a) Also, it's pretty likely that the libpng makefile already knows how to build the archive library (.a extension) as that is a typical build target on systems that are capable of building and using shared libraries. Cheers, - slacker
- Altera_Forum
Honored Contributor
Hi,slacker
I do not understand...."it's pretty likely that the libpng makefile already knows how to build the archive library (.a extension) as that is a typical build target on systems that are capable of building and using shared libraries." So I paste the Makefile as follow: # makefile for libpng on Linux ELF with gcc# Copyright © 1998, 1999 Greg Roelofs# Copyright © 1996, 1997 Andreas Dilger# For conditions of distribution and use, see copyright notice in png.h # CC=gcc # where "make install" puts libpng.a, libpng.so*, png.h and pngconf.h prefix=/usr/local # Where the zlib library and include files are located# ZLIBLIB=/usr/local/lib# ZLIBINC=/usr/local/include ZLIBLIB=../zlib ZLIBINC=../zlib ALIGN=# for i386:# ALIGN=-malign-loops=2 -malign-functions=2 WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow -Wmissing-declarations -Wtraditional -Wcast-align -Wstrict-prototypes -Wmissing-prototypes# -Wconversion # for pgcc version 2.95.1, -O3 is buggy; don't use it. CFLAGS += -I$(ZLIBINC) -Wall -O3 -funroll-loops $(ALIGN)# $(WARNMORE) -g -DPNG_DEBUG=5# LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng -lz -lm # RANLIB=ranlib# RANLIB=echo # read libpng.txt or png.h to see why PNGMAJ is 2. You should not# have to change it. PNGMAJ = 2 PNGMIN = 1.0.12 PNGVER = $(PNGMAJ).$(PNGMIN) INCPATH=$(prefix)/include LIBPATH=$(prefix)/lib OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o pngwtran.o pngmem.o pngerror.o pngpread.o OBJSDLL = $(OBJS:.o=.pic.o) .SUFFIXES: .c .o .pic.o .c.pic.o: $(CC) -c $(CFLAGS) -fPIC -o $@ $*.c # all: libpng.a libpng.so pngtest all: libpng.a libpng.so libpng.a: $(OBJS) ar rc $@ $(OBJS) $(RANLIB) $@ libpng.so: libpng.so.$(PNGMAJ) ln -sf libpng.so.$(PNGMAJ) libpng.so libpng.so.$(PNGMAJ): libpng.so.$(PNGVER) ln -sf libpng.so.$(PNGVER) libpng.so.$(PNGMAJ) libpng.so.$(PNGVER): $(OBJSDLL) $(CC) -Wl,-soname,libpng.so.$(PNGMAJ) -o libpng.so.$(PNGVER) $(OBJSDLL) -L$(ZLIBLIB) -lz -lm -lc pngtest: pngtest.o libpng.so $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS) test: pngtest ./pngtest install: libpng.a libpng.so.$(PNGVER) -@if [ ! -d $(INCPATH) ]; then mkdir $(INCPATH); fi -@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi cp png.h pngconf.h $(INCPATH) chmod 644 $(INCPATH)/png.h $(INCPATH)/pngconf.h cp libpng.a libpng.so.$(PNGVER) $(LIBPATH) chmod 755 $(LIBPATH)/libpng.so.$(PNGVER) -@/bin/rm -f $(LIBPATH)/libpng.so.$(PNGMAJ) $(LIBPATH)/libpng.so (cd $(LIBPATH); ln -sf libpng.so.$(PNGVER) libpng.so.$(PNGMAJ); ln -sf libpng.so.$(PNGMAJ) libpng.so) romfs: if [ "$(CONFIG_X86)" = "y" ]; then [ -d $(ROMFSDIR)/lib ] || mkdir -p $(ROMFSDIR)/lib ; $(ROMFSINST) libpng.so.2 /lib/libpng.so.2 ; fi clean: -/bin/rm -f *.o libpng.so* pngtest pngout.png DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO writelock: chmod a-w *.[ch35] $(DOCS) scripts/* # DO NOT DELETE THIS LINE -- make depend depends on it. png.o png.pic.o: png.h pngconf.h pngerror.o pngerror.pic.o: png.h pngconf.h pngrio.o pngrio.pic.o: png.h pngconf.h pngwio.o pngwio.pic.o: png.h pngconf.h pngmem.o pngmem.pic.o: png.h pngconf.h pngset.o pngset.pic.o: png.h pngconf.h pngget.o pngget.pic.o: png.h pngconf.h pngread.o pngread.pic.o: png.h pngconf.h pngrtran.o pngrtran.pic.o: png.h pngconf.h pngrutil.o pngrutil.pic.o: png.h pngconf.h pngtrans.o pngtrans.pic.o: png.h pngconf.h pngwrite.o pngwrite.pic.o: png.h pngconf.h pngwtran.o pngwtran.pic.o: png.h pngconf.h pngwutil.o pngwutil.pic.o: png.h pngconf.h pngpread.o pngpread.pic.o: png.h pngconf.h pngtest.o: png.h pngconf.h What is wrong in it??Pls hlep. Thanks --leewood - Altera_Forum
Honored Contributor
--- Quote Start --- originally posted by leewood@Jul 31 2006, 07:21 PM what is wrong in it??pls hlep.thanks
--leewood
<div align='right'><{post_snapback}> (index.php?act=findpost&pid=17299)
--- quote end ---
--- Quote End --- Your all target reads
try changing it to readall: libpng.a libpng.so
. If the compiler doesn't understand how to build "shared objects", then it doesn't make any sense to include the shared object (.so) target. Cheers, - slackerall: libpng.a - Altera_Forum
Honored Contributor
Thanks slacker.The problem has been solved. Thank you!