1
我想对glibc
库进行一些修改。第一步是在编译程序时能够使用特定的版本。我在ubuntu下12.10和我的目录是:使用不同版本的glibc?
/mydirectory/glibc-2.17 (where I have extracted the last version from the website)
/mydirectory/glibc-2.17-build (where I have executed the configure and make command)
/mydirectory/test/helloworld.c (where I have my helloworld program)
的helloworld.c
如下:
#include <stdlib.h>
#include <stdio.h>
int main(int argc, char* argv[])
{
char glibc[256] = "xxxx"; /* How to detect the glibc version here ? */
printf("hello, world\n");
printf("glibc version = %s\n", glibc);
return 0;
}
首先我怎么能打印的glibc
的版本? (我认为glibc中有一个宏/常量)。
其次,我应该使用什么命令行编译我的helloworld.c
文件以使用/mydirectory/glibc-2.17-build
中的glibc
?
“ld”的'-L'选项将一个目录添加到库搜索列表中。 – Barmar 2013-04-11 11:15:23
嗯...不会使用一些其他glibc比系统一旦导致问题一旦可执行文件链接一些*其他*库(反过来链接系统libc)? – DevSolar 2013-04-11 11:22:45