Xpra: Ticket #594: csc_swscale import fails, undefine symbol: av_px_fmt_desc_get

$ xpra attach blah
2014-06-11 14:28:20,626  cannot import csc_swscale (swscale colorspace conversion): /usr/lib/python2.6/site-packages/xpra/codecs/csc_swscale/colorspace_converter.so: undefined symbol: av_pix_fmt_desc_get

As you can see colorspace_converter.so is not linked to any libraries.

$ ldd /usr/lib/python2.6/site-packages/xpra/codecs/csc_swscale/colorspace_converter.so
	linux-vdso.so.1 =>  (0x00007fffa97ff000)
	libpython2.6.so.1.0 => /usr/lib64/libpython2.6.so.1.0 (0x00007f87b3e99000)
	libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f87b3c7c000)
	libc.so.6 => /lib64/libc.so.6 (0x00007f87b38e7000)
	libdl.so.2 => /lib64/libdl.so.2 (0x00007f87b36e3000)
	libutil.so.1 => /lib64/libutil.so.1 (0x00007f87b34e0000)
	libm.so.6 => /lib64/libm.so.6 (0x00007f87b325b000)
	/lib64/ld-linux-x86-64.so.2 (0x0000003ad8600000)

This happens with RHEL/CentOS packages that you provide. I also compiled against the newest x264, libavc, and ffmpeg using the provided spec without any resolution.

Build Procedures I used for x264, libvpx, and ffmpeg. I used Cython 0.20.1.

$ wget https://webm.googlecode.com/files/libvpx-v1.3.0.tar.bz2
$ cd libvpx-v1.3.0
$ ./configure --enable-pic --disable-install-docs  --enable-shared --enable-static --enable-vp8 --enable-realtime-only --enable-onthefly-bitpacking --enable-runtime-cpu-detect
$ make -j5
$ make install
$ wget https://libav.org/releases/libav-9.13.tar.xz
$ tar -xvf libav-9.13.tar.xz
$ ./configure --enable-runtime-cpudetect --enable-static --enable-shared --disable-avdevice  --enable-pic
$ make -j5
$ make install
$ wget http://ftp.videolan.org/pub/x264/snapshots/x264-snapshot-20140610-2245-stable.tar.bz2
$ ./configure --enable-shared --enable-static
$ make -j5
$ wget http://www.ffmpeg.org/releases/ffmpeg-2.2.3.tar.bz2
$ cd ffmpeg-2.2.3
$ ./configure --enable-static --enable-shared --disable-debug  --enable-gpl \
  --enable-runtime-cpudetect  --disable-doc  --disable-ffplay --disable-ffprobe \
  --disable-ffserver --disable-vaapi --disable-vdpau  --disable-everything \
  --enable-decoder=h264 --enable-memalign-hack --disable-symver
$ make -j5
$ make install

Full xpra output (other errors are probably unrelated)

$ xpra attach blah
2014-06-11 14:28:20,626  cannot import csc_swscale (swscale colorspace conversion): /usr/lib/python2.6/site-packages/xpra/codecs/csc_swscale/colorspace_converter.so: undefined symbol: av_pix_fmt_desc_get
2014-06-11 14:28:20,641  cannot import csc_opencl (OpenCL colorspace conversion): No module named pyopencl
2014-06-11 14:28:20,698  cannot import enc_webm (webp encoder): Could not find webp library from ['libwebp.so.5', 'libwebp.so.4']
2014-06-11 14:28:20,698  cannot import dec_webm (webp encoder): Could not find webp library from ['libwebp.so.5', 'libwebp.so.4']
2014-06-11 14:28:21,038 xpra client version 0.13.5
2014-06-11 14:28:21,362 csc module csc_swscale could not be loaded: /usr/lib/python2.6/site-packages/xpra/codecs/csc_swscale/colorspace_converter.so: undefined symbol: av_pix_fmt_desc_get
2014-06-11 14:28:24,254 OpenGL support not enabled: unable to query max texture size: cannot import name GL_MAX_RECTANGLE_TEXTURE_SIZE
	xpra start DISPLAY
	xpra stop [DISPLAY]
	xpra exit [DISPLAY]
	xpra list
	xpra upgrade DISPLAY
	xpra attach [DISPLAY]
	xpra detach [DISPLAY]
	xpra screenshot filename [DISPLAY]
	xpra info [DISPLAY]
	xpra control DISPLAY command [arg1] [arg2]..
	xpra version [DISPLAY]
	xpra shadow [DISPLAY]
