Different ways of linking archive

感情迁移 提交于 2019-12-24 15:22:05

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!