pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Building pkgsrc on current with clang



On Sat, Jul 01, 2017 at 02:26:56PM -0400, D'Arcy Cain wrote:
> So I have rebuilt my entire development system with clang and it looks
> pretty good.  I have so far build over 1,000 packages including the dreaded
> gobject-introspection with no errors.  I only have a few issues.
> 
> ===> Building for pkgin-0.9.4nb6
> [...]
> make: don't know how to make /usr/obj/destdir/usr/lib/crt0.o. Stop

What exactly is in your mk.conf?

> ===> Building for xenkernel48-4.8.0nb1
> [...]
> ld -L/usr/lib -Wl,-R/usr/lib -L/usr/pkg/lib -Wl,-R/usr/pkg/lib -melf_x86_64
> -melf_x86_64        -melf_x86_64  -T xen.lds -N prelink.o --build-id=sha1 \
> 
> /usr/obj/sysutils/xenkernel48/work.x86_64/xen-4.8.0/xen/common/symbols-dummy.o
> -o /usr/obj/sysutils/xenkernel48/work.x86_64/xen-4.8.0/xen/.xen-syms.0
> prelink.o: In function `xsm_default_action':
> /usr/obj/sysutils/xenkernel48/work.x86_64/xen-4.8.0/xen/include/xsm/dummy.h:80:
> undefined reference to `__xsm_action_mismatch_detected'
> /usr/obj/sysutils/xenkernel48/work.x86_64/xen-4.8.0/xen/include/xsm/dummy.h:80:(.text+0xbce6d):
> relocation truncated to fit: R_X86_64_PC32 against undefined symbol
> `__xsm_action_mismatch_detected'
> ld: /usr/obj/sysutils/xenkernel48/work.x86_64/xen-4.8.0/xen/.xen-syms.0:
> hidden symbol `__xsm_action_mismatch_detected' isn't defined

This is a known "bug", fixed in clang 5.0, but considered too invasive
for merge into 4.0.1. IIRC upstream Xen has dropped this, but I might be
confusing it. In essence, due to bad interactions between different
optimisations, the intentional references in dead code are not stripped.

> I notice that there are way more warnings under clang.  I understand that
> that is considered a feature.  Some of them seem a little too fussy such as
> this one.
> 
>   if ((x == y))
> 
> It warns about the extraneous parens.  Might make -Werror impossible.

This has been a long established "style" rule that
   if (x = y)
is an error and if it is intentional, it should be written as
   if ((x = y))

The clang warning is for the reverse, i.e.
   if ((x == y))
should be written without the extra brackets if it is intended.

Joerg


Home | Main Index | Thread Index | Old Index