问题
I have an archive named libapi.a
which is being generated by makefile
.
This libapi.a depends on some of the boost libraries like libboost_system.a
, libboost_filesystem.a
and libboost_datetime.a
Now in my makefile what is happening is the objects of the Boost libraries are extracted using ar x
command.
The objects are copied to build directory and libapi.a
is generated using
ar rcs ../build/libapi.so ../build/*.o
My question is why are the objects of libboost libraries being extracted? Can't we generate archive just like we generate shared library using the below command with out extracting out any objects of boost library?
g++ $(CPPFLAGS) $(OBJS) -static -o libapi.a \
/home/boost/libboost_datetime.a /home/boost/libboost_filesystem.a \
/home/boost/libboost_system.a -I/home/boost/
来源:https://stackoverflow.com/questions/57585823/different-ways-of-linking-archive