Bug 254161

Summary: Compiling security/libgcrypt with debug symbols fails
Product: Ports & Packages Reporter: Marcos Rodrigues Gonzalez <mrgonzalez1275>
Component: Individual Port(s)Assignee: Cy Schubert <cy>
Status: Closed Not Accepted    
Severity: Affects Only Me CC: cy, mrgonzalez1275
Priority: --- Flags: linimon: maintainer-feedback? (cy)
Version: Latest   
Hardware: amd64   
OS: Any   
Attachments:
Description Flags
Full build log none

Description Marcos Rodrigues Gonzalez 2021-03-09 15:52:26 UTC
Created attachment 223123 [details]
Full build log

Hi,

I am having some compilation issues on libgcrypt, combined with debug symbols on make.conf

WITH_DEBUG=YES
CFLAGS="-ggdb"

It fails with some asm erros (full log attached):

basic.c:315:16: error: inline assembly requires more registers than available

Disabling debug symbols or forcing "--disable-asm" directly on the Makefile, runs fine.

Note: The basic.c is inside work/libgcrypt-1.9.2/tests.

Thank you,
Comment 1 Cy Schubert freebsd_committer freebsd_triage 2021-03-10 05:22:40 UTC
You will need to either compile without PIC or free up a register.
Comment 2 Cy Schubert freebsd_committer freebsd_triage 2021-03-10 05:43:45 UTC
You will need to free up a register. Otherwise:

https://bugs.llvm.org/show_bug.cgi?id=19943
https://bugs.llvm.org/show_bug.cgi?id=21234

Try gcc.
Comment 3 Marcos Rodrigues Gonzalez 2021-03-11 00:44:00 UTC
Could it be because it is running as a VM under qemu/kvm, much more related to llvm.

But would it be possible to add an option to disable asm or tests?
Comment 4 Cy Schubert freebsd_committer freebsd_triage 2021-03-11 00:57:18 UTC
It has nothing to do with qemu or kvm. The DEBUG requires at least one register be used and the authors of libgcrypt used all of them. However this is only an LLVM problem. You can work around it by:

CFLAGS="-ggdb" make WITH_DEBUG=YES USE_GCC=11

My example above uses GCC10 but you can do the same with GCC10, 9 or 8. I tested it with all four versions of gcc installed here.

This problem doesn't affect GCC and the LLVM developers have no intention of fixing this.

I'd prefer not to complicate the port with workarounds most people won't need, instead advising people to use GCC instead.
Comment 5 Marcos Rodrigues Gonzalez 2021-03-11 01:39:35 UTC
I see, ty.
Comment 6 Cy Schubert freebsd_committer freebsd_triage 2021-03-11 02:59:52 UTC
That should have said "uses GCC11". I changed the sentence after the fact and forgot to amend the first part.

I'll close this ticket.