[GRASS-dev] NVIZ compile error with missing -lavformat

Compiling NVIZ from SVN trunk, I get following problem:

[neteler@localhost nviz]$ make
make -C src
make[1]: Entering directory `/home/neteler/svngrass/visualization/nviz/src'
gcc -L/home/neteler/svngrass/dist.x86_64-unknown-linux-gnu/lib
-Wl,--export-dynamic -L/usr/lib64
-Wl,-rpath-link,/home/neteler/svngrass/dist.x86_64-unknown-linux-gnu/lib
-L/usr/lib64 -o nvwish OBJ.x86_64-unknown-linux-gnu/nvizAppInit.o
OBJ.x86_64-unknown-linux-gnu/change_view.o
OBJ.x86_64-unknown-linux-gnu/draw.o OBJ.x86_64-unknown-linux-gnu/exag.o
OBJ.x86_64-unknown-linux-gnu/glwrappers.o
OBJ.x86_64-unknown-linux-gnu/init_commands.o
OBJ.x86_64-unknown-linux-gnu/lights.o OBJ.x86_64-unknown-linux-gnu/map_obj.o
OBJ.x86_64-unknown-linux-gnu/misc.o OBJ.x86_64-unknown-linux-gnu/nviz_init.o
OBJ.x86_64-unknown-linux-gnu/position.o
OBJ.x86_64-unknown-linux-gnu/quick_draw.o
OBJ.x86_64-unknown-linux-gnu/anim_support.o
OBJ.x86_64-unknown-linux-gnu/cutplane_obj.o
OBJ.x86_64-unknown-linux-gnu/script_support.o
OBJ.x86_64-unknown-linux-gnu/do_zoom.o OBJ.x86_64-unknown-linux-gnu/label.o
OBJ.x86_64-unknown-linux-gnu/nvizMain.o OBJ.x86_64-unknown-linux-gnu/togl.o
OBJ.x86_64-unknown-linux-gnu/togl_cb.o
OBJ.x86_64-unknown-linux-gnu/query_vect.o
OBJ.x86_64-unknown-linux-gnu/volume.o
OBJ.x86_64-unknown-linux-gnu/togl_flythrough.o
OBJ.x86_64-unknown-linux-gnu/pick_vect_commands.o
OBJ.x86_64-unknown-linux-gnu/site_attr_commands.o
OBJ.x86_64-unknown-linux-gnu/site_highlight_commands.o -lgrass_ogsf
-lgrass_bitmap -lgrass_linkm -lgrass_g3d -lgrass_gis -lgrass_datetime -lz
-lgrass_gis -lgrass_datetime -lz -lgrass_sites -lgrass_datetime
-lgrass_dbmibase -lgrass_gis -lgrass_datetime -lz -lgrass_dbmiclient
-lgrass_dbmibase -lgrass_gis -lgrass_datetime -lz -lgrass_gis
-lgrass_datetime -lz -lgrass_gis -lgrass_datetime -lz -lgrass_vect
-lgrass_dbmibase -lgrass_gis -lgrass_datetime -lz -lgrass_dbmiclient
-lgrass_dbmibase -lgrass_gis -lgrass_datetime -lz -lgrass_gis
-lgrass_datetime -lz -lgrass_dgl -lgrass_dig2 -lgrass_gis
-lgrass_datetime -lz -lgrass_rtree -lgrass_gis -lgrass_datetime -lz
-lgrass_linkm -lgrass_rtree -lgrass_vect -lgrass_dbmibase -lgrass_gis
-lgrass_datetime -lz -lgrass_dbmiclient -lgrass_dbmibase -lgrass_gis
-lgrass_datetime -lz -lgrass_gis -lgrass_datetime -lz -lgrass_dgl
-lgrass_dig2 -lgrass_gis -lgrass_datetime -lz -lgrass_rtree -lgrass_gis
-lgrass_datetime -lz -lgrass_linkm -lgrass_rtree \
                -lgrass_bitmap -lgrass_linkm -lgrass_linkm -lgrass_vect
-lgrass_dbmibase -lgrass_gis -lgrass_datetime -lz -lgrass_dbmiclient
-lgrass_dbmibase -lgrass_gis -lgrass_datetime -lz -lgrass_gis
-lgrass_datetime -lz -lgrass_dgl -lgrass_dig2 -lgrass_gis
-lgrass_datetime -lz -lgrass_rtree -lgrass_gis -lgrass_datetime -lz
-lgrass_linkm -lgrass_rtree -lgrass_dig2 -lgrass_gis -lgrass_datetime -lz
-lgrass_rtree -lgrass_dgl -lgrass_rtree -lgrass_linkm -lgrass_dbmiclient
-lgrass_dbmibase -lgrass_gis -lgrass_datetime -lz -lgrass_gis
-lgrass_datetime -lz -lgrass_dbmibase -lgrass_gis -lgrass_datetime -lz
-L/usr/local/lib -lgdal -lgrass_sites -lgrass_datetime -lgrass_dbmibase
-lgrass_gis -lgrass_datetime -lz -lgrass_dbmiclient -lgrass_dbmibase
-lgrass_gis -lgrass_datetime -lz -lgrass_gis -lgrass_datetime -lz
-lgrass_gis -lgrass_datetime -lz -lgrass_vect -lgrass_dbmibase
-lgrass_gis -lgrass_datetime -lz -lgrass_dbmiclient -lgrass_dbmibase
-lgrass_gis -lgrass_datetime -lz -lgrass_gis -lgrass_datetime -lz
-lgrass_dgl -lgrass_dig2 -lgrass_gis -lgrass_datetime -lz -lgrass_rtree
-lgrass_gis -lgrass_datetime -lz -lgrass_linkm -lgrass_rtree
-lgrass_form -lgrass_dbmibase -lgrass_gis -lgrass_datetime -lz
-lgrass_dbmiclient -lgrass_dbmibase -lgrass_gis -lgrass_datetime -lz
-lgrass_gis -lgrass_datetime -lz -lgrass_gis -lgrass_datetime -lz
-lgrass_dbmiclient -lgrass_dbmibase -lgrass_gis -lgrass_datetime -lz
-lgrass_gis -lgrass_datetime -lz -lgrass_dbmibase -lgrass_gis
-lgrass_datetime -lz \
                -lgrass_g3d -lgrass_gis -lgrass_datetime -lz
-lgrass_gis -lgrass_datetime -lz -lz \
                -lgrass_datetime -ltk -lm -ltcl -lm -lGLU -lGL -lSM
-lICE -lX11 -lXmu -lXext -lm -ltiff \
                 -lavcodec -lm
/home/neteler/svngrass/dist.x86_64-unknown-linux-gnu/lib/libgrass_ogsf.so:
undefined reference to `guess_format'
/home/neteler/svngrass/dist.x86_64-unknown-linux-gnu/lib/libgrass_ogsf.so:
undefined reference to `av_destruct_packet_nofree'
/home/neteler/svngrass/dist.x86_64-unknown-linux-gnu/lib/libgrass_ogsf.so:
undefined reference to `av_write_trailer'
/home/neteler/svngrass/dist.x86_64-unknown-linux-gnu/lib/libgrass_ogsf.so:
undefined reference to `url_fclose'
/home/neteler/svngrass/dist.x86_64-unknown-linux-gnu/lib/libgrass_ogsf.so:
undefined reference to `av_set_parameters'
/home/neteler/svngrass/dist.x86_64-unknown-linux-gnu/lib/libgrass_ogsf.so:
undefined reference to `av_write_frame'
/home/neteler/svngrass/dist.x86_64-unknown-linux-gnu/lib/libgrass_ogsf.so:
undefined reference to `url_fopen'
/home/neteler/svngrass/dist.x86_64-unknown-linux-gnu/lib/libgrass_ogsf.so:
undefined reference to `av_write_header'
/home/neteler/svngrass/dist.x86_64-unknown-linux-gnu/lib/libgrass_ogsf.so:
undefined reference to `av_register_all'
/home/neteler/svngrass/dist.x86_64-unknown-linux-gnu/lib/libgrass_ogsf.so:
undefined reference to `dump_format'
/home/neteler/svngrass/dist.x86_64-unknown-linux-gnu/lib/libgrass_ogsf.so:
undefined reference to `av_new_stream'
/home/neteler/svngrass/dist.x86_64-unknown-linux-gnu/lib/libgrass_ogsf.so:
undefined reference to `av_alloc_format_context'
collect2: ld returned 1 exit status
make[1]: *** [nvwish] Error 1
make[1]: Leaving directory `/home/neteler/svngrass/visualization/nviz/src'
make: *** [default] Error 2