xpra: error: unknown format for display name: blah

Thu, 12 Jun 2014 01:23:42 GMT - pyther:

I did some more testing and refined my build process. I discovered libav was unnecessary and actually looks as if it may conflict with ffmpeg.

When dynamically linking against ffmpeg and x264 in the xpra build process, xpra starts, no errors are given, and h264 decoding works.

rpmbuild -ba SPECS/xpra.spec

When built with static linking

rpmbuild -ba SPECS/xpra.spec --define 'static_video_libs 1'

xpra gives the following error (as in the original post) and h264 encoding does not work.

2014-06-11 21:10:20,626 cannot import csc_swscale (swscale colorspace conversion): /usr/lib/python2.6/site-packages/xpra/codecs/csc_swscale/colorspace_converter.so: undefined symbol: av_pix_fmt_desc_get
$ wget  http://ftp.videolan.org/pub/x264/snapshots/x264-snapshot-20140610-2245-stable.tar.bz2
$ tar xvf 0140610-2245-stable.tar.bz2
$ cd x264-snapshot-20140610-2245-stable
$ ./configure --enable-shared --enable-static
$ make -j2
$ make install
$ wget http://www.ffmpeg.org/releases/ffmpeg-2.2.3.tar.bz2
$ tar ffmpeg-2.2.3.tar.bz2
$ cd ffmpeg-2.2.3
$ ./configure --enable-shared --enable-static --disable-debug --enable-gpl  --enable-runtime-cpudetect --disable-doc --disable-ffplay --disable-ffprobe --disable-ffserver --disable-vaapi --disable-vdpau --disable-everything --enable-decoder=h264 --enable-memalign-hack --disable-symver
$ make -j2
$ make install
$ wget http://cython.org/release/Cython-0.20.1.tar.gz
$ tar xvf Cython-0.20.1.tar.gz
in the %build and %install sections I added
export PYTHONPATH=/home/pyther/Cython-0.20.1
export PATH=$PATH:/home/pyther/Cython-0.20.1/bin
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig

Thu, 12 Jun 2014 02:00:52 GMT - Antoine Martin: owner, status, description changed

OK, so it looks like I just need to not build it statically linked. I believe that's the case for centos 6.4 onwards?

As you may have already found out, don't mix libav and ffmpeg. Only ffmpeg is really supported.

Thu, 12 Jun 2014 02:36:46 GMT - pyther:

Not building statically would work. However, you would need to include a ffmpeg and x264 rpm. How do you feel about that?

$ pwd
$ find . -name '*.so' -exec ldd {} \; | grep 'not found'
	libvpx.so.1 => not found
	libvpx.so.1 => not found
	libswscale.so.2 => not found
	libavcodec.so.55 => not found
	libavutil.so.52 => not found
$ LD_LIBRARY_PATH='/usr/local/lib' find . -name '*.so' -exec ldd {} \; | grep 'not found'

I installed x264 and ffmpeg in /usr/local

Sort of unrelated, I would like to help improve the spec file and get xpra to build in a clean mock environment.

Thu, 12 Jun 2014 03:04:22 GMT - Antoine Martin:

Wait, I thought that there were repositories or packages for ffmpeg already somewhere (dag? rpmfusion?)

If not, then we have to use static linking (and fix that).

As for improving the spec file, by all means - that would be great as this is badly needed... (as long as it doesn't break my builtbot too badly..)

Thu, 12 Jun 2014 08:28:56 GMT - Antoine Martin: owner, status changed

I believe that the fix for this problem is r6744. The backport for v0.13.x is in r6745.

This seems to work for me, can I close this ticket?

Thu, 12 Jun 2014 13:08:27 GMT - pyther: status changed; resolution set

Built against the latest svn checkout and this error issue is resolved. There are a few other build issues - I think, but I will open up separate tickets.

Sat, 23 Jan 2021 05:00:21 GMT - migration script:

this ticket has been moved to: https://github.com/Xpra-org/xpra/issues/594