[ANNOUNCE]: clang compiling ports, take 2

Matthias Andree mandree at FreeBSD.org
Sun Sep 4 07:40:09 UTC 2011

Am 04.09.2011 08:42, schrieb Ruslan Mahmatkhanov:
> Roman Divacky wrote on 25.07.2011 19:59:
>> Hi!
>> Flz@ just run another exp-build with CC=clang and CXX=clang++. The
>> results can be
>> seen here:
>> http://pointyhat.freebsd.org/errorlogs/amd64-errorlogs/e.9-exp.20110723205754/
>> Since the last run we've managed to fix the biggest offenders but that
>> uncovered others that need fixing. The "Reason" column was extended
>> and now
>> shows "assumes_gcc" which is the lowest hanging fruit :)
>> A lot of these failures are trivial to fix (ie. assumes_gcc reason)
>> and prevent
>> a lot of other ports from building.
>> It would be great if you could skim over the list to see if some of
>> the ports
>> you maintain are broken and possibly try to fix them. A small
>> introduction into
>> the Clang+Ports can be read at: http://wiki.freebsd.org/PortsAndClang.
>> Please focus on the biggest offenders (ie. ports that prevent the most
>> other
>> ports from building).
>> Thank you for helping us again!
>> Roman Divacky
> Hi, i maintain port (sysutils/rdup) that is failing with clang:
> http://pointyhat.freebsd.org/errorlogs/amd64-errorlogs/e.9-exp.20110723205754/rdup-1.1.11_1.log
> But it's hard to realize to me how to fix this. I've tried irc
> (#freebsd-clang and #freebsd-ports on irc.oftc.net) - and nobody hangs
> there.
> Can please anybody help?

Solution: (Have the author) fix the code to not do stupid things like this:

clang -Wall -W -Werror -O2 -pipe -fno-strict-aliasing
-I/usr/local/include -DHAVE_CONFIG_H
-DLOCALEROOTDIR=\"/usr/local/share/locale\" -D_FILE_OFFSET_BITS=64
-D_LARGE_FILES -Os -Wpointer-arith -Wstrict-prototypes
-I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include   -c
rdup-tr.c:205:14: error: explicitly assigning a variable of type 'struct
rdup *' to itself [-Werror,-Wself-assign]
                rdup_entry = rdup_entry;
                ~~~~~~~~~~ ^ ~~~~~~~~~~
1 error generated.
gmake: *** [rdup-tr.o] Error 1

It's probably a logic error, or mistyped.

Clang also states that the error manifests itself by:

-Wself-assign is part of -Wall or -W (didn't check which one)
 that triggers this warning

-Werror turns all warnings into errors

Workarounds are: add -Wno-self-assign, omit -Werror.  I don't recommend
either.  Also ask the author to make sure that "-Werror" is accompanied
by "-pedantic" during development upstream so that all mandatory
diagnostics are actually enabled, and possibly also with -std=c99 or
-std=c89 unless GNU extensions are used.


More information about the freebsd-ports mailing list