If I manually add -lavformat, the compilation works ok.

The package is lib64ffmpeg51-devel-0.4.9-3.pre1.7407.10plf2007.1 (Mandriva)
which contains
rpm -ql lib64ffmpeg51-devel-0.4.9-3.pre1.7407.10plf2007.1 | grep lib64
/usr/lib64/libavcodec.so
/usr/lib64/libavformat.so
/usr/lib64/libavutil.so
/usr/lib64/libpostproc.so
...

Any ideas how to automate that -lavformat is included?

Markus

--
View this message in context: http://www.nabble.com/NVIZ-compile-error-with-missing--lavformat-tp14359880p14359880.html
Sent from the Grass - Dev mailing list archive at Nabble.com.

Markus Neteler wrote:

Compiling NVIZ from SVN trunk, I get following problem:

....

/home/neteler/svngrass/dist.x86_64-unknown-linux-gnu/lib/libgrass_ogsf.so:

undefined reference to `guess_format'

/home/neteler/svngrass/dist.x86_64-unknown-linux-gnu/lib/libgrass_ogsf.so:

undefined reference to `av_destruct_packet_nofree'

....

collect2: ld returned 1 exit status
make[1]: *** [nvwish] Error 1
make[1]: Leaving directory
`/home/neteler/svngrass/visualization/nviz/src'
make: *** [default] Error 2

If I manually add -lavformat, the compilation works ok.

...

Any ideas how to automate that -lavformat is included?

the new ffmpeg movie format-by-extension code needs libavformat which
may come in a separate package to libavcodec.
(libavformat-dev and libavcodec-dev packages on Debian)

I don't know much about ./config scripts, but the attached is an
untested cut & paste job which might work. (I don't know about
-lavutil,..)

Hamish

      ____________________________________________________________________________________
Never miss a thing. Make Yahoo your home page.
http://www.yahoo.com/r/hs

(attachments)

config_in_avformat.diff (655 Bytes)

Hamish wrote:

> Compiling NVIZ from SVN trunk, I get following problem:
....
>
/home/neteler/svngrass/dist.x86_64-unknown-linux-gnu/lib/libgrass_ogsf.so:
> undefined reference to `guess_format'
>
/home/neteler/svngrass/dist.x86_64-unknown-linux-gnu/lib/libgrass_ogsf.so:
> undefined reference to `av_destruct_packet_nofree'
....
> collect2: ld returned 1 exit status
> make[1]: *** [nvwish] Error 1
> make[1]: Leaving directory
> `/home/neteler/svngrass/visualization/nviz/src'
> make: *** [default] Error 2
>
> If I manually add -lavformat, the compilation works ok.
...
> Any ideas how to automate that -lavformat is included?

