The recent update of port security/libgcrypt to version 1.8.0 reveals an error on 12-CURRENT using LLVM 4.0.0 and LLVM 5.0.0 (no LLVM LLD used!): [...] libtool: compile: cc -DHAVE_CONFIG_H -I. -I.. -I../src -I../src -I/usr/local/include -O0 -pipe -O3 -fstack-protector -fno-strict-aliasing -std=gnu89 -fvisibility=hidden -Wall -c ./rndjent.c -fPIC -DPIC -o .libs/rndjent.o In file included from ./rndjent.c:86: ./jitterentropy-base.c:53:13: warning: unknown pragma ignored [-Wunknown-pragmas] #pragma GCC optimize ("O0") ^ ./jitterentropy-base.c:60:4: error: "The CPU Jitter random number generator must not be compiled with optimizations. See documentation. Use the compiler switch -O0 for compiling jitterentropy-base.c." #error "The CPU Jitter random number generator must not be compiled with optimizations. See documentation. Use the compiler switch -O0 for compiling jitterentropy-base.c." ^ 1 warning and 1 error generated. *** [rndjent.lo] Error code 1 make[4]: stopped in /usr/ports/security/libgcrypt/work/libgcrypt-1.8.0/random --- random-system.lo ---
I'll take a look. Thanks for reporting!
Please, try the following patch --- random/jitterentropy-base.c.orig 2017-07-23 10:26:06 UTC +++ random/jitterentropy-base.c @@ -51,6 +51,7 @@ #undef _FORTIFY_SOURCE #pragma GCC optimize ("O0") +#pragma clang optimize off #include "jitterentropy.h"
(In reply to Carlos J. Puga Medina from comment #2) No need for a patch. libgcrypt 1.8.0 builds fine with LLVM 5.0 (FreeBSD 12.0-CURRENT r321380) Log: http://sprunge.us/GiKd
(In reply to O. Hartmann from comment #0) (In reply to Carlos J. Puga Medina from comment #3) It also builds fine with LLVM 4.0
(In reply to O. Hartmann from comment #0) Would you mind show me the following output? cd /usr/ports/security/libgcrypt && make -V CFLAGS
Hi, another of the "affects many people" here. # make -V CFLAGS -O -pipe -march=haswell -fstack-protector -fno-strict-aliasing -std=gnu89 # fgrep CFLAGS /etc/make.conf CFLAGS= -O -pipe Also, no, it does not build with llvm 4.0, or at least not with clang 4.0.0 from stable/11 as of 11 days ago. > Log: http://sprunge.us/GiKd 503 Over Quota
(In reply to Christian Ullrich from comment #6) The machinery that libgcrypt uses to fix the optimization flags for the files they want built unoptimized is wrong: $ echo "cc -O -O2 -foo" | sed -e 's/-O\([1-9s][1-9s]*\)/-O0/' -e 's/-Ofast/-O0/g' cc -O -O0 -foo IOW, it it not aware that plain "-O" exists. I have updated your gnupg bug report; perhaps they will actually fix that.
(In reply to Christian Ullrich from comment #6) It is not recommended to override the CFLAGS defaults from /etc/make.conf CFLAGS= -O -pipe You should remove that line.
Again, don't muck about with CFLAGS or CPUTYPE variables. You're more likely to do harm than good. For the most part everything already uses their most "optimal" compiler flags. -O -pipe -march=haswell
Created attachment 184660 [details] patch Add patch to disable support for the Jitter entropy collector
Another possible solution is to fix the command line munging for jitterbase @@ -40,6 +43,7 @@ post-patch: @${RM} ${WRKSRC}/doc/gcrypt.info* @${REINPLACE_CMD} -e 's|ALIGN (3)|ALIGN (2)|g' ${WRKSRC}/mpi/i386/*.S + @${REINPLACE_CMD} -e 's|-O0/'\''|-O0/g'\''|g' ${WRKSRC}/random/Makefile.am
(In reply to Carlos J. Puga Medina from comment #5) -O2 -pipe -O3 -fstack-protector -fno-strict-aliasing -std=gnu89
I see where the problem lies and reverted -O3 to -O2. Now the port comples. :-/ Thanks for taking care of.
(In reply to Carlos J. Puga Medina from comment #11) I came across this issue as well recently. I was able to get the port to compile by applying this patch with a small modification: I used `Makefile.*` instead of `Makefile.am`.
A commit references this bug: Author: cpm Date: Tue Aug 1 12:10:14 UTC 2017 New revision: 447018 URL: https://svnweb.freebsd.org/changeset/ports/447018 Log: - Fix the command line munging for jitterbase PR: 220937 Reported by: O. Hartmann <ohartmann@walstatt.org> Obtained from: https://dev.gnupg.org/rCac39522ab08fcd2483edc223334c6ab9d19e91f3 MFH: 2017Q3 (blanket) Changes: head/security/libgcrypt/Makefile
A commit references this bug: Author: cpm Date: Tue Aug 1 12:21:46 UTC 2017 New revision: 447019 URL: https://svnweb.freebsd.org/changeset/ports/447019 Log: MFH: r447018 - Fix the command line munging for jitterbase PR: 220937 Reported by: O. Hartmann <ohartmann@walstatt.org> Obtained from: https://dev.gnupg.org/rCac39522ab08fcd2483edc223334c6ab9d19e91f3 Approved by: ports-secteam (blanket) Changes: _U branches/2017Q3/ branches/2017Q3/security/libgcrypt/Makefile