/usr/bin/ld: error: unknown argument: -Bforcearchive cc: error: linker command failed with exit code 1 (use -v to see invocation) This happens because OpenSSL tries to detect GNU ld with: ./work/openssl-1.0.2p/Makefile.shared:DETECT_GNU_LD=($(CC) -Wl,-V /dev/null 2>&1 | grep '^GNU ld' )>/dev/null and provides a different link invocation for non-GNU ld, which ends up with the -Bforcearchive flag (which is not supported by GNU ld or lld) See https://www.sigbus.info/software-compatibility-and-our-own-user-agent-problem.html for some more info. A patch like this is probably sufficient: -./work/openssl-1.0.2p/Makefile.shared:DETECT_GNU_LD=($(CC) -Wl,-V /dev/null 2>&1 | grep '^GNU ld' )>/dev/null +./work/openssl-1.0.2p/Makefile.shared:DETECT_GNU_LD=($(CC) -Wl,-V /dev/null 2>&1 | grep 'GNU' )>/dev/null
Created attachment 197212 [details] Fix LLD on i386 Test with/without patch and emaste's suggestion worked; This is the patch with the fix for LLD on i386
Comment on attachment 197212 [details] Fix LLD on i386 I'll defer to others for confirmation bust the portrevision bump isn't needed: this does not introduce a change if LLD is not in use, and if it is the port does not build today. sed expression LGTM
K I will update the portrevision. Habit of changing if version doesn't change
Created attachment 197213 [details] Fix LLD on i386 Un-bump PORTREVISION
LGTM
Patch in attachment 197213 [details] works for security/openssl-unsafe
With this patch (adapted for 2 of them) these successfully built: openssl openssl-devel openssl-unsafe openssl111 does not have Makefile.shared, the same approach will likely work but a different patch will be necessary
(In reply to Ed Maste from comment #7) I’ll take a look ASAP.
(In reply to Nathan from comment #8) Hi Nathan, please let me know when you've verified that this is functional. I have the commits lined up.
This PR was originally just for security/openssl and I've confirmed the patch is functional there, and that the patch (with trivially adaption) is functional with the other two security/openssl-* ports. security/openssl111 will need a completely different patch (but the same approach) and can be separate.
Created attachment 197571 [details] svn diff for security/openssl111 Please verify this as well with lld on i386 Same fix, different file/location
(In reply to Bernard Spil from comment #11) This fixes the main problem but an additional issue remains when linking with lld: --- crypto/cryptlib.o --- cc -I. -Icrypto/include -Iinclude -fPIC -pthread -Wa,--noexecstack -Qunused-arguments -O2 -pipe -fstack-protector -fno-strict-aliasing -DL_ENDIAN -DOPENSSL_PIC -DOPENSSL_BN_ASM_PART_WORDS -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DRC4_ASM -DMD5_ASM -DRMD160_ASM -DAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DPADLOCK_ASM -DPOLY1305_ASM -DOPENSSLDIR="\"/usr/local/openssl\"" -DENGINESDIR="\"/usr/local/lib/engines-1.1\"" -D_THREAD_SAFE -D_REENTRANT -DNDEBUG -MMD -MF crypto/cryptlib.d.tmp -MT crypto/cryptlib.o -c -o crypto/cryptlib.o crypto/cryptlib.c ... --- libcrypto.so --- /usr/bin/ld: error: can't create dynamic relocation R_386_PC32 against symbol: OPENSSL_ia32cap_P in readonly segment; recompile object files with -fPIC >>> defined in crypto/cryptlib.o >>> referenced by crypto/rc4/rc4-586.o:(RC4_set_key) /usr/bin/ld: error: can't create dynamic relocation R_386_PC32 against symbol: OPENSSL_ia32cap_P in readonly segment; recompile object files with -fPIC >>> defined in crypto/cryptlib.o >>> referenced by crypto/rc4/rc4-586.o:(RC4_options) cc: error: linker command failed with exit code 1 (use -v to see invocation) *** [libcrypto.so] Error code 1 This is a much trickier issue and will take more work. That said, it wouldn't hurt to apply the config change to all four.
Sorry sorta forgot about trying to fix this one. Been side tracked on attempts of getting a port to build in mips
Created attachment 197583 [details] OpenSSL 1.1 LLD fix This one is for OpenSSL 1.1 Tested inside poudriere with ld.lld replacing ld Also moved variables around as they are wrong, because nothing should go after OPTIONS IIRC, according to mat
Comment on attachment 197583 [details] OpenSSL 1.1 LLD fix (In reply to Nathan from comment #14) Moved the security/openssl111 bits to https://reviews.freebsd.org/D17362
A commit references this bug: Author: brnrd Date: Fri Oct 5 09:17:02 UTC 2018 New revision: 481266 URL: https://svnweb.freebsd.org/changeset/ports/481266 Log: security/openssl111: Fix linking with lld on i386 - Fix shared option - While here, fix ordering PR: 231459 Submitted by: Nathan <ndowens yahoo com> Reported by: emaste Differential Revision: https://reviews.freebsd.org/D17362 Changes: head/security/openssl111/Makefile
Approved by: emaste, ndowens was missing from commit msg
Most recent exp-run still showed a failure in security/openssl and security/openssl-unsafe: http://package18.nyi.freebsd.org/build.html?mastername=headi386PR214864-default&build=2019-01-05_21h00m02s http://package18.nyi.freebsd.org/data/headi386PR214864-default/2019-01-05_21h00m02s/logs/errors/openssl-1.0.2q,1.log http://package18.nyi.freebsd.org/data/headi386PR214864-default/2019-01-05_21h00m02s/logs/errors/openssl-unsafe-1.0.2.20170706.log ld: error: unknown argument: -Bforcearchive cc: error: linker command failed with exit code 1 (use -v to see invocation) *** Error code 1 Stop.
A commit references this bug: Author: brnrd Date: Sun Feb 17 19:09:55 UTC 2019 New revision: 493181 URL: https://svnweb.freebsd.org/changeset/ports/493181 Log: security/openssl: Fix build with lld on i386 PR: 231459 Submitted by: Nathan <ndowens@yahoo.com> Reported by: emaste Changes: head/security/openssl/Makefile
lld has been enabled as system linker for i386 on stable/12 in advance of 12.1 (as of a few minutes ago) From the comments it appears this issue was fixed some time ago?
This can be close, I guess?