{"id":1776,"date":"2025-12-16T01:59:25","date_gmt":"2025-12-16T01:59:25","guid":{"rendered":"http:\/\/www.recologypower.com:9080\/?p=1776"},"modified":"2025-12-16T01:59:26","modified_gmt":"2025-12-16T01:59:26","slug":"%e3%80%90linux%e3%80%91error-macro-__time__-might-prevent-reproducible-builds-werrordate-time","status":"publish","type":"post","link":"http:\/\/www.recologypower.com:9080\/?p=1776","title":{"rendered":"\u3010Linux\u3011error: macro &#8220;__TIME__&#8221; might prevent reproducible builds [-Werror=date-time]"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">\u89e3\u51b3\u65b9\u6cd5\u6709\u5982\u4e0b\u51e0\u79cd\uff0c\u53ef\u6839\u636e\u9700\u6c42\u8fdb\u884c\u9009\u62e9<\/h2>\n\n\n\n<p><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\u7b2c\u4e00\u79cd\u89e3\u51b3\u65b9\u6cd5 \u5728makefile\u4e2d\u6dfb\u52a0\u5982\u4e0b\u9009\u9879\n\nEXTRA_CFLAGS += -Wno-error=date-time\nEXTRA_CFLAGS +=-Wno-date-time\n\n \u6ce8\u610f\uff1a\u5728\u7b2c\u4e8c\u6bb5\u5b9a\u4f4d\u4e2d\u5df2\u7ecf\u8bf4\u5230\u53ea\u6709\u57284.9\u4ee5\u53ca\u4e4b\u540e\u7684gcc\u7248\u672c\u4e2d\u624d\u6709\u8fd9\u4e24\u4e2a\u9009\u9879\uff0c\u5982\u679c\u4f60\u5728gcc\u7248\u672c\u5c0f\u4e8e4.9\u7684\u7cfb\u7edf\u4e0a\u7f16\u8bd1\uff0c\u6bd4\u5982\u5728centos7.2\u7cfb\u7edf\u4e2d\uff0ccentos\u4e2d\u9ed8\u8ba4\u7684gcc\u7248\u672c\u662f4.8.5\uff0c\u7f16\u8bd1\u65f6\u5c31\u4f1a\u62a5\"cc1: \u9519\u8bef\uff1a-Werror=date-time\uff1a\u6ca1\u6709\u9009\u9879 -Wdate-time\"\u9519\u8bef\uff0c\u6240\u4ee5\u8fd9\u79cd\u89e3\u51b3\u65b9\u6cd5\u5982\u679c\u53ea\u662f\u4f7f\u75284.9\u4ee5\u4e0a\u7684gcc\u7248\u672c\u662f\u6ca1\u6709\u95ee\u9898\u7684\uff1b\n\n\n \u7b2c\u4e8c\u79cd\u89e3\u51b3\u65b9\u6cd5\n\u4fee\u6539\/lib\/modules\/'uname -r'\/build\/Makefile\u6587\u4ef6\uff0c\u6211\u7684\u662f\/lib\/modules\/4.4.0-116-generic\/build\/Makefile\n\u5c06KBUILD_CFLAGS   += $(call cc-option,-Werror=date-time)\u8fd9\u4e00\u884c\u6ce8\u91ca\u6389\n\n\n\n\u6ce8\u610f:\u8fd9\u79cd\u65b9\u6cd5\u867d\u7136\u89e3\u51b3\u4e86\u8fd9\u4e2a\u95ee\u9898\uff0c\u4f46\u662f\u4fee\u6539\u4e86\u7cfb\u7edf\u672c\u8eab\u7684\u5c5e\u6027\uff0c\u4e0d\u592a\u63a8\u8350\n\n\u7b2c\u4e09\u79cd\u89e3\u51b3\u65b9\u6cd5\n\n\u8fd9\u4e00\u79cd\u65b9\u6cd5\u4e5f\u662f\u6211\u6bd4\u8f83\u63a8\u8350\u7684\u65b9\u6cd5\uff0c\u4fee\u6539\u5185\u6838\u6a21\u5757\u7684makefile\u6587\u4ef6\uff0c\u6dfb\u52a0\u4e00\u884c\n\nccflags-y+=$(shell if &#91; $(call cc-version) -ge 0490 ] ; then echo \"-Wno-error=date-time -Wno-date-time\"; fi ;)\n\n\u5728linux\u5185\u6838\u7684\u6700\u9876\u5c42\u76ee\u5f55\u4e5f\u5c31\u662f\u6839\u76ee\u5f55\u4e0b\u9762\u7684Makefile\u6587\u4ef6\u4e2d\uff0c\u6709\u4e00\u4e2a\u53d8\u91cf\"KBUILD_CFLAGS\"\uff0c\u8fd9\u4e2a$(KBUILD_CFLAGS)\u4e2d\u5b58\u653e\u7684\u662f\u4f20\u9012\u7ed9gcc\u7f16\u8bd1\u5668\u7684\u7f16\u8bd1\u9009\u9879\uff0c\u5982\u679c\u88ab\u7f16\u8bd1\u7684\u6587\u4ef6\u5728\u88abgcc\u7f16\u8bd1\u65f6\uff0c\u6ca1\u6709\u7279\u6b8a\u7684\u8981\u6c42\u7684\u8bdd\u5c31\u4f1a\u4f7f\u7528$(KBUILD_CFLAGS)\u4e2d\u7684\u7f16\u8bd1\u9009\u9879\u3002\n\n\n\n \u4f46\u662f\u5982\u679c\u88abgcc\u7f16\u8bd1\u7684\u6587\u4ef6\u6709\u7279\u6b8a\u7684\u7f16\u8bd1\u9009\u9879\u8981\u6c42\u7684\u8bdd\uff0c\u4f7f\u7528\u5982\u4e0b\u7684\u65b9\u5f0f\u6765\u6307\u5b9a\u7f16\u8bd1\u9009\u9879\uff1a\n\n ccflags-y,\u662f\u6307\u5b9a\u7ed9$(CC)\u7684\u7f16\u8bd1\u9009\u9879\uff1b\n\n asflags-y,\u662f\u6307\u5b9a\u7ed9$(AS)\u7684\u7f16\u8bd1\u9009\u9879\uff1b\n\n ldflags-y,\u662f\u6307\u5b9a\u7ed9$(LD)\u7684\u7f16\u8bd1\u9009\u9879\uff1b<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<div class=\"slide-text-bg2\">\n<h3>\u89e3\u51b3\u65b9\u6cd5\u6709\u5982\u4e0b\u51e0\u79cd\uff0c\u53ef\u6839\u636e\u9700\u6c42\u8fdb\u884c\u9009\u62e9<\/h3>\n<\/div>\n<div class=\"flex-btn-div\"><a href=\"http:\/\/www.recologypower.com:9080\/?p=1776\" class=\"btn1 flex-btn\">\u9605\u8bfb\u66f4\u591a<\/a><\/div>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[110],"tags":[],"_links":{"self":[{"href":"http:\/\/www.recologypower.com:9080\/index.php?rest_route=\/wp\/v2\/posts\/1776"}],"collection":[{"href":"http:\/\/www.recologypower.com:9080\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.recologypower.com:9080\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.recologypower.com:9080\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.recologypower.com:9080\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1776"}],"version-history":[{"count":1,"href":"http:\/\/www.recologypower.com:9080\/index.php?rest_route=\/wp\/v2\/posts\/1776\/revisions"}],"predecessor-version":[{"id":1777,"href":"http:\/\/www.recologypower.com:9080\/index.php?rest_route=\/wp\/v2\/posts\/1776\/revisions\/1777"}],"wp:attachment":[{"href":"http:\/\/www.recologypower.com:9080\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1776"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.recologypower.com:9080\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1776"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.recologypower.com:9080\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1776"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}