lu-zero / bmdtools

Basic capture and play programs for Blackmagic Design Decklink
Boost Software License 1.0
198 stars 74 forks source link

Ubuntu 16. bmdtools make give some errors vaapi_device_free vdpau_device_create #78

Closed efirmaster closed 7 years ago

efirmaster commented 7 years ago

Pls. sorry for my bad English! I compile libav, aac, mp3, yasm and other.

$ avconv -h
avconv version v12_dev0-3196-g07e1f99, Copyright (c) 2000-2016 the Libav developers
  built on Sep 19 2016 17:57:49 with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.1) 20160609

When i try to make bmdtools width:

make SDK_PATH=/usr/local/src/bmd/include

I have errors like: bmdcapture.cpp: In function ‘int main(int, char**)’: bmdcapture.cpp:971:37: warning: ignoring return value of ‘int avformat_write_header(AVFormatContext*, AVDictionary**)’, declared with attribute warn_unused_result [-Wunused-result] avformat_write_header(oc, &opts); ^ /usr/local/lib/libavutil.a(hwcontext_vaapi.o): In functionvaapi_device_free': /all/libavutil/hwcontext_vaapi.c:861: undefined reference to XCloseDisplay' /usr/local/lib/libavutil.a(hwcontext_vaapi.o): In functionvaapi_device_create': /all/libavutil/hwcontext_vaapi.c:891: undefined reference to XOpenDisplay' /all/libavutil/hwcontext_vaapi.c:896: undefined reference tovaGetDisplay' /all/ffmpeg/libavutil/hwcontext_vaapi.c:903: undefined reference to XDisplayName' /all/libavutil/hwcontext_vaapi.c:893: undefined reference toXDisplayName' /all/libavutil/hwcontext_vaapi.c:917: undefined reference to vaGetDisplayDRM' /all/libavutil/hwcontext_vaapi.c:891: undefined reference toXOpenDisplay' /all/libavutil/hwcontext_vaapi.c:893: undefined reference to XDisplayName' /all/libavutil/hwcontext_vaapi.c:898: undefined reference toXDisplayName' /usr/local/lib/libavutil.a(hwcontext_vdpau.o): In function vdpau_device_create': /all/libavutil/hwcontext_vdpau.c:431: undefined reference toXOpenDisplay' /all/libavutil/hwcontext_vdpau.c:437: undefined reference to XDisplayString' /all/libavutil/hwcontext_vdpau.c:439: undefined reference toXDefaultScreen' /all/libavutil/hwcontext_vdpau.c:439: undefined reference to vdp_device_create_x11' /all/libavutil/hwcontext_vdpau.c:433: undefined reference toXDisplayName' /usr/local/lib/libavutil.a(hwcontext_vdpau.o): In function vdpau_device_free': /all/libavutil/hwcontext_vdpau.c:410: undefined reference toXCloseDisplay' collect2: error: ld returned 1 exit status Makefile:58: recipe for target 'bmdcapture' failed make: *\ [bmdcapture] Error 1

`

lu-zero commented 7 years ago

Please paste the output of

pkg-config --libs libavcodec libavformat libswscale libavutil
efirmaster commented 7 years ago

pkg-config --libs libavcodec libavformat libswscale libavutil

-L/usr/local/lib -lavformat -lavcodec -lvdpau -lX11 -lasound -lx265 -lx264 -lpthread -ldl -lvo-aacenc -lmp3lame -lfdk-aac -lz -pthread -lavresample -lswscale -lavutil -lm

lu-zero commented 7 years ago

they should be reordered:

-L/usr/local/lib -lavformat -lavcodec  -lasound -lx265 -lx264 -lpthread -ldl -lvo-aacenc -lmp3lame -lfdk-aac -lz -pthread -lavresample -lswscale -lavutil -lm -lvdpau -lX11

Try to override them in the makefile for now. I'll report and/or fix it upstream later.

gsmiro commented 7 years ago

I'm having the same issue, but my ffmpeg compilation results in a much larger set of -l flags:

-Wl,--no-undefined -pthread -L/a/path -lavformat -lavcodec -lXv -lvdpau -lva-drm -lva-X11 -lva -lxcb-shm -lxcb-xfixes -lxcb-render -lcxb-shape -lxcb -lXau -lXdmcp -LSDL2 -lasound -lpulse-simple -lpulse -lX11 -lXtext -lXcursor -lXinerama -lXi -lXrandr -lXss -lXxf86vm -lwayland-egl -lwayland-client -lwayland-cursor -lxkbcommon -lts -lx265 -lstdc++ -lrt -lx264 -ldl -lvpx -lpthread -lvorbisenc -lvorbis -ltheoraenc -ltheoradec -logg -lopus -lmp3lame -lfdk-aac -lass -lfontconfig -lenca -lfribidi -lexpat -lfreetype -lpng12 -lz -lswresample -lswscale -lavutil -lm

Which outputs the same errors. I moved -lvdpau and -lX11 to the end of the command and now I get the following error:

hwcontext_vaapi.c864: undefined reference to 'vaGetDisplay'

Clearly the order matters but can you elaborate a bit on why so I can help with the debugging?

lu-zero commented 7 years ago

your linker has as-needed enabled and for some reasons the link like in pkgconfig is sort of wrong you need to reorder -lva and you should be ok. Hopefully it will be fixed soon.

On Wed, Oct 19, 2016 at 9:11 PM, Gabriel Serralha Miró < notifications@github.com> wrote:

I'm having the same issue, but my ffmpeg compilation results in a much larger set of -l flags:

-Wl,--no-undefined -pthread -L/a/path -lavformat -lavcodec -lXv -lvdpau -lva-drm -lva-X11 -lva -lxcb-shm -lxcb-xfixes -lxcb-render -lcxb-shape -lxcb -lXau -lXdmcp -LSDL2 -lasound -lpulse-simple -lpulse -lX11 -lXtext -lXcursor -lXinerama -lXi -lXrandr -lXss -lXxf86vm -lwayland-egl -lwayland-client -lwayland-cursor -lxkbcommon -lts -lx265 -lstdc++ -lrt -lx264 -ldl -lvpx -lpthread -lvorbisenc -lvorbis -ltheoraenc -ltheoradec -logg -lopus -lmp3lame -lfdk-aac -lass -lfontconfig -lenca -lfribidi -lexpat -lfreetype -lpng12 -lz -lswresample -lswscale -lavutil -lm

Which outputs the same errors. I moved -lvdpau and -lX11 to the end of the command and now I get the following error:

hwcontext_vaapi.c864: undefined reference to 'vaGetDisplay'

Clearly the order matters but can you elaborate a bit on why so I can help with the debugging?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/lu-zero/bmdtools/issues/78#issuecomment-254911705, or mute the thread https://github.com/notifications/unsubscribe-auth/AAOlpA2JnjBwrcCTdXS_I60ZqG6kxCJZks5q1mtigaJpZM4KBkCT .

gsmiro commented 7 years ago

So with the help of lu-zero's last comment and (this post)[ht8tp://stackoverflow.com/questions/38995044/errors-of-vagetdisplay-and-vagetdisplaydrm], moving -lvdpau -lX11 and -lva* flags to the end of the compile command worked.

bylijian commented 7 years ago

You are right ,thank you ~ @gsmiro

lu-zero commented 7 years ago

Libav got the link line fixed meanwhile.