Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
20 years ago

Problem with application w3cam

Hi,

I compiled the kernel with application w3cam (Kernel/library/defaul tselection->Customize Vendor /User Settings->Miscellaneous Applications->Video tool->vidcat).I have selected Building libZ,libpng and libjpeg which was needed by w3cam,and they hve been builded successful.

The error as follow:

.........................

make[2]: Entering directory `/home/leewood/uClinux-dist-test/user/w3cam'

nios2-linux-uclibc-gcc -Os -g -Dlinux -D__linux__ -Dunix -D__uClinux__ -DEMBED -I/home/leewood/uClinux-dist-test -fno-builtin -DHAVE_LIBM=1 -DHAVE_LIBZ=1 -DHAVE_LIBPNG=1 -DHAVE_LIBJPEG=1 -DVIDEO_DEV=\"/dev/video\" -DVERSION=\"0.7.2\" -c -o w3cam.o w3cam.c

w3cam.c:41:18: zlib.h: No such file or directory

w3cam.c:44:17: png.h: No such file or directory

w3cam.c:47:21: jpeglib.h: No such file or directory

w3cam.c: In function `put_image_jpeg':

w3cam.c:297: error: `JSAMPROW' undeclared (first use in this function)

w3cam.c:297: error: (Each undeclared identifier is reported only once

w3cam.c:297: error: for each function it appears in.)

w3cam.c:297: error: syntax error before "row_ptr"

w3cam.c:298: error: storage size of 'cjpeg' isn't known

w3cam.c:299: error: storage size of 'jerr' isn't known

w3cam.c:316: error: `JCS_RGB' undeclared (first use in this function)

w3cam.c:319: error: `JCS_GRAYSCALE' undeclared (first use in this function)

w3cam.c:325: error: `JDCT_FASTEST' undeclared (first use in this function)

w3cam.c:331: error: `row_ptr' undeclared (first use in this function)

w3cam.c: In function `put_image_png':

w3cam.c:363: error: `png_infop' undeclared (first use in this function)

w3cam.c:363: error: syntax error before "info_ptr"

w3cam.c:364: error: `png_structp' undeclared (first use in this function)

w3cam.c:366: error: `png_ptr' undeclared (first use in this function)

w3cam.c:368: error: `info_ptr' undeclared (first use in this function)

w3cam.c:375: error: `PNG_COLOR_TYPE_RGB' undeclared (first use in this function)

w3cam.c:375: error: `PNG_INTERLACE_NONE' undeclared (first use in this function)

w3cam.c:376: error: `PNG_COMPRESSION_TYPE_DEFAULT' undeclared (first use in this function)

w3cam.c:376: error: `PNG_FILTER_TYPE_DEFAULT' undeclared (first use in this function)

w3cam.c:380: error: `PNG_COLOR_TYPE_GRAY' undeclared (first use in this function)

make[2]: *** [w3cam.o] 错误 1

make[2]: Leaving directory `/home/leewood/uClinux-dist-test/user/w3cam'

make[1]: *** [all] 错误 2

