【发布时间】:2013-04-03 13:26:37
【问题描述】:
我想对glibc 库进行一些修改。第一步是在我编译程序时能够使用特定的版本。我在 ubuntu 12.10 下,我的目录是:
/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?
【问题讨论】:
-
-L选项到ld将目录添加到库搜索列表。 -
Hmm... 一旦可执行文件链接了一些 other 库(该库又链接到系统 libc )?
标签: c compilation glibc