{"id":269272,"date":"2023-04-08T04:06:48","date_gmt":"2023-04-07T20:06:48","guid":{"rendered":"https:\/\/lrxjmw.cn\/zwlwjgsgfmxj.html"},"modified":"2023-04-08T04:06:48","modified_gmt":"2023-04-07T20:06:48","slug":"zwlwjgsgfmxj","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/zwlwjgsgfmxj.html","title":{"rendered":"\u638c\u63e1Linux .pc\u6587\u4ef6\u683c\u5f0f\uff0c8\u4e2a\u65b9\u9762\u8be6\u89e3"},"content":{"rendered":"

\u5728Linux<\/a>\u7cfb\u7edf<\/a>\u4e2d\uff0c.pc\u6587\u4ef6\u662f\u4e00\u4e2a\u6bd4\u8f83\u795e\u79d8\u7684\u5b58\u5728\u3002\u5f88\u591a\u4eba\u90fd\u4e0d\u592a\u4e86\u89e3\u5b83\u7684\u4f5c\u7528\u548c\u5177\u4f53\u7528\u6cd5\u3002\u672c\u6587\u5c06\u4ece8\u4e2a\u65b9\u9762\u8be6\u7ec6\u5206\u6790\u8fd9\u4e2a\u6587\u4ef6\u683c\u5f0fred hat linux\u4e0b\u8f7d\uff0c\u8ba9\u5927\u5bb6\u5bf9\u5b83\u6709\u66f4\u6df1\u5165\u7684\u7406\u89e3\u548c\u8ba4\u8bc6\u3002<\/p>\n

1..pc\u6587\u4ef6\u662f\u4ec0\u4e48\uff1f<\/b><\/p>\n

.pc\u6587\u4ef6\u5168\u79f0\u4e3apackage-config filelinux\u6e38\u620f\uff0c\u662f\u4e00\u4e2a\u8f6f\u4ef6\u5305\u914d\u7f6e\u6587\u4ef6\u3002\u5b83\u4e3b\u8981\u7528\u6765\u63cf\u8ff0\u8f6f\u4ef6\u5305\u7684\u7f16\u8bd1\u3001\u94fe\u63a5\u7b49\u76f8\u5173\u4fe1\u606f\uff0c\u65b9\u4fbf\u5176\u4ed6\u7a0b\u5e8f\u5728\u7f16\u8bd1\u65f6\u8c03\u7528\u8fd9\u4e9b\u4fe1\u606f\u3002.pc\u6587\u4ef6\u901a\u5e38\u5b58\u50a8\u5728\/usr\/lib\/pkgconfig\u6216\u8005\/usr\/share\/pkgconfig\u76ee\u5f55\u4e0b\u3002<\/p>\n

2..pc\u6587\u4ef6\u7684\u4f5c\u7528<\/b><\/p>\n

.pc\u6587\u4ef6\u7684\u4f5c\u7528\u662f\u4e3a\u4e86\u8ba9\u5176\u4ed6\u7a0b\u5e8f\u8c03\u7528\u76f8\u5173\u8f6f\u4ef6\u5305\u65f6\u66f4\u52a0\u65b9\u4fbf\u3002\u901a\u8fc7\u8bfb\u53d6.pc\u6587\u4ef6\u4e2d\u7684\u4fe1\u606f\uff0c\u7a0b\u5e8f\u53ef\u4ee5\u81ea\u52a8\u83b7\u53d6\u6240\u9700\u5e93\u7684\u540d\u79f0\u3001\u7248\u672c\u53f7\u3001\u5934\u6587\u4ef6\u8def\u5f84\u3001\u5e93\u8def\u5f84\u7b49\u4fe1\u606f\uff0c\u4ece\u800c\u8fdb\u884c\u7f16\u8bd1\u548c\u94fe\u63a5\u64cd\u4f5c\u3002<\/p>\n

3..pc\u6587\u4ef6\u7684\u683c\u5f0f<\/b><\/p>\n

.pc\u6587\u4ef6\u91c7\u7528INI\u683c\u5f0f\uff0c\u5373\u7531\u8282\uff08section\uff09\u548c\u952e\u503c\u5bf9\uff08key-value\uff09\u7ec4\u6210\u3002\u5176\u4e2d\uff0c\u8282\u4ee5\u65b9\u62ec\u53f7\u62ec\u8d77\u6765\uff0c\u952e\u503c\u5bf9\u4ee5\u7b49\u53f7\u8fde\u63a5\u3002\u4e0b\u9762\u662f\u4e00\u4e2a\u793a\u4f8b\uff1a<\/p>\n

\n

\n[Package]\nName=example\nVersion=1.0\nDescription=An example package\nLibs=-L\/usr\/local\/lib -lexample\nCflags=-I\/usr\/local\/include\/example\n<\/pre>\n<\/p>\n

\u4e0a\u9762\u8fd9\u4e2a\u4f8b\u5b50\u5b9a\u4e49\u4e86\u4e00\u4e2a\u540d\u4e3aexample\u7684\u8f6f\u4ef6\u5305\uff0c\u5305\u542b\u540d\u79f0\u3001\u7248\u672c\u53f7\u3001\u63cf\u8ff0\u3001\u5e93\u8def\u5f84\u548c\u5934\u6587\u4ef6\u8def\u5f84\u7b49\u4fe1\u606f\u3002<\/p>\n

4..pc\u6587\u4ef6\u7684\u5e38\u7528\u952e\u503c\u5bf9<\/b><\/p>\n

.pc\u6587\u4ef6\u4e2d\u5305\u542b\u4e86\u5f88\u591a\u952e\u503c\u5bf9\uff0c\u5176\u4e2d\u4e00\u4e9b\u6bd4\u8f83\u5e38\u7528\uff0c\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n

- Name\uff1a\u8f6f\u4ef6\u5305\u540d\u79f0<\/p>\n

- Version\uff1a\u8f6f\u4ef6\u5305\u7248\u672c\u53f7<\/p>\n

- Description\uff1a\u8f6f\u4ef6\u5305\u63cf\u8ff0<\/p>\n

- Libs\uff1a\u94fe\u63a5\u5e93\u8def\u5f84\u53ca\u5e93\u540d<\/p>\n

- Cflags\uff1a\u5934\u6587\u4ef6\u8def\u5f84<\/p>\n

\u901a\u8fc7\u8fd9\u4e9b\u952e\u503c\u5bf9\uff0c\u5176\u4ed6\u7a0b\u5e8f\u53ef\u4ee5\u81ea\u52a8\u83b7\u53d6\u8f6f\u4ef6\u5305\u7684\u76f8\u5173\u4fe1\u606f\uff0c\u4ece\u800c\u8fdb\u884c\u7f16\u8bd1\u548c\u94fe\u63a5\u64cd\u4f5c\u3002<\/p>\n

linux .pc\u6587\u4ef6_\u534e\u7855eee pc linux_linux .pc\u6587\u4ef6<\/p>\n

5..pc\u6587\u4ef6\u7684\u4f7f\u7528\u65b9\u6cd5<\/b><\/p>\n

\u5728\u7f16\u8bd1\u7a0b\u5e8f\u65f6\uff0c\u53ef\u4ee5\u4f7f\u7528pkg-config\u547d\u4ee4<\/a>\u6765\u8bfb\u53d6.pc\u6587\u4ef6\u4e2d\u7684\u4fe1\u606f\u3002\u4f8b\u5982\uff1a<\/p>\n

\n

\ngcc `pkg-config --cflags --libs example` main.c-o main\n<\/pre>\n<\/p>\n

\u4e0a\u9762\u8fd9\u4e2a\u547d\u4ee4\u4f1a\u81ea\u52a8\u83b7\u53d6example\u8f6f\u4ef6\u5305\u7684\u5934\u6587\u4ef6\u8def\u5f84\u548c\u5e93\u8def\u5f84\uff0c\u5e76\u5c06\u5176\u4f20\u9012\u7ed9gcc\u7f16\u8bd1\u5668\u3002<\/p>\n

6..pc\u6587\u4ef6\u548c\u9759\u6001\u94fe\u63a5\u5e93\u7684\u5173\u7cfb<\/b><\/p>\n

.pc\u6587\u4ef6\u4e3b\u8981\u7528\u4e8e\u52a8\u6001\u94fe\u63a5\u5e93\u7684\u7f16\u8bd1\u548c\u94fe\u63a5\uff0c\u4f46\u4e5f\u53ef\u4ee5\u7528\u4e8e\u9759\u6001\u94fe\u63a5\u5e93\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0blinux .pc\u6587\u4ef6<\/strong>\uff0c\u9700\u8981\u4f7f\u7528-L\u9009\u9879\u6307\u5b9a\u9759\u6001\u94fe\u63a5\u5e93\u8def\u5f84\uff0c\u5e76\u5728Libs\u4e2d\u6307\u5b9a\u9759\u6001\u94fe\u63a5\u5e93\u540d\u3002\u4f8b\u5982\uff1a<\/p>\n

\n

\n[Package]\nName=example-static\nVersion=1.0\nDescription=An example static library\nLibs=-L\/usr\/local\/lib -lexample-static -lm\nCflags=-I\/usr\/local\/include\/example\n<\/pre>\n<\/p>\n

\u4e0a\u9762\u8fd9\u4e2a\u4f8b\u5b50\u5b9a\u4e49\u4e86\u4e00\u4e2a\u540d\u4e3aexample-static\u7684\u9759\u6001\u94fe\u63a5\u5e93\uff0c\u5305\u542b\u540d\u79f0\u3001\u7248\u672c\u53f7\u3001\u63cf\u8ff0\u3001\u5e93\u8def\u5f84\u548c\u5934\u6587\u4ef6\u8def\u5f84\u7b49\u4fe1\u606f\u3002<\/p>\n

7..pc\u6587\u4ef6\u548c\u52a8\u6001\u94fe\u63a5\u5e93\u7684\u5173\u7cfb<\/b><\/p>\n

\u5bf9\u4e8e\u52a8\u6001\u94fe\u63a5\u5e93\uff0c.pc\u6587\u4ef6\u901a\u5e38\u53ea\u9700\u8981\u6307\u5b9a\u5e93\u540d\u5373\u53ef\u3002\u4f8b\u5982\uff1a<\/p>\n

\n

\n[Package]\nName=example-dynamic\nVersion=1.0\nDescription=An example dynamic library\nLibs=-lexample-dynamic\nCflags=-I\/usr\/local\/include\/example\n<\/pre>\n<\/p>\n

\u4e0a\u9762\u8fd9\u4e2a\u4f8b\u5b50\u5b9a\u4e49\u4e86\u4e00\u4e2a\u540d\u4e3aexample-dynamic\u7684\u52a8\u6001\u94fe\u63a5\u5e93\uff0c\u5305\u542b\u540d\u79f0\u3001\u7248\u672c\u53f7\u3001\u63cf\u8ff0\u3001\u5e93\u8def\u5f84\u548c\u5934\u6587\u4ef6\u8def\u5f84\u7b49\u4fe1\u606f\u3002<\/p>\n

8..pc\u6587\u4ef6\u7684\u4f8b\u5b50<\/b><\/p>\n

\u4e0b\u9762\u662f\u4e00\u4e2a\u5b8c\u6574\u7684.pc\u6587\u4ef6\u7684\u4f8b\u5b50\uff0c\u7528\u4e8e\u63cf\u8ff0\u4e00\u4e2a\u540d\u4e3alibjpeg-turbo\u7684\u8f6f\u4ef6\u5305\uff1a<\/p>\n

\n

\nprefix=\/usr\/local\nexec_prefix=${prefix}\nlibdir=${exec_prefix}\/lib\nincludedir=${prefix}\/include\nName: libjpeg-turbo\nDescription: A JPEG image codec that uses SIMD instructions (MMX, SSE2, NEON)\nVersion:2.1.0\nRequires:\nLibs:-L${libdir}-lturbojpeg\nLibs.private:-ljpeg -lm -ldl\nCflags:-I${includedir}\n<\/pre>\n<\/p>\n

\u901a\u8fc7\u4e0a\u8ff0\u5206\u6790linux .pc\u6587\u4ef6<\/strong>\uff0c\u76f8\u4fe1\u5927\u5bb6\u5bf9.pc\u6587\u4ef6\u6709\u4e86\u66f4\u52a0\u6df1\u5165\u7684\u7406\u89e3\u3002\u5728Linux\u7cfb\u7edf\u4e2d\uff0c\u4e86\u89e3\u8fd9\u4e2a\u6587\u4ef6\u683c\u5f0f\u5bf9\u4e8e\u5f00\u53d1\u8005\u6765\u8bf4\u662f\u975e\u5e38\u91cd\u8981\u7684\u4e00\u90e8\u5206\u77e5\u8bc6\u70b9\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

.pc\u6587\u4ef6\u662f\u4ec0\u4e48\uff1ffile\uff0c\u662f\u4e00\u4e2a\u8f6f\u4ef6\u5305\u914d\u7f6e\u6587\u4ef6\u3002.pc\u6587\u4ef6\u7684\u683c\u5f0f.pc\u6587\u4ef6\u7684\u5e38\u7528\u952e\u503c\u5bf9\u901a\u8fc7\u8fd9\u4e9b\u952e\u503c\u5bf9\uff0c\u5176\u4ed6\u7a0b\u5e8f\u53ef\u4ee5\u81ea\u52a8\u83b7\u53d6\u8f6f\u4ef6\u5305\u7684\u76f8\u5173\u4fe1\u606f\uff0c\u4ece\u800c\u8fdb\u884c\u7f16\u8bd1\u548c\u94fe\u63a5\u64cd\u4f5c\u3002.pc\u6587\u4ef6\u7684\u4f7f\u7528\u65b9\u6cd5pc\u6587\u4ef6\u4e2d\u7684\u4fe1\u606f\u3002.pc\u6587\u4ef6\u548c\u9759\u6001\u94fe\u63a5\u5e93\u7684\u5173\u7cfb.pc\u6587\u4ef6\u548c\u52a8\u6001\u94fe\u63a5\u5e93\u7684\u5173\u7cfb.pc\u6587\u4ef6\u7684\u4f8b\u5b50pc\u6587\u4ef6\u7684\u4f8b\u5b50\uff0c\u7528\u4e8e\u63cf\u8ff0\u4e00\u4e2a\u540d\u4e3alibjpeg-turbo\u7684\u8f6f\u4ef6\u5305\uff1apc\u6587\u4ef6\u6709\u4e86\u66f4\u52a0\u6df1\u5165\u7684\u7406\u89e3\u3002<\/p>\n","protected":false},"author":1,"featured_media":269273,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[988],"tags":[999],"class_list":["post-269272","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tougao","tag-999"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/269272","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=269272"}],"version-history":[{"count":0,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/269272\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/269273"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=269272"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=269272"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=269272"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}