문제

in general we use ar rcs command to create a static library on unix.

what does the flag 's' mean over here man page says

Do not generate an archive symbol table. This can speed up building a large library in several steps. The resulting archive can not be used with the linker. In order to build a symbol table, you must omit the S modifier on the last execution of ar, or you must run ranlib on the archive.

i am confused by the sentence "The resulting archive can not be used with the linker.".

do we have to use ranlib for creating the static library after the ar command? what is the purpose of the ranlib and how is it used?

도움이 되었습니까?

해결책

The ranlib utility creates an index in the library that the linker uses to do its lookups. Note that the omit index command in ar is uppercase S - the command to build the index is lowercase s, which you should be using. There is no need to use ranlib after running ar rcs.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top