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

Viewed 239

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.

1 Answers

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.

Related