the new ffmpeg movie format-by-extension code needs libavformat which
may come in a separate package to libavcodec.
(libavformat-dev and libavcodec-dev packages on Debian)

I don't know much about ./config scripts, but the attached is an
untested cut & paste job which might work. (I don't know about
-lavutil,..)

LOC_CHECK_LIBS(avcodec, avcodec_init, FFMPEG, $FFMPEGLIBPATH, FFMPEGLIB,-lavutil $MATHLIB)
+LOC_CHECK_LIBS(avformat, av_set_parameters, FFMPEG, $FFMPEGLIBPATH, FFMPEGLIB,-lavutil $MATHLIB)

I initially thought that this would replace FFMPEGLIB, but it will
actually append to it, so it should be okay.

--
Glynn Clements <glynn@gclements.plus.com>

Glynn Clements wrote:

> > Compiling NVIZ from SVN trunk, I get following problem:
> ....
> >
> /home/neteler/svngrass/dist.x86_64-unknown-linux-gnu/lib/libgrass_ogsf.so:
> > undefined reference to `guess_format'
> >
> /home/neteler/svngrass/dist.x86_64-unknown-linux-gnu/lib/libgrass_ogsf.so:
> > undefined reference to `av_destruct_packet_nofree'
> ....
> > collect2: ld returned 1 exit status
> > make[1]: *** [nvwish] Error 1
> > make[1]: Leaving directory
> > `/home/neteler/svngrass/visualization/nviz/src'
> > make: *** [default] Error 2
> >
> > If I manually add -lavformat, the compilation works ok.
> ...
> > Any ideas how to automate that -lavformat is included?
>
>
> the new ffmpeg movie format-by-extension code needs libavformat which
> may come in a separate package to libavcodec.
> (libavformat-dev and libavcodec-dev packages on Debian)
>
> I don't know much about ./config scripts, but the attached is an
> untested cut & paste job which might work. (I don't know about
> -lavutil,..)

> LOC_CHECK_LIBS(avcodec, avcodec_init, FFMPEG, $FFMPEGLIBPATH, FFMPEGLIB,-lavutil $MATHLIB)
> +LOC_CHECK_LIBS(avformat, av_set_parameters, FFMPEG, $FFMPEGLIBPATH, FFMPEGLIB,-lavutil $MATHLIB)

I initially thought that this would replace FFMPEGLIB, but it will
actually append to it, so it should be okay.

Committed.

--
Glynn Clements <glynn@gclements.plus.com>

Glynn Clements wrote on 12/17/2007 06:47 PM:

Hamish wrote:
  

LOC_CHECK_LIBS(avcodec, avcodec_init, FFMPEG, $FFMPEGLIBPATH, FFMPEGLIB,-lavutil $MATHLIB)
+LOC_CHECK_LIBS(avformat, av_set_parameters, FFMPEG, $FFMPEGLIBPATH, FFMPEGLIB,-lavutil $MATHLIB)
    
I initially thought that this would replace FFMPEGLIB, but it will
actually append to it, so it should be okay.

Works nicely.

Thanks
Markus