File version information

杀马特。学长 韩版系。学妹 提交于 2019-12-10 10:48:18

问题


How can I add version information to a file? The files will typically be executables, .so and .a files.

Note: I'm using C++, dpkg-build and Ubuntu 8.10 if any of those have support for this.


回答1:


For shared objects pass -Wl,soname,<soname> to gcc, or -soname <soname> to ld.

Executables and static libraries do not have version information per se, but you can add it to the filename if you like.




回答2:


Linux executables do not have version information like Windows have...the only way I can think of doing it is to create a static character string, which would be expanded by a version control tracking system such as rcs, cvs, svn, git, in which a certain identifier is expanded based on the person who checked-in the code, here's the example of rcs identifiers that is used...

static char *Id = "$Id$";
static char *Author = "$Author$";

The above strings when checked into a revision control system, they get expanded next time it gets checked out...

static char *Id = "Foo, v1.1, 2009-02-18, 13:13";
static char *Author = "foo";

And use the utility 'ident' which runs on the binaries, 'ident' looks for Revision Control Systems (rcs) identifiers within a binary.

Hope this helps, Best regards, Tom.



来源:https://stackoverflow.com/questions/2296101/file-version-information

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