简体   繁体   中英

How to make linking to a static library also link to its dependency as well?

I wrote a static library called libverify_passwd.a using llvm-ar-7 , which use symbol getpwuid , getspnam and crypt . It requires special linker argument -lcrypt and -lc (if -nostdlib is specified).

Another project of mine depend on this static library and it will be cumbersome and hard to maintain by adding -lcrypt to the Makefile of that project. Is there any way so that during the link time, the dependency can be solved automatically, or is there any other tool that simplify the maintenance of this?

Look at How to merge two “ar” static libraries into one? to make a new lib containing what you want

However the best way is to continue to use -lcrypt at link time

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM