Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
194 views
in Technique[技术] by (71.8m points)

android - Symbol from C file is not being added even though the MakeFile includes its object file

I'm trying to build libavformat with this MAKEFILE. Although the makefile includes avio.o file in its build instruction but it doesn't add any symbol for the functions that are declared on the header file url.h. Source folder which includes the avio.c, avio.h and url.h files can be found HERE.

The nm command for avio.o returns

nm: avio.o: File format not recognized

file command on avio.o shows the following output

avio.o: LLVM IR bitcode

I have checked the nm command on the generated libavformat.so and did not find any symbols for the functions declared on the url.h file

I have been stuck on this for two days. Could not figure out how to solve this problem!

Calling the ff_check_interrupt method and results in

undefined reference to 'ff_check_interrupt'

Configurations and flags.

question from:https://stackoverflow.com/questions/65882949/symbol-from-c-file-is-not-being-added-even-though-the-makefile-includes-its-obje

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

First off, a function declared by url.h should be defined in url.c, not in avio.c.

Second the only use of the ff_check_interrupt in avoi.c is within a static inline function, so indeed the toolchain is likely optimizing this symbol away.

I think what's occurring for you is that the toolchain making the decision that this is only used in this compilation unit.

Moving the definition of ff_check_interrupt to 'url.c' should resolve the issue. This is a library though, so out of your control.

However, this doesn't answer why thousands of users on Github have this same library in their code. I'd suggest comparing your Makefile against those (e.g. first search return is this one.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...