gcc linker error: version node not found for symbol
I'm trying to build a shared library, and I get the following error:
libavformat.so: version node not found for symb开发者_JAVA百科ol av_dup_packet@LIBAVFORMAT_52
ld: failed to set dynamic section sizes: Bad value
Does anybody knows what this error means? Host is i586-linux target is arm-linux
Edit: Resolved, see comments
It was caused by an inline assembly directive .symver
. My solution was to manually modify the generated config.h to disable version nodes symbols.
Check out internal.h lines 214-223
I ran into this error when building libsctp into a custom build environment.
Symbol Versioning is explained here and a linker script may be used to control it. In my case I was able to pull in the existing version linker script by adding to the target-specific LDFLAGS makefile variable:
$(LIB_PATH)/libsctp.so: LDFLAGS += \
-Xlinker --version-script=$(MODULE_PATH)/src/lib/Versions.map
Oh, the function was moved in April 2009 from libavformat/util.c
to a new file in libavcodec/avpacket.c
. The comment in internal.h states explicitly:
If a function is moved from one library to another, a wrapper must be retained in the original location to preserve binary compatibility.
But it is impossible to retain binary compatibility when a function is moved between libraries.
Note that this bug was reported in Chromium project more than a year ago.
By the way, there is no need to edit config.h
manually: you can run ./configure --disable-symver
.
It took someone else to point this out to me, so I thought I might as well put it on here so others like me can understand ognian's answer:
This translates to editing config.h
after you run ./configure
and making the SYMVER
-related entries are set to 0. Like so:
#define HAVE_SYMVER 0
#define HAVE_SYMVER_GNU_ASM 0
#define HAVE_SYMVER_ASM_LABEL 0
精彩评论