Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

libyami compile error when static enabled. #377

Closed
xuguangxin opened this issue Dec 10, 2015 · 10 comments
Closed

libyami compile error when static enabled. #377

xuguangxin opened this issue Dec 10, 2015 · 10 comments

Comments

@xuguangxin
Copy link
Contributor

this also mentioned in #368

reproduce steps:
configure option:
./autogen.sh --prefix=$LIBYAMI_PREFIX --enable-tests --enable-vp9dec --enable-docs --enable-dmabuf --disable-debug --enable-v4l2 --enable-static && make -j8

errors:
ts/yami/release/libyami/decoder/vaapidecoder_h265.cpp:520: undefined reference to h265_quant_matrix_8x8_get_raster_from_uprightdiagonal' ../decoder/.libs/libyami_decoder.a(libyami_decoder_la-vaapidecoder_h265.o): In functionYamiMediaCodec::fillScalingList32x32(_VAIQMatrixBufferHEVC, _H265ScalingList const)':
/home/thomas/projects/yami/release/libyami/decoder/vaapidecoder_h265.cpp:521: undefined reference to h265_quant_matrix_8x8_get_raster_from_uprightdiagonal' ../decoder/.libs/libyami_decoder.a(libyami_decoder_la-vaapidecoder_h265.o): In functionfillScalingList4x4':
/home/thomas/projects/yami/release/libyami/decoder/vaapidecoder_h265.cpp:518: undefined reference to h265_quant_matrix_4x4_get_raster_from_uprightdiagonal' ../decoder/.libs/libyami_decoder.a(libyami_decoder_la-vaapidecoder_h265.o): In functionfillScalingList8x8':
/home/thomas/projects/yami/release/libyami/decoder/vaapidecoder_h265.cpp:519: undefined reference to h265_quant_matrix_8x8_get_raster_from_uprightdiagonal' ../decoder/.libs/libyami_decoder.a(libyami_decoder_la-vaapidecoder_h265.o): In functionfillScalingList16x16':
/home/thomas/projects/yami/release/libyami/decoder/vaapidecoder_h265.cpp:520: undefined reference to h265_quant_matrix_8x8_get_raster_from_uprightdiagonal' ../decoder/.libs/libyami_decoder.a(libyami_decoder_la-vaapidecoder_h265.o): In functionfillScalingList32x32':
/home/thomas/projects/yami/release/libyami/decoder/vaapidecoder_h265.cpp:521: undefined reference to h265_quant_matrix_8x8_get_raster_from_uprightdiagonal' /home/thomas/projects/yami/release/libyami/decoder/vaapidecoder_h265.cpp:521: undefined reference toh265_quant_matrix_8x8_get_raster_from_uprightdiagonal'
../decoder/.libs/libyami_decoder.a(libyami_decoder_la-vaapidecoder_h265.o): In function YamiMediaCodec::VaapiDecoderH265::VaapiDecoderH265()': /home/thomas/projects/yami/release/libyami/decoder/vaapidecoder_h265.cpp:464: undefined reference toh265_parser_new'
../decoder/.libs/libyami_decoder.a(libyami_decoder_la-vaapidecoder_h265.o): In function YamiMediaCodec::VaapiDecoderH265::~VaapiDecoderH265()': /home/thomas/projects/yami/release/libyami/decoder/vaapidecoder_h265.cpp:471: undefined reference toh265_parser_free'
../decoder/.libs/libyami_decoder.a(libyami_decoder_la-vaapidecoder_h265.o): In function YamiMediaCodec::VaapiDecoderH265::decodeSlice(H265NalUnit)': /home/thomas/projects/yami/release/libyami/decoder/vaapidecoder_h265.cpp:1025: undefined reference toh265_parser_parse_slice_hdr'
../decoder/.libs/libyami_decoder.a(libyami_decoder_la-vaapidecoder_h265.o): In function `YamiMediaCodec::VaapiDecoderH265::decodeParamSet(H265NalUnit)':

@uartie
Copy link
Contributor

uartie commented Dec 10, 2015

Specifying --disable-shared when using --enable-static is the recommended workaround for now.

@seanvk
Copy link
Contributor

seanvk commented Dec 14, 2015

This issue is OS platform specific. For Ubuntu, the recommendation is as above mentioned by @uartie

Alternative suggestion, let's disable mixed configuration of static and shared or just don't do it.

I vote for just don't do it.

@seanvk seanvk closed this as completed Dec 14, 2015
@xuguangxin
Copy link
Contributor Author

But --enable-static is standard configure option. It's should not depends on OS platform. I think @uartie can repeat this on centos(correct me if i am wrong). Since we find a workaround, we can flag it as low priority. But i tend to treat it as an issue in our configuration script.

@uartie
Copy link
Contributor

uartie commented Dec 15, 2015

I only tried this on Fedora and Ubuntu. It works fine on Fedora but not on Ubuntu. I'm not sure why Ubuntu can't handle it but Fedora can. Possibly something different with the compiler/linker tools and their settings and/or versions.

During the link phase on Fedora, the dependency_libs in all of the .la dependencies are expanded for the link command. On Ubuntu, this expansion is not done for some reason.

In this case here, simpleplayer directly depends on libyami_decoder.la which has libyami_codecparser.la listed in it's dependency_libs. The simpleplayer should not directly depend on libyami_codecparser.la, but it needs it for proper linking. IMO, this is a shortcoming/problem caused by the distro tools.

Is there actually a use-case where we want both shared and static libraries compiled at the same time?

@xuguangxin
Copy link
Contributor Author

We can't choose this for customer... It will give them negative feedback

@uartie
Copy link
Contributor

uartie commented Dec 15, 2015

I found that this is a common problem on Debian (thus, Ubuntu):

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=702737

The problem is that these distros patched libtool to set link_all_deplibs=no. Apparently this goes against what the libtool documentation states/recommends.

The only reasonable hack to fix this, based on my research, is to do a sed replacement from configure.ac on the generated libtool wrapper.

Others have said to recompile libtool from gnu.org or painstakingly declare all dependencies explicitly in the makefiles. I think we can all agree that these last two are not feasible solutions and just plain nonsense.

@xuguangxin
Copy link
Contributor Author

ok, maybe i can file this in FAQ. thanks U.Artie and Sean

uartie added a commit to uartie/libyami that referenced this issue Dec 15, 2015
Ubuntu and Debian patched libtool to set link_all_deplibs=no.
Apparently this goes against what the libtool documentation
states/recommends.

Setting link_all_deplibs causes libtool to not properly track
down all the inter-dependencies for you.  That is, if A depends
on B and B depends on C, then libtool will not link A to C
automatically, even though it is required.  Oddly, this only
happens when both static and shared libraries are compiled
at the same time.

To workaround this, sed replace link_all_deplibs=no to
link_all_deplibs=yes in the configure generated libtool
wrapper.

Fixes intel#377

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
@uartie
Copy link
Contributor

uartie commented Dec 15, 2015

Oops, I didn't see your last comment before submitting the pull request to workaround the problem. If you'd still rather explain this in a FAQ then I can retract the pull request on your command.

@xuguangxin
Copy link
Contributor Author

seems it's too ugly. File a FQA maybe better. Thanks for good finding

@xuguangxin
Copy link
Contributor Author

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants