Search code examples
makefilegnu-makeconfigureautotoolsbsdiff

build bsdiff into static link .a


I would like to use bsdiff into c++ project by external links.

So I have to build a static link. I can do that with ar rcs bsdiff.a bsdiff.o But there is already a main function. So When I link bsdiff.a to my cpp build and build it, I have redefinition of main function.

So how avoid the main function ?

(I already try to comment bsdiff_CFLAGS = -DBSDIFF_EXECUTABLE into Makefile.am but get undefined reference to main function)


Solution

  • The build system provided with the project is quite simple and does not support building the code as a library. As per documentation:

    The easiest way to integrate is to simply copy the c file to your source folder and build it.

    I would not call project's build system, but rather compile required files directly as part of your project, as developer suggests.