make[1]: Leaving directory `/home/leewood/uClinux-dist-test/user'

make: *** [subdirs] 错误 1

[leewood@localhost uClinux-dist-test]$

I think error message

".........

w3cam.c:41:18: zlib.h: No such file or directory

w3cam.c:44:17: png.h: No such file or directory

w3cam.c:47:21: jpeglib.h: No such file or directory"

is because that * .h files location is incorrectly setted in configure.in.I am confused with compiling and linking on linux.So I do not know what to do .

Pls help,Thanks!

8 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    originally posted by leewood@Aug 1 2006, 04:52 AM

    hi,

    i compiled the kernel with application w3cam (kernel/library/defaul tselection->customize vendor /user settings->miscellaneous applications->video tool->vidcat).i have selected building libz,libpng and libjpeg which was needed by w3cam,and they hve been builded successful.

    the error as follow:

    .........................

    make[2]: entering directory `/home/leewood/uclinux-dist-test/user/w3cam'

    nios2-linux-uclibc-gcc -os -g -dlinux -d__linux__ -dunix -d__uclinux__ -dembed -i/home/leewood/uclinux-dist-test -fno-builtin -dhave_libm=1 -dhave_libz=1 -dhave_libpng=1 -dhave_libjpeg=1 -dvideo_dev=\"/dev/video\" -dversion=\"0.7.2\" -c -o w3cam.o w3cam.c

    w3cam.c:41:18: zlib.h: no such file or directory

    w3cam.c:44:17: png.h: no such file or directory

    w3cam.c:47:21: jpeglib.h: no such file or directory

    w3cam.c: in function `put_image_jpeg':

    w3cam.c:297: error: `jsamprow' undeclared (first use in this function)

    w3cam.c:297: error: (each undeclared identifier is reported only once

    w3cam.c:297: error: for each function it appears in.)

    w3cam.c:297: error: syntax error before "row_ptr"

    w3cam.c:298: error: storage size of 'cjpeg' isn't known

    w3cam.c:299: error: storage size of 'jerr' isn't known

    w3cam.c:316: error: `jcs_rgb' undeclared (first use in this function)

    w3cam.c:319: error: `jcs_grayscale' undeclared (first use in this function)

    w3cam.c:325: error: `jdct_fastest' undeclared (first use in this function)

    w3cam.c:331: error: `row_ptr' undeclared (first use in this function)

    w3cam.c: in function `put_image_png':

    w3cam.c:363: error: `png_infop' undeclared (first use in this function)

    w3cam.c:363: error: syntax error before "info_ptr"

    w3cam.c:364: error: `png_structp' undeclared (first use in this function)

    w3cam.c:366: error: `png_ptr' undeclared (first use in this function)

    w3cam.c:368: error: `info_ptr' undeclared (first use in this function)

    w3cam.c:375: error: `png_color_type_rgb' undeclared (first use in this function)

    w3cam.c:375: error: `png_interlace_none' undeclared (first use in this function)

    w3cam.c:376: error: `png_compression_type_default' undeclared (first use in this function)

    w3cam.c:376: error: `png_filter_type_default' undeclared (first use in this function)

    w3cam.c:380: error: `png_color_type_gray' undeclared (first use in this function)

    make[2]: *** [w3cam.o] 错误 1

    make[2]: leaving directory `/home/leewood/uclinux-dist-test/user/w3cam'

    make[1]: *** [all] 错误 2

    make[1]: leaving directory `/home/leewood/uclinux-dist-test/user'

    make: *** [subdirs] 错误 1

    [leewood@localhost uclinux-dist-test]$

    i think error message

    ".........

    w3cam.c:41:18: zlib.h: no such file or directory

    w3cam.c:44:17: png.h: no such file or directory

    w3cam.c:47:21: jpeglib.h: no such file or directory"

    is because that * .h files location is incorrectly setted in configure.in.i am confused with compiling and linking on linux.so i do not know what to do .

    pls help,thanks!

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

    --- quote end ---

    --- Quote End ---

    Hi leewood,

    Include dir path in not set while compiling w3cam.c,

    You have add INCLUDE path of dir where all *.h files are present, you can do it by adding your path in local dir Makefile, where w3cam.c is present.

    <div class='quotetop'>QUOTE </div>

    --- Quote Start ---

    nios2-linux-uclibc-gcc -Os -g -Dlinux -D__linux__ -Dunix -D__uClinux__ -DEMBED -I/home/leewood/uClinux-dist-test -fno-builtin -DHAVE_LIBM=1 -DHAVE_LIBZ=1 -DHAVE_LIBPNG=1 -DHAVE_LIBJPEG=1 -DVIDEO_DEV=\"/dev/video\" -DVERSION=\"0.7.2\" -c -o w3cam.o w3cam.c[/b]

    --- Quote End ---

    Also check, "-I" is the option in your gcc include flag, current path is only

    -I/home/leewood/uClinux-dist-test

    Just run a search in you source code and find where all required *.h files are present. Then add respective path in you Makefile or add flag options for individual *.c file where ever required.

    thanks,

    Ankur
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi, Ankur

    I copy all *.h file needed (libpng,libz,libjpeg) in the dir /home/leewood/uClinux-dist-test/uClibc/include. And then I modify flags:

    " LDFLAGS="$LDFLAGS -L/usr/local/lib -L/usr/local/X11/lib"

    CFLAGS="$CFLAGS -I/usr/local/include ""

    into

    "LDFLAGS="$LDFLAGS -L/home/leewood/uClinux-dist-test/ib -L/usr/local/X11/lib"

    CFLAGS="$CFLAGS -I/home/leewood/uClinux-dist-test/uClibc/include "

    in configure.in file .

    The configure.in file as follow:

    AC_INIT()

    AC_ISC_POSIX

    Makefile is generated automatically from Makefile.in by configure.

    The Makefile.in like this:

    CC = @CC@

    prefix=@prefix@

    exec_prefix=@exec_prefix@

    sbindir=@sbindir@

    cgibindir=$(prefix)/cgi-bin

    bindir=@bindir@

    VERSION=0.7.2

    CFLAGS = @CFLAGS@ @DEFS@ -DVIDEO_DEV=\"@ac_device@\" -DVERSION=\"$(VERSION)\"

    LDFLAGS = @LDFLAGS@

    LIBS = @LIBS@

    OBJ = w3cam.o cgi.o v4l.o

    default: w3cam.cgi vidcat vidcat.1 README ppmtoascii w3camd/w3camd

    w3cam.cgi: $(OBJ)

    $(CC) $(LDFLAGS) -o $@ $(OBJ) $(LIBS)

    vidcat: vidcat.o v4l.o

    $(CC) $(LDFLAGS) -o $@ vidcat.o v4l.o $(LIBS)

    ppmtoascii: ppmtoascii.o

    $(CC) $(LDFLAGS) -o $@ ppmtoascii.o

    w3camd/w3camd:

    cd w3camd && make

    install: w3cam.cgi

    install w3cam.cgi $(cgibindir)/

    test -f $(cgibindir)/w3cam.cgi.scf ||

    install w3cam.cgi.scf $(cgibindir)/

    install vidcat $(bindir)/

    install vidcat.1 $(prefix)/man/man1/

    vidcat.1: vidcat.man

    sed "s/VERSION/$(VERSION)/" < vidcat.man > vidcat.1

    clean:

    rm -f *.o w3cam.cgi vidcat ppmtoascii

    cd w3camd && make clean && rm -f w3camd

    msproper: clean

    rm -f config.status config.log config.cache Makefile

    index.html: index.in

    sed "s/@VERSION@/$(VERSION)/" < $< > $@

    README: index.html

    lynx -dump http://www/~rasca/w3cam/index.html (http://www/~rasca/w3cam/index.html) |

    sed "s%/www/%/home.pages.de/%g" > README

    tarball: msproper

    cd .. && tar -czvf w3cam-$(VERSION).tar.gz w3cam-$(VERSION)/

    The error is the same as before. I think I have done incorrectly to add INCLUDE path of dir where all *.h files are present . How to do it???

    And I do not understand the flag "-l" ("-I" is the option in your gcc include flag, current path is only

    -I/home/leewood/uClinux-dist-test ),What dose it mean?

    Pls give me some advice.Thanks

    --leewood
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi leewood,

    I got little bit confused by looking at your prints. So first I will answer your query.

    <div class='quotetop'>QUOTE </div>

    --- Quote Start ---

    And I do not understand the flag "-l" ("-I" is the option in your gcc include flag, current path is only

    -I/home/leewood/uClinux-dist-test ),What dose it mean[/b]

    --- Quote End ---

    -I is for Include, its NOT "-l" or "-L" (I for Ireland or India).

    I took this print out of your previous mail (first post). In your first mail just check below following string.

    make: Entering directory `/home/leewood/uClinux-dist-test/user/w3cam&#39;

    ----------------------------------------------------------------------------------------------

    Makefile part which you have pasted

    OBJ = w3cam.o cgi.o v4l.o
    default: w3cam.cgi vidcat vidcat.1 README ppmtoascii w3camd/w3camd
    w3cam.cgi: $(OBJ)
    $(CC) $(LDFLAGS) -o $@ $(OBJ) $(LIBS) $(LDLIBS$(LDLIBS_$@))

    What I can observe here is your CFLAGS are not used while generating w3cam.o

    Dependency is like this

    w3cam.cgi -> w3cam.o -> w3cam.c -> *.h

    So add CFLAGS in you make file string like below

    w3cam.cgi: $(OBJ)

    $(CC) $ (CFLAGS) $(LDFLAGS) -o $@ $(OBJ) $(LIBS) $(LDLIBS$(LDLIBS_$@))

    or change the order

    w3cam.cgi: $(OBJ)

    $(CC) $(LDFLAGS) $ (CFLAGS) -o $@ $(OBJ) $(LIBS) $(LDLIBS$(LDLIBS_$@))

    thanks,

    Ankur
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi,Ankur

    I have done what you told me :

    ""So add CFLAGS in you make file string like below

    w3cam.cgi: $(OBJ)

    $(CC) $ (CFLAGS) $(LDFLAGS) -o $@ $(OBJ) $(LIBS) $(LDLIBS$(LDLIBS_$@))

    or change the order

    w3cam.cgi: $(OBJ)

    $(CC) $(LDFLAGS) $ (CFLAGS) -o $@ $(OBJ) $(LIBS) $(LDLIBS$(LDLIBS_$@))""

    But the result is the same as last time.

    And I got little bit confused that the error message as follow:

    "make[2]: Entering directory `/home/leewood/uClinux-dist-test/user/w3cam&#39;

    nios2-linux-uclibc-gcc -Os -g -Dlinux -D__linux__ -Dunix -D__uClinux__ -DEMBED -I/home/leewood/uClinux-dist-test -fno-builtin -DHAVE_LIBM=1 -DHAVE_LIBZ=1 -DHAVE_LIBPNG=1 -DHAVE_LIBJPEG=1 -DVIDEO_DEV=\"/dev/video\" -DVERSION=\"0.7.2\" -c -o w3cam.o w3cam.c

    w3cam.c:41:18: zlib.h: No such file or directory

    w3cam.c:44:17: png.h: No such file or directory

    w3cam.c:47:21: jpeglib.h: No such file or directory

    w3cam.c: In function `put_image_jpeg&#39;:

    w3cam.c:297: error: `JSAMPROW&#39; undeclared (first use in this function)

    w3cam.c:297: error: (Each undeclared identifier is reported only once

    w3cam.c:297: error: for each function it appears in.)

    w3cam.c:297: error: syntax error before "row_ptr"

    w3cam.c:298: error: storage size of &#39;cjpeg&#39; isn&#39;t known

    w3cam.c:299: error: storage size of &#39;jerr&#39; isn&#39;t known

    w3cam.c:316: error: `JCS_RGB&#39; undeclared (first use in this function)

    w3cam.c:319: error: `JCS_GRAYSCALE&#39; undeclared (first use in this function)

    w3cam.c:325: error: `JDCT_FASTEST&#39; undeclared (first use in this function)

    w3cam.c:331: error: `row_ptr&#39; undeclared (first use in this function)

    w3cam.c: In function `put_image_png&#39;:

    w3cam.c:363: error: `png_infop&#39; undeclared (first use in this function)

    w3cam.c:363: error: syntax error before "info_ptr"

    w3cam.c:364: error: `png_structp&#39; undeclared (first use in this function)

    w3cam.c:366: error: `png_ptr&#39; undeclared (first use in this function)

    w3cam.c:368: error: `info_ptr&#39; undeclared (first use in this function)

    w3cam.c:375: error: `PNG_COLOR_TYPE_RGB&#39; undeclared (first use in this function)

    w3cam.c:375: error: `PNG_INTERLACE_NONE&#39; undeclared (first use in this function)

    w3cam.c:376: error: `PNG_COMPRESSION_TYPE_DEFAULT&#39; undeclared (first use in this function)

    w3cam.c:376: error: `PNG_FILTER_TYPE_DEFAULT&#39; undeclared (first use in this function)

    w3cam.c:380: error: `PNG_COLOR_TYPE_GRAY&#39; undeclared (first use in this function)

    make[2]: *** [w3cam.o] &#38169;&#35823; 1

    make[2]: Leaving directory `/home/leewood/uClinux-dist-test/user/w3cam&#39;

    make[1]: *** [all] &#38169;&#35823; 2

    make[1]: Leaving directory `/home/leewood/uClinux-dist-test/user&#39;

    make: *** [subdirs] &#38169;&#35823; 1

    [leewood@localhost uClinux-dist-test]$

    "

    Look at the red /large chars, no matter what I have done in configure.in file about "CFLAGS"(just like "CFLAGS="$CFLAGS -I/home/leewood/uClinux-dist-test/lib/libpng -I/home/leewood/uClinux-dist-test/lib/libjpeg -I/home/leewood/uClinux-dist-test/lib/zlib")

    it ialways detects Include as"home/leewood/uClinux-dist-test" . So I copy all *.h file in the home/leewood/uClinux-dist-test dir ,compile about *.h succeed. But I am confused why the include dir

    I setted did not work.

    Do I get a wrong understand for setting Include dir ?And how to set it accurately?

    Pls give me some advice.Thank.

    --leewood
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi leewood,

    There are couple of temporary fixes for this issue .... One you already have tested; copying *.h at path already taken path (Red line path in your prints).

    As LDFLAGS are take properly.

    Other fix is you can add your CFLAGS, in LDFLAGS for perticular Makefile (Not recommonded).

    Just check how *.h files are included in your source code,

    is it some inner dir of include path ( include <linux/libjpeg.h>)or simple include

    ( include <libjpeg.h>).

    Proper solution is look into ./configure --help as it will take configure.in as input + the parameters passed on command line while running configure. Then it will create Makefile. Look for how to add include path in help, like INCLUDE_DIR or CFLAGS as parameter you need to pass.

    My knowledge is limited beyond this point, you can take what ever solution looks ok to you, and if you find some useful details kindly share.

    thanks,

    Ankur
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi,Ankur

    As you said"

    Just check how *.h files are included in your source code,

    is it some inner dir of include path ( include <linux/libjpeg.h>)or simple include

    ( include <libjpeg.h>)."

    I changed in w3cam.c because it could not find png.h, jpeglib.h and zlib.h

    The changed as follows:# ifdef HAVE_LIBZ# include <lib/zlib/zlib.h> //instea of <zlib.h># endif# ifdef HAVE_LIBPNG# include <lib/libpng/png.h> //instead of <png.h># endif# ifdef HAVE_LIBJPEG# include <lib/libjpeg/jpeglib.h> //instead of <jpeglib.h># endif

    After these changes and compiling following error occurs:

    make[2]: Entering directory `/home/leewood/uClinux-dist-test/user/w3cam&#39;

    nios2-linux-uclibc-gcc -Os -g -Dlinux -D__linux__ -Dunix -D__uClinux__ -DEMBED -I/home/leewood/uClinux-dist-test -fno-builtin -DHAVE_LIBM=1 -DHAVE_LIBZ=1 -DHAVE_LIBPNG=1 -DHAVE_LIBJPEG=1 -DVIDEO_DEV=\"/dev/video\" -DVERSION=\"0.7.2\" -c -o w3cam.o w3cam.c

    nios2-linux-uclibc-gcc -Os -g -Dlinux -D__linux__ -Dunix -D__uClinux__ -DEMBED -I/home/leewood/uClinux-dist-test -fno-builtin -Wl,-d -Wl,-elf2flt -Os -g -Dlinux -D__linux__ -Dunix -D__uClinux__ -DEMBED -I/home/leewood/uClinux-dist-test -fno-builtin -DHAVE_LIBM=1 -DHAVE_LIBZ=1 -DHAVE_LIBPNG=1 -DHAVE_LIBJPEG=1 -DVIDEO_DEV=\"/dev/video\" -DVERSION=\"0.7.2\" -o w3cam.cgi w3cam.o cgi.o v4l.o -lpng -ljpeg -lz -lm -L/home/leewood/uClinux-dist-test/lib/libnet -L/home/leewood/uClinux-dist-test/lib/libdes -L/home/leewood/uClinux-dist-test/lib/libaes -L/home/leewood/uClinux-dist-test/lib/libpcap -L/home/leewood/uClinux-dist-test/lib/libssl -lcrypt -lutil -lc

    /opt/nios2/lib/gcc/nios2-linux-uclibc/3.4.6/../../../../nios2-linux-uclibc/bin/ld.real: cannot find -lpng

    collect2: ld returned 1 exit status

    make[2]: *** [w3cam.cgi] &#38169;&#35823; 1

    make[2]: Leaving directory `/home/leewood/uClinux-dist-test/user/w3cam&#39;

    make[1]: *** [all] &#38169;&#35823; 2

    make[1]: Leaving directory `/home/leewood/uClinux-dist-test/user&#39;

    make: *** [subdirs] &#38169;&#35823; 1

    [leewood@localhost uClinux-dist-test]$

    Based on the error message,I think the problem about *.h file have been solved.(Is it right?) But a new problem appears.

    Pls give me some advice or a hint.Thx.

    And because i am a newbie about linux,would you like to recommend some useful information about linux compiling and linking? Thank you.

    --leewood
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Thats good, yes problem is solved.

    Next error you are facing is for proper library path.

    Now your app code is getting compiled and it requires libpng.a path.

    Your libpng.a is static libarary which is now created.

    If you have done make install, then check in /usr/lib or /usr/local/lib dir for libpng.a

    /usr/local/lib is default path specified in configure.in, to change it you need to pass path while running configure, check ./configure --help.

    Once you get where libpng.a is installed (if other that default path), specify its path in LDFLAGS in your Makefile manually or though ./configure.

    Way to specify your lib path is -L /usr/local/lib/ ( L for leewood or london) in your Makefile LDFLAGS.

    " -L/home/leewood/uClinux-dist-test/lib/libnet " Check similar strings in your prints, you will get more hints.

    thanks,

    Ankur
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi,Ankur

    I compiled app w3cam successful. But I achieve it in a "stupid" way.

    You told me to ".. get where libpng.a is installed (if other that default path), specify its path in LDFLAGS in your Makefile manually or though ./configure.".But after specifying LDFLAGS, compiling still failed. That means the library dir did not setted correctly. So I tried another method..copy all *.a(library needed ) to the dir the makefile "specify". After done it, compiling succeed. Then i downloaded the zImage into my DE2 board. I can run the app "vidcat". Although another problem appears again,I think the problem about app w3cam has been solved.

    Well, next i will try to make clear how to specify the path in LDFLAGS. if I find some useful details ,i will share.

    Thanks to Ankur.

    --leewood